summary refs log tree commit diff
path: root/commands
diff options
context:
space:
mode:
authornoa2024-01-03 10:33:14 +0000
committernoa2024-01-03 10:33:14 +0000
commitbf0cf3862464b741fac3044c7898c1aeb9e9cd62 (patch)
tree9c03ce5fd45cb87b15ed2743a795234f65bf0f74 /commands
parentc6dcab9d7ead82b6cf7d985c3fa46527dcccc7b2 (diff)
Move all commands into commands/ subdirectory
Diffstat (limited to 'commands')
-rwxr-xr-xcommands/boobs3
-rwxr-xr-xcommands/booktime21
-rwxr-xr-xcommands/combination20
-rwxr-xr-xcommands/hug3
-rwxr-xr-xcommands/news3
-rwxr-xr-xcommands/wave9
-rwxr-xr-xcommands/wotd15
-rwxr-xr-xcommands/y13
8 files changed, 87 insertions, 0 deletions
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
+