scripts

random scripts
git clone git://parazyd.org/scripts.git
Log | Files | Refs

commit 1ee8c4a1d369f939220e027476c5ff79433e3038
parent 8876e7a9c246048415eb7c4025150728579c59f5
Author: parazyd <parazyd@dyne.org>
Date:   Wed, 15 Feb 2017 12:57:29 +0100

cleanups; optimizations; features

Diffstat:
Acatfact | 3+++
Mextmon | 3++-
Mminimpc | 12++++++------
Rcuesplit.sh -> notinpath/cuesplit.sh | 0
Rfbits -> notinpath/fbits | 0
Rinterjection.sh -> notinpath/interjection.sh | 0
Raddrepo.sh -> obsolete/addrepo.sh | 0
Rblink.sh -> obsolete/blink.sh | 0
Rcatfact.py -> obsolete/catfact.py | 0
Rdisco -> obsolete/disco | 0
Rmycosmos -> obsolete/mycosmos | 0
Rpio -> obsolete/pio | 0
Rpowertoptune.sh -> obsolete/powertoptune.sh | 0
Rsignrelease -> obsolete/signrelease | 0
Rweepop.sh -> obsolete/weepop.sh | 0
Rxkcd.py -> obsolete/xkcd.py | 0
Msslget | 15++++++++++++++-
Mtouchpad-toggle | 2+-
Axkcd | 6++++++
19 files changed, 32 insertions(+), 9 deletions(-)

diff --git a/catfact b/catfact @@ -0,0 +1,3 @@ +#!/bin/sh + +curl -s http://catfacts-api.appspot.com/api/facts | jq -r '.facts[]' diff --git a/extmon b/extmon @@ -3,7 +3,7 @@ # parazyd - (c) wtfpl 2016 # skreenz -IN="LVDS1" + IN="${IN:-LVDS1}" EXT="${EXT:-VGA1}" @@ -30,5 +30,6 @@ case "$1" in ;; *) printf "%s {left|right|above|dup|off|list}\\n" "$(basename $0)" + printf "overridable env vars: IN, EXT\\n" ;; esac diff --git a/minimpc b/minimpc @@ -14,30 +14,30 @@ fi toggle() { playing() { - echo status | nc $NCARGS $MPDHOST | grep "^state: play$" + echo status | busybox nc $NCARGS $MPDHOST | grep "^state: play$" } play() { - echo play | nc $NCARGS $MPDHOST > /dev/null + echo play | busybox nc $NCARGS $MPDHOST > /dev/null } pause() { - echo pause | nc $NCARGS $MPDHOST > /dev/null + echo pause | busybox nc $NCARGS $MPDHOST > /dev/null } test -z "$(playing)" && play || pause } next() { - echo next | nc $NCARGS $MPDHOST $MPDPORT > /dev/null + echo next | busybox nc $NCARGS $MPDHOST $MPDPORT > /dev/null } prev() { - echo prev | nc $NCARGS $MPDHOST $MPDPORT > /dev/null + echo prev | busybox nc $NCARGS $MPDHOST $MPDPORT > /dev/null } stop() { - echo stop | nc $NCARGS $MPDHOST $MPDPORT > /dev/null + echo stop | busybox nc $NCARGS $MPDHOST $MPDPORT > /dev/null } case "$1" in diff --git a/cuesplit.sh b/notinpath/cuesplit.sh diff --git a/fbits b/notinpath/fbits diff --git a/interjection.sh b/notinpath/interjection.sh diff --git a/addrepo.sh b/obsolete/addrepo.sh diff --git a/blink.sh b/obsolete/blink.sh diff --git a/catfact.py b/obsolete/catfact.py diff --git a/disco b/obsolete/disco diff --git a/mycosmos b/obsolete/mycosmos diff --git a/pio b/obsolete/pio diff --git a/powertoptune.sh b/obsolete/powertoptune.sh diff --git a/signrelease b/obsolete/signrelease diff --git a/weepop.sh b/obsolete/weepop.sh diff --git a/xkcd.py b/obsolete/xkcd.py diff --git a/sslget b/sslget @@ -4,4 +4,17 @@ # it assumes 443 to be the default SSL port portnum=${2-443} -echo | openssl s_client -connect $1:$portnum 2>&1| sed '/BEGIN CERT/,/END CERT/p;d' +cert="$(echo | openssl s_client -connect $1:$portnum 2>&1 | sed '/BEGIN CERT/,/END CERT/p;d')" + +shift + +printf "%s\n" "$cert" + +case "$2" in + -fpr*) + printf "\n" + printf "%s\n" "$cert" | openssl x509 -noout -fingerprint -sha256 + printf "%s\n" "$cert" | openssl x509 -noout -fingerprint -sha1 + printf "%s\n" "$cert" | openssl x509 -noout -fingerprint -md5 + ;; +esac diff --git a/touchpad-toggle b/touchpad-toggle @@ -1,6 +1,6 @@ #!/bin/sh -if [ $(synclient -l | grep TouchpadOff | gawk -F '= ' '{ print $2 }') -eq 0 ]; +if [ $(synclient -l | grep TouchpadOff | mawk -F '= ' '{ print $2 }') -eq 0 ]; then synclient TouchpadOff=1 else diff --git a/xkcd b/xkcd @@ -0,0 +1,6 @@ +#!/bin/sh + +tot="$(curl -s https://xkcd.com/info.0.json | jq '.num')" +rnd="$(shuf -i 1-${tot} -n 1)" + +curl -s https://xkcd.com/$rnd/info.0.json | jq '.img' | xargs feh