diff options
Diffstat (limited to 'noise/modules')
-rwxr-xr-x | noise/modules/ein_mal_eins | 2 | ||||
-rwxr-xr-x | noise/modules/help | 6 | ||||
-rwxr-xr-x | noise/modules/mpc | 2 | ||||
-rwxr-xr-x | noise/modules/overlord | 14 | ||||
-rwxr-xr-x | noise/modules/play | 6 | ||||
-rwxr-xr-x | noise/modules/temp | 42 |
6 files changed, 40 insertions, 32 deletions
diff --git a/noise/modules/ein_mal_eins b/noise/modules/ein_mal_eins index fb385b31..e21612a5 100755 --- a/noise/modules/ein_mal_eins +++ b/noise/modules/ein_mal_eins @@ -1,7 +1,7 @@ #! /bin/bash R() { - echo "`od -t d -N 1 /dev/urandom | sed -rn '1s/^[0-9]+ +//p'` % $@" | bc + echo "`od -t d -N 1 /dev/urandom | sed -n '1s/^[0-9]\+ \+//p'` % $@" | bc } diff --git a/noise/modules/help b/noise/modules/help index bc4c2931..0763f3a0 100755 --- a/noise/modules/help +++ b/noise/modules/help @@ -7,10 +7,10 @@ case "$1" in done 2>/dev/null done ## print all documented built-in commands - sed -rn 's:^noise_([a-z]+)\(\) \{ # (.+)?$:\1 \2:p' "$NOISE" - } | sort | uniq | sed -rn ' + sed -n 's:^noise_\([a-z]\+\)() { # \(.\+\)\?$:\1 \2:p' "$NOISE" + } | sort | uniq | sed -n ' $s/$/[m/ - s:^([a-z]+) (.+):[35mtype [32m/\1[35m to \2:p' ;; + s:^\([a-z]\+\) \(.\+\):[35mtype [32m/\1[35m to \2:p' ;; (*) ## call for directory in `echo "$NOISE_PATH" | tr : \ ` ; do diff --git a/noise/modules/mpc b/noise/modules/mpc index 0ab72058..20abf19b 100755 --- a/noise/modules/mpc +++ b/noise/modules/mpc @@ -10,5 +10,5 @@ case "$1" in ##echo test-module called with following arguments: "$@" ## send command for re-evaluation: ##echo /espeak test >$NOISE_linefeed - MPD_HOST=mpd.shack mpc $@ + MPD_HOST=filebitch.shack mpc $@ esac diff --git a/noise/modules/overlord b/noise/modules/overlord new file mode 100755 index 00000000..ded8627a --- /dev/null +++ b/noise/modules/overlord @@ -0,0 +1,14 @@ +#! /bin/sh +set -euf + +# cd // +cd $(dirname $(readlink -f $0))/../.. + +case "${1---help}" in + --help) + echo "Make an announcement! Usage: /overlord <text>" + ;; + *) + exec god/overlord/index "$@" + ;; +esac diff --git a/noise/modules/play b/noise/modules/play index 749b450a..180c1e0c 100755 --- a/noise/modules/play +++ b/noise/modules/play @@ -7,8 +7,8 @@ case "$1" in ffs='wav mp3 ogg asf flac' if test -z "$*" ; then - ls $HOME/noise/samples | sed -r ' - s:\.('"`echo "$ffs" | tr \ \|`"')$: [30m\1[m: + ls $HOME/noise/samples | sed ' + s:\.\('"`echo "$ffs" | tr \ \|`"'\)$: [30m\1[m: s:^:/play : s:.*:[32m&[m: ' @@ -28,7 +28,7 @@ Keine Audiodatei mit dem Namen gefunden... am besten gleich uploaden: - scp NAME shack@shack.shack:noise/samples/ + scp NAME shack@shack.shack:$HOME/noise/samples/ folgende Dateiendungen werden erkannt: $ffs[m EOF diff --git a/noise/modules/temp b/noise/modules/temp index 2f1dfcef..a11c3720 100755 --- a/noise/modules/temp +++ b/noise/modules/temp @@ -1,33 +1,32 @@ #! /bin/bash +temper=/krebs/temper/temper + main() { - case "$1" in + case "${1--K}" in (--help) echo "report temperature in K, °C, °R, or °F." + exit ;; - (-C|--celsius) - espeak_inside `inside_temp 'x - 273.15'` Grad Zelsius - espeak_outside `outside_temp 'x - 273.15'` Grad Zelsius - ;; - (-F|--fahrenheit) - espeak_inside `inside_temp 'x * 9/5 - 459.67'` Grad Fahrenheit - espeak_outside `outside_temp 'x * 9/5 - 459.67'` Grad Fahrenheit - ;; - (-R|--rankine) - espeak_inside `inside_temp 'x * 9/5'` Grad Renkin - espeak_outside `outside_temp 'x * 9/5'` Grad Renkin - ;; - (-K|--kelvin|*) - espeak_inside `inside_temp` Kelvin - espeak_outside `outside_temp` Kelvin + (-C|--celsius) unit='Grad Zelsius' ; formula='x - 273.15' ;; + (-F|--fahrenheit) unit='Grad Fahrenheit'; formula='x * 9/5 - 459.67' ;; + (-R|--rankine) unit='Grad Renkin' ; formula='x * 9/5' ;; + (-K|--kelvin) unit='Kelvin' ; formula='x' ;; + (*) + echo 'Error 1: you are made of stupid!' + exit 23 ;; esac + if test -f $temper -a -x $temper; then + espeak_inside `inside_temp "$formula"` $unit + fi + espeak_outside `outside_temp "$formula"` $unit } ## temp [<formula with temperature as x>] ## Echo temperature in K. If formula is given then return that result instead. inside_temp() { - echo "scale=2; x=`/krebs/temper/temper` + 273.15; ${1-x}" | bc + echo "scale=2; x=`$temper` + 273.15; ${1-x}" | bc } outside_temp() { @@ -36,13 +35,8 @@ outside_temp() { ` + 273.15; ${1-x}" | bc } -espeak_inside() { - echo Die Krebs-tempera-tur beträgt $@ | to_espeak -} - -espeak_outside() { - echo Die Außen-tempera-tur beträgt $@ | to_espeak -} +espeak_inside() { echo Die Krebs-tempera-tur beträgt $@ | to_espeak; } +espeak_outside() { echo Die Außen-tempera-tur beträgt $@ | to_espeak; } to_espeak() { sed ' |