summaryrefslogtreecommitdiff
path: root/bin/extra
diff options
context:
space:
mode:
Diffstat (limited to 'bin/extra')
-rwxr-xr-xbin/extra/aivpn6
-rwxr-xr-xbin/extra/append2mpv30
-rwxr-xr-xbin/extra/cht.sh2
-rwxr-xr-xbin/extra/sgimg6
-rwxr-xr-xbin/extra/supd22
5 files changed, 51 insertions, 15 deletions
diff --git a/bin/extra/aivpn b/bin/extra/aivpn
index fd72ffb..3c87ce8 100755
--- a/bin/extra/aivpn
+++ b/bin/extra/aivpn
@@ -33,9 +33,3 @@ ssh vm "rasdial \"vpn.student.ehb.be\""
ssh -f -N \
-L 2222:10.2.160.41:22 \
vm
-
-ssh -t \
- -L 8188:localhost:8188 \
- vm \
- ssh -N -L 8188:localhost:8188 luca@10.2.160.41
-logn "[8188], [2222]"
diff --git a/bin/extra/append2mpv b/bin/extra/append2mpv
new file mode 100755
index 0000000..28c3916
--- /dev/null
+++ b/bin/extra/append2mpv
@@ -0,0 +1,30 @@
+#!/bin/sh
+IPC="/tmp/mpvsocket"
+
+die () { >&2 printf '%s\n' "$@"; exit 1; }
+append_to_mpv()
+{
+ file="$(readlink -f "$1")"
+ if [ ! -r "$file" ]
+ then
+ >&2 printf '%s\n' "'$file' not found"
+ return
+ fi
+
+ echo '{ "command": ["loadfile", "'"$file"'", "append"] }' |
+ socat - "$IPC"
+}
+
+[ -S "$IPC" ] || die "$IPC is not a socket or doesn't exist"
+which socat > /dev/null || exit 1
+
+
+if [ -t 0 ]
+then
+ append_to_mpv "$1"
+else
+ while read -r file
+ do
+ append_to_mpv "$file"
+ done
+fi
diff --git a/bin/extra/cht.sh b/bin/extra/cht.sh
index 681fc69..f373e55 100755
--- a/bin/extra/cht.sh
+++ b/bin/extra/cht.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
# shellcheck disable=SC1117,SC2001
#
# [X] open section
diff --git a/bin/extra/sgimg b/bin/extra/sgimg
new file mode 100755
index 0000000..7c1823c
--- /dev/null
+++ b/bin/extra/sgimg
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+imv "$(find ~/.local/share/gurk/ -type f -printf "%A@\t%p\n" |
+ sort -n |
+ tail -n 1 |
+ cut -f 2-)"
diff --git a/bin/extra/supd b/bin/extra/supd
index 48638bd..9a5ce0c 100755
--- a/bin/extra/supd
+++ b/bin/extra/supd
@@ -7,7 +7,7 @@ then
>&2 cat <<-EOF
usage:
supd Update dirs in current dir
- ls ~/projects | supd Update dirs read from stdin
+ ... | supd Update dirs read from stdin
supd -h Show help
EOF
exit
@@ -17,16 +17,22 @@ fi
for dir in $dirs
do
- printf '%s:' "$dir" | >&2 sed "s#$HOME#~#"
(
cd "$dir" || return
+ # is git dir
+ if ! git rev-parse > /dev/null 2>&1
+ then
+ printf 'x\n'
+ exit
+ fi
+ printf '%s: ' "$dir" | >&2 sed "s#$HOME#~#"
git "${1:-fetch}" > /dev/null 2>&1 &&
- printf ' o' ||
- printf ' x'
+ printf 'o' ||
+ printf 'x'
# Show remote state
- printf '%s %s\n' "$(git status --short 2> /dev/null |
- awk 'NR==1 {print $1}')" "$(git branch -v 2>/dev/null |
- awk -F '[][]' '/^\*/ {print $2}')" |
- sed 's/ahead/↑ /;s/behind/↓ /;s/[^↓↑]*/ /g'
+ printf ' %s%s\n' "$(git status --short 2> /dev/null |
+ awk 'NR==1 {print "(" $1 ")"}')" "$(git branch -v 2>/dev/null |
+ awk -F '[][]' '/^\*/ {print $2}' |
+ sed 's/ahead/↑ /;s/behind/↓ /;s/[^↓↑]*//g')"
)
done