From 92ab76da4f84070e0da74ba7bc91b19941fad3c6 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 25 Aug 2011 21:50:14 +0200 Subject: Workz now --- god/licht | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 god/licht (limited to 'god/licht') diff --git a/god/licht b/god/licht new file mode 100755 index 00000000..2b05b9f3 --- /dev/null +++ b/god/licht @@ -0,0 +1,15 @@ +#!/bin/bash +LAMPE=`echo $1 | sed -n '/^[1-2]*[0-9]*[0-9]$/p' | xargs echo "obase=16;" | bc` +TOGGLE=`echo $2 | sed -n '/^[0-1]$/p'` +if ! [ "$LAMPE" -a "$TOGGLE" ];then + echo "you are made of stupid" + exit 1 +fi +STRING="\xA5\x5A\x$LAMPE\x$TOGGLE" +if [ $# != 2 ] +then + echo -ne "Usage: licht <0/1>" +else + echo "$LAMPE$TOGGLE" + echo -ne "$STRING" | nc -u -w1 licht.shack 1337 +fi -- cgit v1.2.3 From 27253e631bc6730278234ae3b2b3ba4aff87be49 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 25 Aug 2011 22:32:13 +0200 Subject: Added help --- god/licht | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) (limited to 'god/licht') diff --git a/god/licht b/god/licht index 2b05b9f3..8ece3510 100755 --- a/god/licht +++ b/god/licht @@ -1,15 +1,20 @@ #!/bin/bash -LAMPE=`echo $1 | sed -n '/^[1-2]*[0-9]*[0-9]$/p' | xargs echo "obase=16;" | bc` -TOGGLE=`echo $2 | sed -n '/^[0-1]$/p'` -if ! [ "$LAMPE" -a "$TOGGLE" ];then - echo "you are made of stupid" - exit 1 -fi -STRING="\xA5\x5A\x$LAMPE\x$TOGGLE" -if [ $# != 2 ] -then - echo -ne "Usage: licht <0/1>" -else - echo "$LAMPE$TOGGLE" - echo -ne "$STRING" | nc -u -w1 licht.shack 1337 -fi +case "$1" in + (--help) echo "Toggle the lights";; + (*) + LAMPE=`echo $1 | sed -n '/^[1-2]*[0-9]*[0-9]$/p' | xargs echo "obase=16;" | bc` + TOGGLE=`echo $2 | sed -n '/^[0-1]/p'` + if ! [ "$LAMPE" -a "$TOGGLE" ];then + echo "you are made of stupid" + exit 1 + fi + STRING="\xA5\x5A\x$LAMPE\x$TOGGLE" + if [ $# != 2 ] + then + echo -ne "Usage: licht <0/1>" + else + echo "Toggle light $LAMPE ($TOGGLE)" + echo -ne "$STRING" | nc -u -w1 licht.shack 1337 + fi + ;; +esac -- cgit v1.2.3 From 91d8afe4298e931ec1b59bd4bb7969e5889e67d5 Mon Sep 17 00:00:00 2001 From: Momo Date: Sun, 4 Sep 2011 20:14:48 +0200 Subject: adding lightzones and all --- god/licht | 101 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 92 insertions(+), 9 deletions(-) (limited to 'god/licht') diff --git a/god/licht b/god/licht index 8ece3510..f9fc8f69 100755 --- a/god/licht +++ b/god/licht @@ -1,20 +1,103 @@ #!/bin/bash -case "$1" in - (--help) echo "Toggle the lights";; - (*) - LAMPE=`echo $1 | sed -n '/^[1-2]*[0-9]*[0-9]$/p' | xargs echo "obase=16;" | bc` - TOGGLE=`echo $2 | sed -n '/^[0-1]/p'` +toggle() { + LAMPE=`echo "$1" | sed -n '/^[1-2]*[0-9]*[0-9]$/p' | xargs echo "obase=16;" | bc` + TOGGLE=`echo "$2" | sed -n '/^[0-1]/p'` if ! [ "$LAMPE" -a "$TOGGLE" ];then echo "you are made of stupid" exit 1 fi - STRING="\xA5\x5A\x$LAMPE\x$TOGGLE" + STRING="\\xA5\\x5A\\x$LAMPE\\x$TOGGLE" if [ $# != 2 ] then - echo -ne "Usage: licht <0/1>" + echo "Usage: licht <0/1>" else echo "Toggle light $LAMPE ($TOGGLE)" - echo -ne "$STRING" | nc -u -w1 licht.shack 1337 + printf "$STRING" | nc -u -w1 licht.shack 1337 fi - ;; +} + +toggle_all() { + for i in `seq 0 7` + do + printf "\\xA5\\x5A\\x$i\\x$TOGGLE" | nc -u -w1 licht.shack 1337 & + done + wait +} + +kuschel(){ + for i in 0 2 + do + printf "\\xA5\\x5A\\x$i\\x$TOGGLE" | nc -u -w1 licht.shack 1337 & + done + wait +} + +software(){ + for i in 1 3 + do + printf "\\xA5\\x5A\\x$i\\x$TOGGLE" | nc -u -w1 licht.shack 1337 & + done + wait +} + +tische(){ + for i in 4 6 + do + printf "\\xA5\\x5A\\x$i\\x$TOGGLE" | nc -u -w1 licht.shack 1337 & + done + wait +} + +ghetto(){ + printf "\\xA5\\x5A\\x7\\x$TOGGLE" | nc -u -w1 licht.shack 1337 +} + +porsche(){ + printf "\\xA5\\x5A\\x5\\x$TOGGLE" | nc -u -w1 licht.shack 1337 +} + +case "$1" in + --help) + echo "Toggle the lights" + echo "Usage: lich <0/1>" + ;; + all) + TOGGLE=$2 + toggle_all + ;; + kuschel) + TOGGLE=$2 + kuschel + ;; + software) + TOGGLE=$2 + software + ;; + links) + TOGGLE=$2 + kuschel + software + ;; + rechts) + TOGGLE=$2 + tische + porsche + ghetto + ;; + tische) + TOGGLE=$2 + tische + ;; + porsche) + TOGGLE=$2 + porsche + ;; + ghetto) + TOGGLE=$2 + ghetto + ;; + *) + toggle "$@" + ;; esac + -- cgit v1.2.3 From 761db6a8b30f254b5349395c939111dedd8cf16b Mon Sep 17 00:00:00 2001 From: Momo Date: Sun, 4 Sep 2011 20:30:12 +0200 Subject: adding documentation --- god/licht | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'god/licht') diff --git a/god/licht b/god/licht index f9fc8f69..cbff9ad0 100755 --- a/god/licht +++ b/god/licht @@ -1,4 +1,18 @@ #!/bin/bash +# +#SYNOPSIS +# //god/licht [options] [0/1] +#OPTIONS +# all - toggles all lights +# links - toggles all lights on the left hand side while looking towards the Auditorium +# rechts - toggles all lights on the right hand side while looking towards the Auditorium +# kuschel - toggles the lights in the pwnie corner +# software - toggles the software corner +# tische - toggles the lights on the window side of the long table +# porsche - toggles the lights on the window side where the porsche cockpit is +# ghetto - toggles the lights in the hallway +# 0-7 - toggles individual lights + toggle() { LAMPE=`echo "$1" | sed -n '/^[1-2]*[0-9]*[0-9]$/p' | xargs echo "obase=16;" | bc` TOGGLE=`echo "$2" | sed -n '/^[0-1]/p'` -- cgit v1.2.3