summaryrefslogtreecommitdiff
path: root/bin/extra
diff options
context:
space:
mode:
Diffstat (limited to 'bin/extra')
-rwxr-xr-xbin/extra/aivpn15
-rwxr-xr-xbin/extra/curszip17
-rwxr-xr-xbin/extra/dbnewg11
-rwxr-xr-xbin/extra/ehbtodl14
-rwxr-xr-xbin/extra/gml70
-rwxr-xr-xbin/extra/pomo31
-rwxr-xr-xbin/extra/supd38
7 files changed, 177 insertions, 19 deletions
diff --git a/bin/extra/aivpn b/bin/extra/aivpn
index 55e013a..fd72ffb 100755
--- a/bin/extra/aivpn
+++ b/bin/extra/aivpn
@@ -4,7 +4,7 @@ logn() { printf "%s\n" "$@"; }
if [ "$1" = "-k" ]
then
- pgrep -f -- "ssh.*-L.*mc-wd" |
+ pgrep -f -- "ssh.*-L.*vm" |
xargs kill
exit
fi
@@ -21,16 +21,21 @@ keyadd ehb/ai
export SSH_ASKPASS="$0"
export SSH_ASKPASS_REQUIRE="prefer"
-export PASSWORD=aluc
+export PASSWORD=zot/qemu
+
+logn "I: Waiting for connectivity..."
+while ! ssh -o ConnectTimeout=1 -o BatchMode=yes vm 2>&1 | grep -q "Permission denied"
+do sleep 1
+done
logn "I: Activating vpn"
-# ssh mc-wd "rasdial \"vpn.student.ehb.be\" \"luca.raymaekers@student.ehb.be\" \"$(pass school/login.ehb.be)\""
+ssh vm "rasdial \"vpn.student.ehb.be\""
ssh -f -N \
-L 2222:10.2.160.41:22 \
- mc-wd
+ vm
ssh -t \
-L 8188:localhost:8188 \
- mc-wd \
+ vm \
ssh -N -L 8188:localhost:8188 luca@10.2.160.41
logn "[8188], [2222]"
diff --git a/bin/extra/curszip b/bin/extra/curszip
new file mode 100755
index 0000000..6ab99e8
--- /dev/null
+++ b/bin/extra/curszip
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+list1() { find "$1" -mindepth 1 -maxdepth 1 -type "${2:-d}" -printf '%f\n'; }
+
+curs="$(list1 ~/docs/school/Vakken | fzf)"
+[ "$curs" ] || exit 1
+zip="$(list1 ~/dl f | fzf -f "$curs" | grep '\.zip$')"
+[ "$zip" ] || exit 1
+
+>&2 printf "zip: %s\n" "$zip"
+
+cd -- ~/docs/school/Vakken/"$curs" || exit 1
+rm -rf Cursus
+mv -- ~/dl/"$zip" .
+unzip -- "./$zip"
+mv -- "${zip%%.zip}" Cursus
+rm -- "$zip"
diff --git a/bin/extra/dbnewg b/bin/extra/dbnewg
new file mode 100755
index 0000000..a8c4bcf
--- /dev/null
+++ b/bin/extra/dbnewg
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+die () { >&2 printf '%s\n' "$@"; exit 1; }
+
+[ "$1" ] || die "usage: dbnewg <dir>"
+proj="$(basename "$(readlink -f "$1")")"
+
+ssh git@db '$HOME/initdir.sh' "$proj"
+cd "$1" || exit 1
+git remote add origin git@db:"$proj"
+git push --set-upstream origin main
diff --git a/bin/extra/ehbtodl b/bin/extra/ehbtodl
index df11797..fc873f6 100755
--- a/bin/extra/ehbtodl
+++ b/bin/extra/ehbtodl
@@ -1,9 +1,13 @@
#!/usr/bin/env sh
-echo "$1" | sed 's/-H/\\\n\t&/g' | sed '/gzip/d' > /tmp/curlcommand.sh
-sh /tmp/curlcommand.sh > /tmp/ehbso.html
-vids="$(grep -oE "youtube\.com/embed/.{11}" /tmp/ehbso.html | cut -d'/' -f 3 | tr '\n' ' ')"
+printf "%s\n" "$1" |
+ sed 's/-H/\\\n&/g' |
+ sed '/gzip/d' |
+ tee /tmp/curlcommand.sh |
+ sh > /tmp/ehbso.html
+vids="$(grep -oE "youtube\.com/embed/.{11}" /tmp/ehbso.html |
+ cut -d'/' -f 3 |
+ tr '\n' ' ')"
for i in $vids
-do
- echo "https://www.youtube.com/watch?v=$i"
+do printf "%s\n" "https://www.youtube.com/watch?v=$i"
done > /tmp/todownload
# yt-dlp -P "$HOME/Downloads/vids" -o "%(title)s" -a /tmp/todownload
diff --git a/bin/extra/gml b/bin/extra/gml
new file mode 100755
index 0000000..0f2f143
--- /dev/null
+++ b/bin/extra/gml
@@ -0,0 +1,70 @@
+#!/bin/sh
+
+minecraft()
+{
+ instance="$(
+ (
+ printf "default\n"
+ find ~/.local/share/multimc/instances \
+ -maxdepth 1 -mindepth 1 \
+ -type d \
+ -printf "%f\n" |
+ grep -v '_LAUNCHER_TEMP'
+ ) |
+ commander -d -c -x)"
+
+ [ "$instance" ] || exit 1
+ [ "$instance" = "default" ] && instance="1.20.1"
+
+ ips="none 192.168.178.79 192.168.178.52 10.7.0.1 mc.hypixel.net"
+ ip="$(for ip in $ips
+ do printf "%s\n" "$ip"
+ done | commander -d -c)"
+
+ if [ "$ip" != 'none' ]
+ then setsid multimc -l "$instance" -s "$ip" > /dev/null 2>&1
+ else
+
+ world="$(
+ (
+ printf "none\n"
+ find "$HOME"/.local/share/multimc/instances/"$instance"/.minecraft/saves/ \
+ -mindepth 1 -maxdepth 1 \
+ -type d \
+ -printf "%f\n"
+ ) | commander -d -c -s)"
+
+ [ -z "$world" ] && exit 1
+
+ if [ "$world" = 'none' ]
+ then setsid multimc -l "$instance" > /dev/null 2>&1
+ else setsid multimc -l "$instance" -w "$world" > /dev/null 2>&1
+ fi
+
+ fi
+}
+
+steam()
+{
+ choice="$(
+ cat <<-EOF | column -t -l 2 | commander -d -x -c | awk '{printf $1}'
+ 274190 broforce
+ 291550 brawlhalla
+ 1712840 tiny tina
+ 105600 terraria
+ kill
+EOF
+ )"
+ case "$choice" in
+ kill) pkill steam ;;
+ *) setsid steam steam://rungameid/"$choice" ;;
+ esac
+ exit
+}
+
+eval "$(
+ cat <<-EOF | commander -c -w 9 -y 2
+ minecraft
+ steam
+ EOF
+)"
diff --git a/bin/extra/pomo b/bin/extra/pomo
new file mode 100755
index 0000000..a2c371d
--- /dev/null
+++ b/bin/extra/pomo
@@ -0,0 +1,31 @@
+#!/bin/sh
+notif() { notify-send -t 1000 -w "pomo" "$1"; }
+
+for msg in "three" "two" "one"
+do notif "$msg"
+done
+
+# $1: time in minutes
+# $2: msg for notification
+ring_ring()
+{
+ date '+%R B'
+ notify-send -w "$(($1*1000*60))" -u critical "pomo" "$2"
+}
+
+i="${1-0}"
+while true
+
+do
+ notif "<b>START</b>"
+ date '+%R S'
+ sleep 20m
+ if [ "$i" -eq 3 ]
+ then
+ i=0
+ ring_ring 20 "GIGA BREAK TIME"
+ else
+ ring_ring 5 "BREAK TIME"
+ i=$((i+1))
+ fi
+done
diff --git a/bin/extra/supd b/bin/extra/supd
index 931d808..4975b94 100755
--- a/bin/extra/supd
+++ b/bin/extra/supd
@@ -1,24 +1,44 @@
#!/bin/sh
-print_dir () { printf '%s: ' "$1" | sed "s#$HOME#~#" >&2; }
+usage() {
+ >&2 cat <<-EOF
+ usage: supd
+ supd <prefix> <dir>
+ stdout | supd <prefix>
+ EOF
+ exit 1
+}
check ()
{
for dir in $1
do
- print_dir "$2/$dir"
+ printf '%s: ' "$2/$dir" | sed "s#$HOME#~#" >&2
cd "$2/$dir" || continue
git pull > /dev/null 2>&1 &&
printf 'Up to date.' ||
printf 'Couldn'\''t update.'
- printf '\n'
+ printf ' '
+ printf '%s %s\n' "$(git status --short 2> /dev/null |
+ awk 'NR==1 {print $1}')" "$(git branch -v 2>/dev/null |
+ grep '^\*' | cut -f2 -d'[' | cut -f1 -d' ' |
+ sed 's/ahead/↑/;s/behind/↓/;s/\*//')"
+
done
}
-dirs="installdrier dotfiles password-store"
-prefix="$HOME/src"
+if [ "$#" -eq 0 ]
+then
+ dirs="installdrier dotfiles password-store"
+ prefix="$HOME/src"
+elif [ ! -t 0 ]
+then
+ prefix="$1"
+ dirs="$(cat)"
+else
+ prefix="$1"
+ shift || usage
+ dirs="$*"
+ [ "$dirs" ] || usage
+fi
check "$dirs" "$prefix"
-
-# dirs="$(ls -1 "$HOME/proj/personal")"
-# prefix="$HOME/proj/personal"
-# check "$dirs" "$prefix"