Assorted shell and Python scripts

Archive stuff

backup_podman_volumes backup_podvol
-8
create_archive
···
-
#!/usr/bin/env zsh
-
-
# Create a tarball from given directory.
-
-
dir_name="$1"
-
archive_name="${dir_name}-$(date '+%Y%m%d').tar.gz"
-
tar cvfz "$archive_name" "$1" && \
-
echo "Created archive $archive_name"
···
dayofweek .archived/dayofweek
gen_digital_archive_listing gen_archive_listing
-18
license
···
-
#!/usr/bin/env bash
-
-
set -euo pipefail
-
-
# Fetch an open source license
-
-
base_url="https://api.github.com/licenses"
-
headers="Accept: application/vnd.github.drax-preview+json"
-
-
if (( $# == 0 )); then
-
res=$(curl --silent --header $headers $base_url)
-
selection=$(echo "$res" | jq ".[].key" | tr -d '"' | gum choose --limit=1)
-
else
-
selection="$argv[1]"
-
fi
-
-
res=$(curl --silent --header $headers $base_url/$selection | jq ."body")
-
echo -e $res | tr -d '"'
···
mediawiki_backup .archived/mediawiki_backup
-25
myip
···
-
#!/usr/bin/env -S uv run --script
-
# /// script
-
# dependencies = [
-
# "requests",
-
# ]
-
# ///
-
-
"""
-
myip - Fetch and display public IP information from ipinfo.io
-
"""
-
-
import json
-
-
import requests
-
-
if __name__ == "__main__":
-
KEY_COLOR = "\033[92m"
-
END_COLOR = "\033[0m"
-
-
response = requests.get("https://ipinfo.io", timeout=60)
-
json_data = json.loads(response.text)
-
-
print()
-
for item in json_data:
-
print(f"- {KEY_COLOR}{item.title():<16}{END_COLOR} {json_data[item]}")
···
quickinfo .archived/quickinfo
sync_wikimedia_xmldumps .archived/sync_wikimedia_xmldumps