summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEUcancER <root@euer.krebsco.de>2011-09-05 01:43:30 +0200
committerEUcancER <root@euer.krebsco.de>2011-09-05 01:43:30 +0200
commit2cf53c89ee1027ef5629a71b3ca98c90a8801a17 (patch)
tree5a030f03fa85bc0e78129f959319ba32d17a278c
parent19289a7161d0f2cf2e210bdfe4cd702f6d71928c (diff)
parent761db6a8b30f254b5349395c939111dedd8cf16b (diff)
Merge branch 'master' of github.com:krebscode/painload
-rw-r--r--.gitmodules3
-rw-r--r--cholerab/AGENDA3
-rw-r--r--cholerab/news/Candidate12
-rwxr-xr-xgod/licht115
-rwxr-xr-xmeinsack/index85
-rwxr-xr-xquery/jquery/index19
-rw-r--r--shack/Eselkalk/index.js57
-rwxr-xr-xshack/meinsack/index8
-rw-r--r--streams/stream.db1
9 files changed, 290 insertions, 13 deletions
diff --git a/.gitmodules b/.gitmodules
index cbc61522..3677b710 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -13,9 +13,6 @@
[submodule "submodules/github/tautologistics/node-htmlparser"]
path = submodules/github/tautologistics/node-htmlparser
url = https://github.com/tautologistics/node-htmlparser
-[submodule "krebsbeam/c-beam"]
- path = krebsbeam/c-beam
- url = git://dev.c-base.org/c-beam/c-beam.git
[submodule "submodules/github/makefu/dpfhack_display"]
path = submodules/github/makefu/dpfhack_display
url = https://github.com/makefu/dpfhack_pearl
diff --git a/cholerab/AGENDA b/cholerab/AGENDA
index 8c80be0d..d2c1ae1f 100644
--- a/cholerab/AGENDA
+++ b/cholerab/AGENDA
@@ -107,3 +107,6 @@
- //Schnabeltasse
- wgrep
+
+ - generated code must be created outside of the //-hierarchy, so killing
+ a local repository and recloning it is easier
diff --git a/cholerab/news/Candidate b/cholerab/news/Candidate
index 8abc0b00..1b52abe4 100644
--- a/cholerab/news/Candidate
+++ b/cholerab/news/Candidate
@@ -46,4 +46,14 @@ gewaehrleisten sollen verwendet werden.
[1.1] : https://github.com/krebscode/painload/tree/master/retiolum/bin/get-tinc-dir
-## 2. KNUT - Die Krebs Notification Utility Toolchain
+## 2. Krebs MPD + http stream
+
+KM momo hat sich heute (01.09.2011) gegen die streams gewehrt und auf der filebitch einen mpd Server eingerichtet.
+Der MPD streamt jetzt via http(vorbis) auf http://filebitch.shack:8000.
+Eine Integration in //streams ist bereits vorgenommen.
+Der MPD lauert auf filebitch.shack:6600 auf MPD Clients die ihn bedienen.
+Ein Webinterface ist noch nicht geplant.
+
+Die Musiksammlung kann in incoming/Musik auf der Filebitch erweitert werden.
+
+## 3. KNUT - Die Krebs Notification Utility Toolchain
diff --git a/god/licht b/god/licht
index 8ece3510..cbff9ad0 100755
--- a/god/licht
+++ b/god/licht
@@ -1,20 +1,117 @@
#!/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'`
+#
+#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'`
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 <lampe> <0/1>"
+ echo "Usage: licht <lampe> <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 <lampe> <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
+
diff --git a/meinsack/index b/meinsack/index
new file mode 100755
index 00000000..7046d78c
--- /dev/null
+++ b/meinsack/index
@@ -0,0 +1,85 @@
+#! /bin/sh
+#
+# //meinsack
+#
+# export plz
+# export str
+# export anr
+# export ort
+#
+set -euf
+cd $(dirname $(readlink -f $0))/.. # cd //
+
+plz=${plz+"&plz=$plz"}
+str=${str+"&str=$str"}
+anr=${anr+"&anr=$anr"}
+
+url="http://www.sita-deutschland.de/sita/ywbase_Abfallkalender_Stuttgart.nsf/frmSelect?ReadForm$plz$str$anr"
+
+# echo $url
+
+html="$(curl -fsS "$url" | iconv -f latin1 -t utf8)"
+
+if echo "$html" | fgrep -q 'Ihre Eingabe war nicht eindeutig'; then
+ {
+ echo "Error: multiple locations found"
+ echo "$html" |
+ query/jquery/index 'table.tab:nth-child(2n) .bordertop > .text' |
+ sed '
+ s/[[:space:]]\+/ /g
+ s/'"`printf '\xc2\xa0'`"'//g;# kill unicode non-breaking space
+ ' |
+ while read plz &&
+ read str &&
+ read ort &&
+ read bes1 &&
+ read bes2 &&
+ read anr; do
+ str=$(echo "$str"|sed 's/<[^>]*>//g')
+ echo "export anr=$anr if you meant \"$ort\""
+ done | sort | uniq
+ } >&2
+ exit 2
+elif test $(echo "$html" | grep -c 'Abfallkalender für') -gt 1 &&
+ test -z "${ort-}"; then
+ {
+ echo "Error: multiple locations found"
+ echo "$html" |
+ query/jquery/index '.tab span.text,.subheadline' |
+ sed -n '
+ s/[[:space:]]\+/ /g
+ s/'"`printf '\xc2\xa0'`"'//g;# kill unicode non-breaking space
+ s/^Abfallkalender.*[^0-9]\([0-9]\+\)[^(]*(\(.*\))/export ort=\2/p
+ ' | sort | uniq
+ } >&2
+ exit 3
+else
+ result="$(echo "$html" |
+ query/jquery/index '.tab span.text,.subheadline' | {
+ if test -n "${ort-}"; then
+ sed -n "
+ /($ort)/,/^Abfallkalender/{p;b}
+ /($ort)/,\${p;b}
+ "
+ else
+ cat
+ fi
+ } | {
+ grep -v Abfallkalender |
+ sed '
+ s/'"`printf '\xc2\xa0'`"'//g;# kill unicode non-breaking space
+ s/^[A-Z][a-z]\.\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)$/\3-\2-\1/
+ s/^[0-9].*/ "&T00:00:00.000Z"/
+ $!s/$/,/
+ 1s/^/[\n/
+ $s/$/\n]/
+ '
+ })"
+ if ! echo "$result" | grep .; then
+ {
+ echo "Error: your query had no effect"
+ echo "url=\"$url\""
+ } >&2
+ exit 4
+ fi
+fi
diff --git a/query/jquery/index b/query/jquery/index
new file mode 100755
index 00000000..3c49dac9
--- /dev/null
+++ b/query/jquery/index
@@ -0,0 +1,19 @@
+#! /bin/sh
+set -euf
+
+# cd //
+cd $(dirname $(readlink -f $0))/../..
+
+for x in \
+ github/tmpvar \
+ github/mikeal \
+ github/NV \
+ github/tautologistics \
+; do
+ export NODE_PATH="$(readlink -f submodules/$x)${NODE_PATH+:$NODE_PATH}"
+done
+
+# ensure query is ready
+#git submodule update --init
+
+exec node submodules/github/visionmedia/query "$@"
diff --git a/shack/Eselkalk/index.js b/shack/Eselkalk/index.js
new file mode 100644
index 00000000..f64e0605
--- /dev/null
+++ b/shack/Eselkalk/index.js
@@ -0,0 +1,57 @@
+//
+// node //shack/Eselkalk DATE
+//
+// where DATE ∈ [YYYY[-MM]], defaulting to the current YYYY-MM
+//
+
+range = process.argv[2] ||
+ JSON.parse(JSON.stringify(new Date())).slice(0, '....-..'.length)
+
+function dates(date) {
+ var year = date.getFullYear()
+ var month = date.getMonth()
+
+ var i = new Date([year, (month < 9 ? '0' : '') + (month + 1)].join('-'))
+
+ var days = []
+ var next_day = 4;
+ for (
+ ; i.getMonth() === month
+ ; i = new Date(+i + 24 * 60 * 60 * 1000)) {
+ if (i.getDay() === next_day) {
+ next_day = next_day === 3 ? 4 : 3
+ if (next_day === 3) {
+ var next_4day = new Date(+i + 7 * 24 * 60 * 60 * 1000)
+ if (next_4day.getMonth() !== month) {
+ i = new Date(+i - 24 * 60 * 60 * 1000)
+ next_4day = 4
+ }
+ }
+ days.push(new Date(+i + (20 * 60 + i.getTimezoneOffset()) * 60 * 1000))
+ while (i.getDay() !== 0) {
+ i = new Date(+i + 24 * 60 * 60 * 1000)
+ }
+ }
+ }
+
+ return days
+}
+
+
+result = []
+
+// TODO if (/^....-..-..$/.test(range)) { ... }
+if (/^....-..$/.test(range)) {
+ result = dates(new Date(range))
+}
+else if (/^....$/.test(range)) {
+ ['01','02','03','04','05','06','07','08','09','10','11','12'
+ ].forEach(function (i) {
+ result = result.concat(dates(new Date([range, i].join('-'))))
+ })
+}
+else {
+ throw new Error('You are made of stupid! ' + range)
+}
+
+console.log(JSON.stringify(result, null, 2))
diff --git a/shack/meinsack/index b/shack/meinsack/index
new file mode 100755
index 00000000..7d7147b2
--- /dev/null
+++ b/shack/meinsack/index
@@ -0,0 +1,8 @@
+#! /bin/sh
+set -euf
+cd $(dirname $(readlink -f $0))/../.. # cd //
+
+export plz=70327
+export str=Ulmer
+export ort=Wangen
+exec meinsack/index
diff --git a/streams/stream.db b/streams/stream.db
index 5efeb9ea..47ccf7b5 100644
--- a/streams/stream.db
+++ b/streams/stream.db
@@ -6,3 +6,4 @@ http://somafm.com/illstreet.pls illstreet
http://localhost:8000/stream.ogg icecast
http://stream2.jungletrain.net:8000 jungletrain
http://playlist.tormentedradio.com/tormentedradio.pls tormented
+http://filebitch.shack:8000 mpd