diff options
author | Jesse Luehrs <doy@tozt.net> | 2021-07-10 16:00:59 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2021-07-10 16:00:59 -0400 |
commit | 5120b108ca2dcd78db519226516e071aca7b81d0 (patch) | |
tree | bd2d471d4e16b757b0dac2a7fc470b5caacfb5eb /bin | |
parent | 7946924e237e059bb1b8ca311824042f69396e66 (diff) | |
download | conf-5120b108ca2dcd78db519226516e071aca7b81d0.tar.gz conf-5120b108ca2dcd78db519226516e071aca7b81d0.zip |
shfmt everything
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/cryptdir | 2 | ||||
-rwxr-xr-x | bin/hornet/numkeys | 11 | ||||
-rwxr-xr-x | bin/hornet/sc | 30 | ||||
-rwxr-xr-x | bin/hornet/ssh | 2 | ||||
-rwxr-xr-x | bin/hornet/tv | 4 | ||||
-rwxr-xr-x | bin/hornet/twitch | 4 | ||||
-rwxr-xr-x | bin/hornet/update-weather | 2 | ||||
-rwxr-xr-x | bin/hornet/vscreen | 25 | ||||
-rwxr-xr-x | bin/hornet/watch-kbd | 2 | ||||
-rwxr-xr-x | bin/hostcert | 2 | ||||
-rwxr-xr-x | bin/scratch | 2 | ||||
-rwxr-xr-x | bin/show-colors | 2 | ||||
-rwxr-xr-x | bin/tozt/learn_spam | 14 | ||||
-rwxr-xr-x | bin/vimmanpager | 22 |
14 files changed, 63 insertions, 61 deletions
diff --git a/bin/cryptdir b/bin/cryptdir index 3fb858f..eb63300 100755 --- a/bin/cryptdir +++ b/bin/cryptdir @@ -19,7 +19,7 @@ cryptfile=$(mktemp) cryptdir=$(mktemp -d) pass=$(dd if=/dev/urandom bs=1 count=80 | base64) -cleanup () { +cleanup() { set +e cd sudo umount "$cryptdir" diff --git a/bin/hornet/numkeys b/bin/hornet/numkeys index 9d037f5..9b284bb 100755 --- a/bin/hornet/numkeys +++ b/bin/hornet/numkeys @@ -47,8 +47,11 @@ toggle() { } case "$1" in - on) on ;; - off) off ;; - toggle) toggle ;; - *) echo invalid 1>&2; exit 1 ;; +on) on ;; +off) off ;; +toggle) toggle ;; +*) + echo invalid 1>&2 + exit 1 + ;; esac diff --git a/bin/hornet/sc b/bin/hornet/sc index d86b917..614a1bc 100755 --- a/bin/hornet/sc +++ b/bin/hornet/sc @@ -1,19 +1,19 @@ #!/bin/sh case "$1" in - on) - xset s 300 5 - xset dpms 600 600 600 - ;; - off) - xset s off - xset dpms 0 0 0 - ;; - q) - xset q | perl -nlE'print if ((/^(:?Screen Saver|DPMS)/.../^[^\s]/) && /^(:?Screen Saver|DPMS|\s)/)' - ;; - *) - echo "$(basename "$0"): unknown argument '$1'" >&2 - exit 1 - ;; +on) + xset s 300 5 + xset dpms 600 600 600 + ;; +off) + xset s off + xset dpms 0 0 0 + ;; +q) + xset q | perl -nlE'print if ((/^(:?Screen Saver|DPMS)/.../^[^\s]/) && /^(:?Screen Saver|DPMS|\s)/)' + ;; +*) + echo "$(basename "$0"): unknown argument '$1'" >&2 + exit 1 + ;; esac diff --git a/bin/hornet/ssh b/bin/hornet/ssh index 65c2f53..bbacdf9 100755 --- a/bin/hornet/ssh +++ b/bin/hornet/ssh @@ -2,5 +2,5 @@ set -eu set -o pipefail -ssh-add -l | grep -q "${HOME}/.ssh/id_rsa" || env SSH_ASKPASS="ssh-askpass" ssh-add < /dev/null +ssh-add -l | grep -q "${HOME}/.ssh/id_rsa" || env SSH_ASKPASS="ssh-askpass" ssh-add </dev/null exec /usr/bin/"$(basename "$0")" "$@" diff --git a/bin/hornet/tv b/bin/hornet/tv index eea7fca..620cb1a 100755 --- a/bin/hornet/tv +++ b/bin/hornet/tv @@ -2,7 +2,7 @@ xrandr --auto if xrandr -q | grep -q "DP-3 connected"; then - xrandr --output DP-3 --right-of eDP-1 --mode 1920x1080 + xrandr --output DP-3 --right-of eDP-1 --mode 1920x1080 elif xrandr -q | grep -q "DP-4 connected"; then - xrandr --output DP-4 --right-of eDP-1 --mode 1920x1080 + xrandr --output DP-4 --right-of eDP-1 --mode 1920x1080 fi diff --git a/bin/hornet/twitch b/bin/hornet/twitch index 79473f2..5b691ab 100755 --- a/bin/hornet/twitch +++ b/bin/hornet/twitch @@ -2,8 +2,8 @@ if [ -z "${1}" ]; then ssh partofme killall vlc - echo '*/buffer close twitch.#' > ~/.weechat/weechat_fifo + echo '*/buffer close twitch.#' >~/.weechat/weechat_fifo else ssh partofme sh -c "'nohup twitch ${1} > /dev/null 2>&1 &'" - echo "irc.server.twitch */join #${1}" > ~/.weechat/weechat_fifo + echo "irc.server.twitch */join #${1}" >~/.weechat/weechat_fifo fi diff --git a/bin/hornet/update-weather b/bin/hornet/update-weather index 8105223..fad6ff7 100755 --- a/bin/hornet/update-weather +++ b/bin/hornet/update-weather @@ -2,5 +2,5 @@ set -eu set -o pipefail -weather > ~/.cache/weather.new +weather >~/.cache/weather.new mv ~/.cache/weather.new ~/.cache/weather diff --git a/bin/hornet/vscreen b/bin/hornet/vscreen index d39b389..52fc5cc 100755 --- a/bin/hornet/vscreen +++ b/bin/hornet/vscreen @@ -1,17 +1,16 @@ #!/bin/sh - case "$1" in - goto) - xrandr --addmode VIRTUAL1 1920x1080 - xrandr --output VIRTUAL1 --auto --output eDP1 --auto --left-of VIRTUAL1 - i3-switch-workspace virtual - ;; - off) - xrandr --output VIRTUAL1 --off - ;; - *) - echo "bad subcommand $1" >&2 - exit 1 - ;; +goto) + xrandr --addmode VIRTUAL1 1920x1080 + xrandr --output VIRTUAL1 --auto --output eDP1 --auto --left-of VIRTUAL1 + i3-switch-workspace virtual + ;; +off) + xrandr --output VIRTUAL1 --off + ;; +*) + echo "bad subcommand $1" >&2 + exit 1 + ;; esac diff --git a/bin/hornet/watch-kbd b/bin/hornet/watch-kbd index d5cd583..2516f6b 100755 --- a/bin/hornet/watch-kbd +++ b/bin/hornet/watch-kbd @@ -4,7 +4,7 @@ set -o pipefail trap 'kill $(jobs -p)' EXIT -inotifywait -mq -e create -e delete --exclude '.*tmp.*' /dev/input/by-id/ | \ +inotifywait -mq -e create -e delete --exclude '.*tmp.*' /dev/input/by-id/ | while read -r event; do echo "$event" if echo "$event" | grep -q USB_Keyboard; then diff --git a/bin/hostcert b/bin/hostcert index 545167a..61f519d 100755 --- a/bin/hostcert +++ b/bin/hostcert @@ -5,4 +5,4 @@ set -o pipefail host="$1" port="${2:-443}" -openssl s_client -connect "$host:$port" < /dev/null 2>/dev/null | perl -nle 'print if /BEGIN CERTIFICATE/../END CERTIFICATE/' | openssl x509 -text | perl -nle 'print unless /BEGIN CERTIFICATE/../END CERTIFICATE/' +openssl s_client -connect "$host:$port" </dev/null 2>/dev/null | perl -nle 'print if /BEGIN CERTIFICATE/../END CERTIFICATE/' | openssl x509 -text | perl -nle 'print unless /BEGIN CERTIFICATE/../END CERTIFICATE/' diff --git a/bin/scratch b/bin/scratch index 06bccb0..0cca01c 100755 --- a/bin/scratch +++ b/bin/scratch @@ -2,4 +2,4 @@ set -eu set -o pipefail -cat > /dev/null +cat >/dev/null diff --git a/bin/show-colors b/bin/show-colors index be1a489..47e0d32 100755 --- a/bin/show-colors +++ b/bin/show-colors @@ -7,7 +7,7 @@ set -o pipefail # Last change: Mon Feb 16 16:24:41 CET 2004 ############################################################ -for attr in 0 1 2 3 4 5 6 7 ; do +for attr in 0 1 2 3 4 5 6 7; do echo "----------------------------------------------------------------" printf 'ESC[%s;Foreground;Background - \n' $attr for fore in 30 31 32 33 34 35 36 37; do diff --git a/bin/tozt/learn_spam b/bin/tozt/learn_spam index 128ca9a..75e500a 100755 --- a/bin/tozt/learn_spam +++ b/bin/tozt/learn_spam @@ -17,21 +17,21 @@ fi if [ ! "$1" = "-q" ]; then echo "$(date): Learning ham..." fi -nice find $MAILDIR -type f | \ - perl -nl0e'chomp; ($ts) = /(\d{10})/; $now = time; print if m{/(new|cur)/} && !m{/(\.old|\.spam)/} && $ts > $now - 60*60*24*30' | \ - xargs -n1000 -0 $SALEARN "$OPTS" --ham > $OUTFILE +nice find $MAILDIR -type f | + perl -nl0e'chomp; ($ts) = /(\d{10})/; $now = time; print if m{/(new|cur)/} && !m{/(\.old|\.spam)/} && $ts > $now - 60*60*24*30' | + xargs -n1000 -0 $SALEARN "$OPTS" --ham >$OUTFILE if [ ! "$1" = "-q" ]; then echo "$(date): Learning spam..." fi -nice find $MAILDIR -type f | \ - perl -nl0e'chomp; ($ts) = /(\d{10})/; $now = time; print if m{/(new|cur)/} && m{/\.spam/} && $ts > $now - 60*60*24*30' | \ - xargs -n1000 -0 $SALEARN "$OPTS" --spam > $OUTFILE +nice find $MAILDIR -type f | + perl -nl0e'chomp; ($ts) = /(\d{10})/; $now = time; print if m{/(new|cur)/} && m{/\.spam/} && $ts > $now - 60*60*24*30' | + xargs -n1000 -0 $SALEARN "$OPTS" --spam >$OUTFILE if [ ! "$1" = "-q" ]; then echo "$(date): Syncing..." fi -nice $SALEARN --sync > $OUTFILE +nice $SALEARN --sync >$OUTFILE if [ ! "$1" = "-q" ]; then echo "$(date): Done!" diff --git a/bin/vimmanpager b/bin/vimmanpager index d33e4f9..dfd36f3 100755 --- a/bin/vimmanpager +++ b/bin/vimmanpager @@ -2,14 +2,14 @@ set -eu set -o pipefail -sed -e 's/\x1B\[[[:digit:]]\+m//g' | col -b | \ - vim \ - -c 'let no_plugin_maps = 1' \ - -c 'let g:rainbow_active = 0' \ - -c 'let g:airline#extensions#whitespace#checks = []' \ - -c "if exists('\$MAN_PN') | file \$MAN_PN | endif" \ - -c 'setlocal nolist nomod noswf ft=man' \ - -c 'runtime! macros/less.vim' \ - -c 'set ma' \ - -c 'setlocal noma' \ - - +sed -e 's/\x1B\[[[:digit:]]\+m//g' | col -b | + vim \ + -c 'let no_plugin_maps = 1' \ + -c 'let g:rainbow_active = 0' \ + -c 'let g:airline#extensions#whitespace#checks = []' \ + -c "if exists('\$MAN_PN') | file \$MAN_PN | endif" \ + -c 'setlocal nolist nomod noswf ft=man' \ + -c 'runtime! macros/less.vim' \ + -c 'set ma' \ + -c 'setlocal noma' \ + - |