Assorted shell and Python scripts

Add/update stuff

+49 -2
+4
awkuptime
··· 1 + #!/usr/bin/env sh 2 + 3 + # Lifted from https://superuser.com/a/1783477/3091052 4 + awk '{m=int($1/60%60);h=int($1/3600%24);d=int($1/86400);printf "%sd %sh %sm\n", d, h, m}' /proc/uptime
+20
feed_count
··· 1 + #!/usr/bin/env nu 2 + 3 + let mf_auth_token = (kwallet-query -r miniflux-auth-token kdewallet) 4 + let mf_password = (kwallet-query -r miniflux-password kdewallet) 5 + 6 + ( 7 + curl \ 8 + -s \ 9 + -X GET \ 10 + -H "Content-Type: application/json" \ 11 + -H $"X-Auth-Token: ($mf_auth_token)" \ 12 + -u $"hyperreal:($mf_password)" \ 13 + "https://mf.vern.cc/v1/feeds/counters" 14 + ) 15 + | from json 16 + | get unreads 17 + | values 18 + | math sum 19 + 20 + # vim: sw=4 sts=4 ts=4 ai et ft=nu
-1
hyperreal_backup
··· 13 13 14 14 BORG_ARCHIVE=$(borg list ssh://root@hyperreal.carp-wyvern.ts.net/srv/borgbackup/hyperreal | tail -n 1 | awk '{print $1}') 15 15 ARCHIVE_BASENAME=$(echo "$BORG_ARCHIVE" | cut -d "T" -f 1) 16 - TS_HOST=$(tailscale status --json | jq ".Self.HostName" | tr -d '"') 17 16 18 17 if ! borg export-tar \ 19 18 "ssh://root@hyperreal.carp-wyvern.ts.net/srv/borgbackup/hyperreal::${BORG_ARCHIVE}" \
+24
split_dict
··· 1 + #!/usr/bin/env bash 2 + 3 + # Check if gum is available 4 + if ! command -v gum >/dev/null; then 5 + echo "Missing dependency: gum" 6 + echo "See https://github.com/charmbracelet/gum" 7 + exit 1 8 + fi 9 + 10 + # Check if get-def is available 11 + if ! command -v get-def >/dev/null; then 12 + echo "Missing dependency: get-def" 13 + echo "Run pipx install get-def" 14 + exit 1 15 + fi 16 + 17 + WORD=$(gum input --placeholder="word") 18 + 19 + if [[ -n "$ZELLIJ" ]]; then 20 + zellij action new-pane -- get-def "$WORD" 21 + else 22 + echo "No Zellij sessions detected." 23 + exit 1 24 + fi
+1 -1
split_man
··· 1 1 #!/usr/bin/env bash 2 2 3 3 # Check if gum is available 4 - if ! test -x "$(command -v gum)"; then 4 + if ! command -v gum >/dev/null; then 5 5 echo "Missing dependency: gum" 6 6 echo "See https://github.com/charmbracelet/gum" 7 7 exit 1