diff options
author | noa | 2024-01-03 10:33:14 +0000 |
---|---|---|
committer | noa | 2024-01-03 10:33:14 +0000 |
commit | bf0cf3862464b741fac3044c7898c1aeb9e9cd62 (patch) | |
tree | 9c03ce5fd45cb87b15ed2743a795234f65bf0f74 /booktime | |
parent | c6dcab9d7ead82b6cf7d985c3fa46527dcccc7b2 (diff) |
Move all commands into commands/ subdirectory
Diffstat (limited to 'booktime')
-rwxr-xr-x | booktime | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/booktime b/booktime deleted file mode 100755 index 9133210..0000000 --- a/booktime +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env bash - -# inspired by and using data from https://literature-clock.jenevoldsen.com/ - -# $2 = noa!noa@localhost -NICK="${2%!*}" -[ -z "$NICK" ] && NICK="$(whoami)" - -# the following timezone logic is taken from /town/our/timefor <3 -ip=$(finger $NICK 2>/dev/null | egrep -o -m 1 '([0-9]{1,3}\.){3}[0-9]{1,3}') -[[ -z $ip ]] && ip=$(finger $1 2>/dev/null | egrep -o -i -m 1 '([0-9a-f]){1,4}(:([0-9a-f]){1,4}){1,7}') -[[ -n $ip ]] && TIMEZONE=$(curl -s "https://ipapi.co/$ip/timezone") - -TIME=$(TZ=$TIMEZONE date "+%H:%M") -SENTS="/town/our/data/booktime.psv" - -awk -F '|' -v time="$TIME" \ - '{ if ($1 == time) { print $3 " --" $5 ", " $4 } else {next }}' "$SENTS" \ - | shuf \ - | tail -n1 - |