···
2
+
set script-interpreter := ["uv", "run", "--script"]
# Quickly copy the Tailscale install command
···
39
+
# Create a .tar.gz archive from {{dir}}
40
+
[group('utilities')]
45
+
archive_name="${DIR_NAME}-$(date '+%Y%m%d').tar.gz"
46
+
tar cvfz "$archive_name" "$DIR_NAME"
47
+
echo "Created archive $archive_name"
49
+
# Get the day of the week a given date falls on
50
+
[group('utilities')]
51
+
dayofweek year month day:
54
+
from datetime import datetime
56
+
if __name__ == "__main__":
57
+
if len(sys.argv) != 4:
58
+
print("Usage: dayofweek <year> <month> <day>")
61
+
print(datetime(int(sys.argv[1]), int(sys.argv[2]), int(sys.argv[3])).strftime("%A"))
63
+
# Download an open source license
64
+
[group('utilities')]
68
+
base_url="https://api.github.com/licenses"
69
+
headers="Accept: application/vnd.github.drax-preview+json"
70
+
res=$(curl --silent --header $headers $base_url)
71
+
selection=$(echo "$res" | jq ".[].key" | tr -d '"' | gum choose --limit=1)
72
+
res=$(curl --silent --header $headers $base_url/$selection | jq ."body")
73
+
echo -e "$res" | tr -d '"'
75
+
# Fetch and display public IP info
76
+
[group('utilities')]
86
+
myip - Fetch and display public IP information from ipinfo.io
92
+
if __name__ == "__main__":
93
+
KEY_COLOR = "\033[92m"
94
+
END_COLOR = "\033[0m"
96
+
response = requests.get("https://ipinfo.io", timeout=60)
97
+
json_data = json.loads(response.text)
100
+
for item in json_data:
101
+
print(f"- {KEY_COLOR}{item.title():<16}{END_COLOR} {json_data[item]}")
# vim: ts=4 sts=4 sw=4 et ft=just