From bf0cf3862464b741fac3044c7898c1aeb9e9cd62 Mon Sep 17 00:00:00 2001 From: noa Date: Wed, 3 Jan 2024 10:33:14 +0000 Subject: Move all commands into commands/ subdirectory --- boobs | 3 --- booktime | 21 --------------------- combination | 20 -------------------- commands/boobs | 3 +++ commands/booktime | 21 +++++++++++++++++++++ commands/combination | 20 ++++++++++++++++++++ commands/hug | 3 +++ commands/news | 3 +++ commands/wave | 9 +++++++++ commands/wotd | 15 +++++++++++++++ commands/y | 13 +++++++++++++ hug | 3 --- news | 3 --- wave | 9 --------- wotd | 15 --------------- y | 13 ------------- 16 files changed, 87 insertions(+), 87 deletions(-) delete mode 100755 boobs delete mode 100755 booktime delete mode 100755 combination create mode 100755 commands/boobs create mode 100755 commands/booktime create mode 100755 commands/combination create mode 100755 commands/hug create mode 100755 commands/news create mode 100755 commands/wave create mode 100755 commands/wotd create mode 100755 commands/y delete mode 100755 hug delete mode 100755 news delete mode 100755 wave delete mode 100755 wotd delete mode 100755 y diff --git a/boobs b/boobs deleted file mode 100755 index 4256d81..0000000 --- a/boobs +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/local/bin/lua - -print("nice") 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 - diff --git a/combination b/combination deleted file mode 100755 index 6b1556e..0000000 --- a/combination +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash - -eval set -- "$1" - -PIZZAHUT="${1^^}" -TACOBELL="${2^^}" - -N=$((1 + $RANDOM % 3)) - -case $N in - 1) - echo "I'M AT THE COMBINATON" "$PIZZAHUT" "AND" "$TACOBELL" - ;; - 2) - echo "WE'RE AT THE COMBINATON" "$PIZZAHUT" "AND" "$TACOBELL" - ;; - 3) - echo "WE AT THE COMBINATON" "$PIZZAHUT" "AND" "$TACOBELL" - ;; -esac diff --git a/commands/boobs b/commands/boobs new file mode 100755 index 0000000..4256d81 --- /dev/null +++ b/commands/boobs @@ -0,0 +1,3 @@ +#!/usr/local/bin/lua + +print("nice") diff --git a/commands/booktime b/commands/booktime new file mode 100755 index 0000000..9133210 --- /dev/null +++ b/commands/booktime @@ -0,0 +1,21 @@ +#!/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 + diff --git a/commands/combination b/commands/combination new file mode 100755 index 0000000..6b1556e --- /dev/null +++ b/commands/combination @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +eval set -- "$1" + +PIZZAHUT="${1^^}" +TACOBELL="${2^^}" + +N=$((1 + $RANDOM % 3)) + +case $N in + 1) + echo "I'M AT THE COMBINATON" "$PIZZAHUT" "AND" "$TACOBELL" + ;; + 2) + echo "WE'RE AT THE COMBINATON" "$PIZZAHUT" "AND" "$TACOBELL" + ;; + 3) + echo "WE AT THE COMBINATON" "$PIZZAHUT" "AND" "$TACOBELL" + ;; +esac diff --git a/commands/hug b/commands/hug new file mode 100755 index 0000000..a202f81 --- /dev/null +++ b/commands/hug @@ -0,0 +1,3 @@ +#!/usr/bin/env sh + +echo "*hugs* ${1}" diff --git a/commands/news b/commands/news new file mode 100755 index 0000000..287396a --- /dev/null +++ b/commands/news @@ -0,0 +1,3 @@ +#!/usr/bin/env sh + +echo no news is good news diff --git a/commands/wave b/commands/wave new file mode 100755 index 0000000..a78c49c --- /dev/null +++ b/commands/wave @@ -0,0 +1,9 @@ +#!/usr/local/bin/lua + +math.randomseed(os.time()) +local rand=math.random(2) +if rand == 1 then + print("o/") +else + print("\\o") +end diff --git a/commands/wotd b/commands/wotd new file mode 100755 index 0000000..933a021 --- /dev/null +++ b/commands/wotd @@ -0,0 +1,15 @@ +#!/usr/bin/env python3 + +from urllib.request import Request, urlopen +from bs4 import BeautifulSoup + +req = Request("https://www.oed.com/", headers={"User-Agent": "Mozilla/5.0"}) +soup = BeautifulSoup(urlopen(req), "html.parser") + +#wotd_div = soup.find('div', attrs={'class': 'wotd'}) +#wotd_word = word_div.find('a').get_text() +wotd_word = soup.find("div", attrs={"class": "wotd"}).h3.a.get_text() + + +print("The oxford english dictionary word of the day is " + wotd_word + "!") + diff --git a/commands/y b/commands/y new file mode 100755 index 0000000..db15c4b --- /dev/null +++ b/commands/y @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +N=$((1 + $RANDOM % 2)) + +case $N in + 1) + echo "y" + ;; + 2) + echo "HONK" + ;; +esac + diff --git a/hug b/hug deleted file mode 100755 index a202f81..0000000 --- a/hug +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env sh - -echo "*hugs* ${1}" diff --git a/news b/news deleted file mode 100755 index 287396a..0000000 --- a/news +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env sh - -echo no news is good news diff --git a/wave b/wave deleted file mode 100755 index a78c49c..0000000 --- a/wave +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/local/bin/lua - -math.randomseed(os.time()) -local rand=math.random(2) -if rand == 1 then - print("o/") -else - print("\\o") -end diff --git a/wotd b/wotd deleted file mode 100755 index 933a021..0000000 --- a/wotd +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env python3 - -from urllib.request import Request, urlopen -from bs4 import BeautifulSoup - -req = Request("https://www.oed.com/", headers={"User-Agent": "Mozilla/5.0"}) -soup = BeautifulSoup(urlopen(req), "html.parser") - -#wotd_div = soup.find('div', attrs={'class': 'wotd'}) -#wotd_word = word_div.find('a').get_text() -wotd_word = soup.find("div", attrs={"class": "wotd"}).h3.a.get_text() - - -print("The oxford english dictionary word of the day is " + wotd_word + "!") - diff --git a/y b/y deleted file mode 100755 index db15c4b..0000000 --- a/y +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash - -N=$((1 + $RANDOM % 2)) - -case $N in - 1) - echo "y" - ;; - 2) - echo "HONK" - ;; -esac - -- cgit 1.4.1-2-gfad0