From 08aa5e406a1f7b39182e79ea4eb7fabf7d61eaa3 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 30 Dec 2013 14:34:38 +0100 Subject: //Cancer -> // because that is what painload is all about --- "Cancer/K\303\274belwagen/Makefile" | 14 -- "Cancer/K\303\274belwagen/alarm" | 27 --- "Cancer/K\303\274belwagen/index.c" | 206 --------------------- "Cancer/K\303\274belwagen/playmobil" | 12 -- "Cancer/K\303\274belwagen/sin.js" | 37 ---- Cancer/assets/Makefile | 11 -- Cancer/assets/README | 44 ----- Cancer/assets/bin/asq | 2 - Cancer/assets/bin/ass | 24 --- Cancer/assets/bin/check-truth | 11 -- Cancer/assets/bin/fast | 20 -- Cancer/assets/bin/truth2json | 37 ---- Cancer/assets/doc/ass.txt | 9 - Cancer/assets/doc/lexikon.txt | 12 -- Cancer/assets/doc/structs.nojson | 43 ----- Cancer/assets/doc/usecases.txt | 71 ------- Cancer/assets/hooks/pre-commit | 8 - Cancer/bigeye/bigeyed | 70 ------- Cancer/bridge/README.md | 1 - Cancer/bridge/bin/bridge | 12 -- Cancer/bridge/etc/bash_completion.d/bridge | 18 -- Cancer/bridge/lib/bridge/bin/attach | 10 - Cancer/bridge/lib/bridge/bin/create | 15 -- Cancer/bridge/lib/bridge/bin/destroy | 12 -- Cancer/bridge/lib/bridge/bin/list | 10 - Cancer/bridge/lib/bridge/bin/paste | 30 --- Cancer/bridge/share/doc/bridge/README.md | 59 ------ Cancer/bridge/share/vim/vimfiles/plugin/bridge.vim | 113 ----------- Cancer/git/git-clone-into | 48 ----- Cancer/git/git-eternal-move | 15 -- Cancer/ircbot/bot.py | 81 -------- Cancer/ircbot/feeds | 2 - Cancer/minikrebs | 1 - Cancer/query/jquery/index | 19 -- Cancer/query/realpath/install | 41 ---- Cancer/query/realpath/src/realpath.rb | 10 - Cancer/webchat/Makefile | 8 - Cancer/webchat/index.js | 172 ----------------- Cancer/webchat/package.json | 15 -- Cancer/webchat/proto_spec | 62 ------- Cancer/webchat/public/client.js | 70 ------- Cancer/webchat/public/functions.js | 54 ------ Cancer/webchat/public/jquery-2.0.3.min.js | 6 - Cancer/webchat/public/krebs.png | Bin 2583 -> 0 bytes Cancer/webchat/public/reset.css | 126 ------------- Cancer/webchat/public/rpc.js | 99 ---------- Cancer/webchat/public/sockjs-0.3.min.js | 27 --- Cancer/webchat/public/sockjs_client_transport.js | 25 --- .../webchat/sockjs_server_connection_transport.js | 26 --- "K\303\274belwagen" | 1 - "K\303\274belwagen/Makefile" | 14 ++ "K\303\274belwagen/alarm" | 27 +++ "K\303\274belwagen/index.c" | 206 +++++++++++++++++++++ "K\303\274belwagen/playmobil" | 12 ++ "K\303\274belwagen/sin.js" | 37 ++++ assets/Makefile | 11 ++ assets/README | 44 +++++ assets/bin/asq | 2 + assets/bin/ass | 24 +++ assets/bin/check-truth | 11 ++ assets/bin/fast | 20 ++ assets/bin/truth2json | 37 ++++ assets/doc/ass.txt | 9 + assets/doc/lexikon.txt | 12 ++ assets/doc/structs.nojson | 43 +++++ assets/doc/usecases.txt | 71 +++++++ assets/hooks/pre-commit | 8 + bigeye/bigeyed | 70 +++++++ bridge | 1 - bridge/README.md | 1 + bridge/bin/bridge | 12 ++ bridge/etc/bash_completion.d/bridge | 18 ++ bridge/lib/bridge/bin/attach | 10 + bridge/lib/bridge/bin/create | 15 ++ bridge/lib/bridge/bin/destroy | 12 ++ bridge/lib/bridge/bin/list | 10 + bridge/lib/bridge/bin/paste | 30 +++ bridge/share/doc/bridge/README.md | 59 ++++++ bridge/share/vim/vimfiles/plugin/bridge.vim | 113 +++++++++++ git/git-clone-into | 48 +++++ git/git-eternal-move | 15 ++ ircbot/bot.py | 81 ++++++++ ircbot/feeds | 2 + query/jquery/index | 19 ++ query/realpath/install | 41 ++++ query/realpath/src/realpath.rb | 10 + webchat/Makefile | 8 + webchat/index.js | 172 +++++++++++++++++ webchat/package.json | 15 ++ webchat/proto_spec | 62 +++++++ webchat/public/client.js | 70 +++++++ webchat/public/functions.js | 54 ++++++ webchat/public/jquery-2.0.3.min.js | 6 + webchat/public/krebs.png | Bin 0 -> 2583 bytes webchat/public/reset.css | 126 +++++++++++++ webchat/public/rpc.js | 99 ++++++++++ webchat/public/sockjs-0.3.min.js | 27 +++ webchat/public/sockjs_client_transport.js | 25 +++ webchat/sockjs_server_connection_transport.js | 26 +++ 99 files changed, 1844 insertions(+), 1847 deletions(-) delete mode 100644 "Cancer/K\303\274belwagen/Makefile" delete mode 100755 "Cancer/K\303\274belwagen/alarm" delete mode 100644 "Cancer/K\303\274belwagen/index.c" delete mode 100755 "Cancer/K\303\274belwagen/playmobil" delete mode 100644 "Cancer/K\303\274belwagen/sin.js" delete mode 100644 Cancer/assets/Makefile delete mode 100644 Cancer/assets/README delete mode 100755 Cancer/assets/bin/asq delete mode 100755 Cancer/assets/bin/ass delete mode 100755 Cancer/assets/bin/check-truth delete mode 100755 Cancer/assets/bin/fast delete mode 100755 Cancer/assets/bin/truth2json delete mode 100644 Cancer/assets/doc/ass.txt delete mode 100644 Cancer/assets/doc/lexikon.txt delete mode 100644 Cancer/assets/doc/structs.nojson delete mode 100644 Cancer/assets/doc/usecases.txt delete mode 100755 Cancer/assets/hooks/pre-commit delete mode 100755 Cancer/bigeye/bigeyed delete mode 120000 Cancer/bridge/README.md delete mode 100755 Cancer/bridge/bin/bridge delete mode 100644 Cancer/bridge/etc/bash_completion.d/bridge delete mode 100755 Cancer/bridge/lib/bridge/bin/attach delete mode 100755 Cancer/bridge/lib/bridge/bin/create delete mode 100755 Cancer/bridge/lib/bridge/bin/destroy delete mode 100755 Cancer/bridge/lib/bridge/bin/list delete mode 100755 Cancer/bridge/lib/bridge/bin/paste delete mode 100644 Cancer/bridge/share/doc/bridge/README.md delete mode 100644 Cancer/bridge/share/vim/vimfiles/plugin/bridge.vim delete mode 100755 Cancer/git/git-clone-into delete mode 100755 Cancer/git/git-eternal-move delete mode 100755 Cancer/ircbot/bot.py delete mode 100644 Cancer/ircbot/feeds delete mode 160000 Cancer/minikrebs delete mode 100755 Cancer/query/jquery/index delete mode 100755 Cancer/query/realpath/install delete mode 100755 Cancer/query/realpath/src/realpath.rb delete mode 100644 Cancer/webchat/Makefile delete mode 100644 Cancer/webchat/index.js delete mode 100644 Cancer/webchat/package.json delete mode 100644 Cancer/webchat/proto_spec delete mode 100644 Cancer/webchat/public/client.js delete mode 100644 Cancer/webchat/public/functions.js delete mode 100644 Cancer/webchat/public/jquery-2.0.3.min.js delete mode 100644 Cancer/webchat/public/krebs.png delete mode 100644 Cancer/webchat/public/reset.css delete mode 100644 Cancer/webchat/public/rpc.js delete mode 100644 Cancer/webchat/public/sockjs-0.3.min.js delete mode 100644 Cancer/webchat/public/sockjs_client_transport.js delete mode 100644 Cancer/webchat/sockjs_server_connection_transport.js delete mode 120000 "K\303\274belwagen" create mode 100644 "K\303\274belwagen/Makefile" create mode 100755 "K\303\274belwagen/alarm" create mode 100644 "K\303\274belwagen/index.c" create mode 100755 "K\303\274belwagen/playmobil" create mode 100644 "K\303\274belwagen/sin.js" create mode 100644 assets/Makefile create mode 100644 assets/README create mode 100755 assets/bin/asq create mode 100755 assets/bin/ass create mode 100755 assets/bin/check-truth create mode 100755 assets/bin/fast create mode 100755 assets/bin/truth2json create mode 100644 assets/doc/ass.txt create mode 100644 assets/doc/lexikon.txt create mode 100644 assets/doc/structs.nojson create mode 100644 assets/doc/usecases.txt create mode 100755 assets/hooks/pre-commit create mode 100755 bigeye/bigeyed delete mode 120000 bridge create mode 120000 bridge/README.md create mode 100755 bridge/bin/bridge create mode 100644 bridge/etc/bash_completion.d/bridge create mode 100755 bridge/lib/bridge/bin/attach create mode 100755 bridge/lib/bridge/bin/create create mode 100755 bridge/lib/bridge/bin/destroy create mode 100755 bridge/lib/bridge/bin/list create mode 100755 bridge/lib/bridge/bin/paste create mode 100644 bridge/share/doc/bridge/README.md create mode 100644 bridge/share/vim/vimfiles/plugin/bridge.vim create mode 100755 git/git-clone-into create mode 100755 git/git-eternal-move create mode 100755 ircbot/bot.py create mode 100644 ircbot/feeds create mode 100755 query/jquery/index create mode 100755 query/realpath/install create mode 100755 query/realpath/src/realpath.rb create mode 100644 webchat/Makefile create mode 100644 webchat/index.js create mode 100644 webchat/package.json create mode 100644 webchat/proto_spec create mode 100644 webchat/public/client.js create mode 100644 webchat/public/functions.js create mode 100644 webchat/public/jquery-2.0.3.min.js create mode 100644 webchat/public/krebs.png create mode 100644 webchat/public/reset.css create mode 100644 webchat/public/rpc.js create mode 100644 webchat/public/sockjs-0.3.min.js create mode 100644 webchat/public/sockjs_client_transport.js create mode 100644 webchat/sockjs_server_connection_transport.js diff --git "a/Cancer/K\303\274belwagen/Makefile" "b/Cancer/K\303\274belwagen/Makefile" deleted file mode 100644 index 9be84e13..00000000 --- "a/Cancer/K\303\274belwagen/Makefile" +++ /dev/null @@ -1,14 +0,0 @@ - -CC := gcc -std=c99 -CFLAGS := -D_XOPEN_SOURCE=500 -LIBS := $(shell pkg-config --cflags --libs jack) -lm - -.PHONY: all clean - -all: a.out - -clean: - rm -f a.out - -a.out: index.c - $(CC) $(CFLAGS) -o $@ $^ $(LIBS) diff --git "a/Cancer/K\303\274belwagen/alarm" "b/Cancer/K\303\274belwagen/alarm" deleted file mode 100755 index a117c433..00000000 --- "a/Cancer/K\303\274belwagen/alarm" +++ /dev/null @@ -1,27 +0,0 @@ -#! /bin/sh -# -# //Kübelwagen/alarm SLEEPARGS... -# -# where SLEEPARGS are passed to sleep(3) -# -set -euf -cd $(dirname $(readlink -f $0)) -exec >&2 - -make - -jackd -d alsa & -trap "kill -0 $! && kill $!" EXIT INT - -for i in `seq 8000 1000 10000`; do - echo $i 100 -done | ./a.out 1 -echo 'if you heard that sound, then goto sleep..^_^' - -echo sleep "$@" -sleep "$@" - -echo 'wake up!' -while :; do - echo $(echo "($(od -tu -An -N 2 /dev/urandom)%1000)+500"|bc) $(echo "($(od -tu -An -N 2 /dev/urandom)%500)+100"|bc) -done | ./a.out 1 diff --git "a/Cancer/K\303\274belwagen/index.c" "b/Cancer/K\303\274belwagen/index.c" deleted file mode 100644 index 9a15c7c3..00000000 --- "a/Cancer/K\303\274belwagen/index.c" +++ /dev/null @@ -1,206 +0,0 @@ -#include -#include -#include -#include -#include - -#include - -const double PI = 3.14; - -/*Our output port*/ -jack_port_t *output_port; - -typedef jack_default_audio_sample_t sample_t; - -/*The current sample rate*/ -jack_nframes_t sr; - -/*samples in cycle*/ -jack_nframes_t samincy; -/*the current offset*/ -long offset=0; - -/*frequency of our sound*/ -int tone = 262; -int length = 1000000; - -char const *name = ""; - -int process (jack_nframes_t nframes, void *arg){ - /*grab our output buffer*/ - sample_t *out = (sample_t *) jack_port_get_buffer - (output_port, nframes); - - int _tone = tone > 0 ? tone : 1; - - /*For each required sample*/ - for(jack_nframes_t i=0;i < nframes;i++){ - /*Copy the sample at the current position in the cycle to the buffer*/ - - jack_nframes_t samincy = sr / _tone; - sample_t scale = 2 * PI / samincy; - out[i] = sin(offset * scale); - - /*and increment the offset, wrapping to 0 if needed*/ - /*(Dumb increment fixed thanks to Jussi Sainio)*/ - offset++; - if(offset >= samincy) - offset = 0; - } - - return 0; -} - -int srate (jack_nframes_t nframes, void *arg){ - printf ("the sample rate is now %lu/sec\n", nframes); - sr=nframes; - return 0; -} - -void error (const char *desc){ - fprintf (stderr, "JACK error: %s\n", desc); -} - -void jack_shutdown (void *arg){ - exit (1); -} - -void usage(void) { - fprintf (stderr, "usage: %s [Hz [ms]]\n", name); -} - -int main (int argc, char *argv[]){ - jack_client_t *client; - const char **ports; - - name = argv[0]; - - if (argc < 2) { - usage(); - return 1; - } - if (argc >= 2) { - tone = atoi(argv[1]); - if (tone == 0) { - usage(); - return 1; - } - fprintf(stderr, "tone: %dHz\n", tone); - if (argc >= 3) { - length = atoi(argv[2]) * 1000; - if (length == 0) { - usage(); - return 1; - } - fprintf(stderr, "length: %dms\n", length/1000); - } - } - - /* tell the JACK server to call error() whenever it - experiences an error. Notice that this callback is - global to this process, not specific to each client. - - This is set here so that it can catch errors in the - connection process - */ - jack_set_error_function (error); - - /* try to become a client of the JACK server */ - - if ((client = jack_client_open(argv[0], JackNullOption, NULL)) == 0) { - fprintf (stderr, "jack server not running?\n"); - return 1; - } - - /* tell the JACK server to call `process()' whenever - there is work to be done. - */ - - jack_set_process_callback (client, process, 0); - - /* tell the JACK server to call `srate()' whenever - the sample rate of the system changes. - */ - - - jack_set_sample_rate_callback (client, srate, 0); - - /* tell the JACK server to call `jack_shutdown()' if - it ever shuts down, either entirely, or if it - just decides to stop calling us. - */ - - jack_on_shutdown (client, jack_shutdown, 0); - - /* display the current sample rate. once the client is activated - (see below), you should rely on your own sample rate - callback (see above) for this value. - */ - printf ("engine sample rate: %lu\n", jack_get_sample_rate (client)); - - - sr=jack_get_sample_rate (client); - - /* create two ports */ - - - output_port = jack_port_register (client, "output", - JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0); - - /* tell the JACK server that we are ready to roll */ - - if (jack_activate (client)) { - fprintf (stderr, "cannot activate client"); - return 1; - } - - /* connect the ports*/ - if ((ports = jack_get_ports (client, NULL, NULL, - JackPortIsPhysical|JackPortIsInput)) == NULL) { - fprintf(stderr, "Cannot find any physical playback ports\n"); - exit(1); - } - - int i=0; - while(ports[i]!=NULL){ - if (jack_connect (client, jack_port_name (output_port), ports[i])) { - fprintf (stderr, "cannot connect output ports\n"); - } - i++; - } - - free (ports); - - //while (1) { //scanf("%i %i", &tone, &length) == 2) { - char buf[BUFSIZ]; - while (fgets(buf, BUFSIZ, stdin) == buf) { - //if (strstr(buf, "Hz\n")) { - // sscanf(buf, "%i", &tone); - // fprintf(stderr, "%dHz\n", tone); - //} - //if (strstr(buf, "us\n")) { - // sscanf(buf, "%i", &length); - // fprintf(stderr, "%dus\n", length); - //} - - int length = 0; - int c; - int pos = 0, n; - while ((c = sscanf(buf + pos, "%i%i%n", &tone, &length, &n)) == 2) { - - if (length > 0) { - usleep(length * 1000); - } - - pos += n; - - fprintf(stderr, "%dHz %dms\n", tone, length); - } - } - ///* 3 seconds of bleep is plenty*/ - ///usleep(length); - jack_client_close(client); - - exit(0); -} diff --git "a/Cancer/K\303\274belwagen/playmobil" "b/Cancer/K\303\274belwagen/playmobil" deleted file mode 100755 index 51ed70d6..00000000 --- "a/Cancer/K\303\274belwagen/playmobil" +++ /dev/null @@ -1,12 +0,0 @@ -#! /bin/sh -file=`mktemp` -trap "rm -f $file" EXIT INT TERM - -gcc -xc -lm -o $file - < -main(t) { - for (t=${2-0};;++t) putchar($1); -} -EOF - -$file | aplay diff --git "a/Cancer/K\303\274belwagen/sin.js" "b/Cancer/K\303\274belwagen/sin.js" deleted file mode 100644 index 0f472715..00000000 --- "a/Cancer/K\303\274belwagen/sin.js" +++ /dev/null @@ -1,37 +0,0 @@ - - - -var x = 3000; - -var t = 0; -var i = 0; -var j = 0.00001; -var t0 = new Date(); -(function rec () { - - var t1 = new Date(); - console.error('dt = ' + (t1 - t0)); - t0 = t1; - - if (x === 3000) { - x = 1000; - } else { - x = 3000; - }; - - console.log('2000 50 0 50 2000 50 0 50 ' + x + ' 100 0 0'); - return setTimeout(rec, 1000); - - i += 0.01; - console.log((2000 + Math.sin(i) * 1000 | 0) + ' 0'); - return setTimeout(rec, 1); - - var f = Math.abs(1000 + 500 * Math.tan( t )); - var scale = 1; - - console.log(((f * scale)|0) + ' 0'); - - t++; - setTimeout(rec, 100); - //process.nextTick(rec); -})(); diff --git a/Cancer/assets/Makefile b/Cancer/assets/Makefile deleted file mode 100644 index 07efde82..00000000 --- a/Cancer/assets/Makefile +++ /dev/null @@ -1,11 +0,0 @@ - -hooks := pre-commit -binaries := $(shell ls bin/) -.PHONY: all - -all: $(addprefix ../db/.git/hooks/,$(hooks)) $(addprefix ../bin/,$(binaries)) - -../bin/%: bin/% - cp $< $@ -../db/.git/hooks/%: hooks/% - cp $< $@ diff --git a/Cancer/assets/README b/Cancer/assets/README deleted file mode 100644 index 7f90bfbf..00000000 --- a/Cancer/assets/README +++ /dev/null @@ -1,44 +0,0 @@ -# Asset tools for krebs - -## Prereqs -Check out the current krebs-asset repo into //db - - git checkout root@db-host:/krebs.db.git db - -in //db/ is an append-only file known as 'truth'. it contains the assets and the history of these. -Every commit is atomic, every line needs to be committed after being produced. - -## Usage -### ass -bin/ass has the power to add entries to the //db/truth file in the correct manner. It has two modes, create mode and set mode. -Create mode produces new keys in the database, these database entries are unique. -Set mode can set attributes to an entry in the database - -Example: - ass create bob - ass set bob type - ass create bob-pc - ass set bob-pc owner bob - ass set bob-pc location bob\'s-home - -### asq -asq is a tool to query the truth for facts. This is currently only a placeholder - -### FAST -fast is a wrapper around the core ass. It should be used for adding lots and lots of new entries to the truth. It evaluates Variables from your environment. - -Example: - export ASS_LOCATION=bob\'s-home - export ASS_OWNER=bob - fast c logitech-sidewinder-gamepad - fast c arduino-uno - fast s amount 3 - -fast will then actually generate the following: - ass create logitech-sidewinder-gamepad - ass set logitech-sidewinder-gamepad owner bob - ass set logitech-sidewinder-gamepad location bob\'s-home - ass create arduino-uno - ass set arduino-uno owner bob - ass set arduino-uno location bob\'s-home - ass set arduino-uno amount 3 diff --git a/Cancer/assets/bin/asq b/Cancer/assets/bin/asq deleted file mode 100755 index 0204e05b..00000000 --- a/Cancer/assets/bin/asq +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/something -# placeholder to asq the truth for facts diff --git a/Cancer/assets/bin/ass b/Cancer/assets/bin/ass deleted file mode 100755 index 5a4dade4..00000000 --- a/Cancer/assets/bin/ass +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh - -set -euf - -HERE=$(dirname $(readlink -f $0)) -DB="$HERE/../../db" -JOURNAL="$DB/truth" -(cd $DB && git pull >/dev/null && echo "pulled new version") - -METHOD="$1"; shift - -case $METHOD in -"create") - echo "`date --utc --rfc-3339=ns` create $1" | $HERE/check-truth | tee -a $JOURNAL -;; -"set") - echo "`date --utc --rfc-3339=ns` set $1 $2 $3" | $HERE/check-truth | tee -a $JOURNAL -;; -*) - echo "you are made of stupid!" - exit 23 -;; -esac -(cd $DB && git commit -a -m bump >/dev/null && git push 1>&2 2>/dev/null && echo "updates pushed")& diff --git a/Cancer/assets/bin/check-truth b/Cancer/assets/bin/check-truth deleted file mode 100755 index 064a7d97..00000000 --- a/Cancer/assets/bin/check-truth +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -set -euf -HERE=$(dirname $(readlink -f $0)) -DB="$HERE/../../db/truth" -read LINE -if (cat $DB;echo $LINE) | $HERE/truth2json - 1>/dev/null ;then - echo "success" 1>&2 - echo "$LINE" -else - echo "you fail" 1>&2 -fi diff --git a/Cancer/assets/bin/fast b/Cancer/assets/bin/fast deleted file mode 100755 index 41725d0b..00000000 --- a/Cancer/assets/bin/fast +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -set -xeuf -cd $(dirname $(readlink -f $0)) - -if [ "$1" == "c" ];then - ./ass create "$2" && export ASS_CREATED="$2" - for i in `env | grep -v '^ASS_CREATED=' | grep "^ASS" | cut -d '=' -f 1`;do - e=`echo $i | cut -d '_' -f 2 | tr '[A-Z]' '[a-z]'` - eval con=\$$i - $0 s "$e" "$con" - done -else if [ "$1" == "s" ] -then - ./ass set "${ASS_CREATED}" "${2}" "${3}" - else - echo "you are made of stupid!" - cat $0 - exit 23 - fi -fi diff --git a/Cancer/assets/bin/truth2json b/Cancer/assets/bin/truth2json deleted file mode 100755 index f85445b4..00000000 --- a/Cancer/assets/bin/truth2json +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/python - -import sys - -try: - db=sys.argv[1] -except: - db="../../db/truth" - -ret = {} - - -if db is "-": - sys.stderr.write("Using stdin\n") - f = sys.stdin -else: - sys.stderr.write("Using journal '%s'\n" % db) - f = open(db) - -for line in f: - lsplit = line.split() - date = ' '.join(lsplit[0:2]) - cmd = lsplit[2] - target = lsplit[3] - if cmd == "create": - assert target not in ret, "Target '%s' already created!" %target - ret[target] = {} - elif cmd == "set": - key = lsplit[4] - value = ' '.join(lsplit[5:]) - assert target in ret, "target '%s' not set yet!" % target - ret[target][key] = value - else: - raise AssertionError,"unknown command '%s'!" - -import json -print json.dumps(ret,sort_keys=True,indent=4) diff --git a/Cancer/assets/doc/ass.txt b/Cancer/assets/doc/ass.txt deleted file mode 100644 index f10d2ba1..00000000 --- a/Cancer/assets/doc/ass.txt +++ /dev/null @@ -1,9 +0,0 @@ -ass usages: - -$0 create name - if not "create name" in history and name is not retarded: - echo "timestamp: create name" >> history - -$0 set name property value - if "create name" in history and property is not retarded: - echo "timestamp: set name property value" >> history diff --git a/Cancer/assets/doc/lexikon.txt b/Cancer/assets/doc/lexikon.txt deleted file mode 100644 index 0d362100..00000000 --- a/Cancer/assets/doc/lexikon.txt +++ /dev/null @@ -1,12 +0,0 @@ - -asset / N assets - -platz / plaetze - -root-server - -shared root-server - -recht / rechte - -datenbank diff --git a/Cancer/assets/doc/structs.nojson b/Cancer/assets/doc/structs.nojson deleted file mode 100644 index 4c084862..00000000 --- a/Cancer/assets/doc/structs.nojson +++ /dev/null @@ -1,43 +0,0 @@ -"name": // default: random (gensym) - "type": "grafikkarte" - "location": "kremium" - "amount": 23 // default: 1 - "owner": "shack" // default: krebs - -"nebula": - "type": "location" - "owner": "tv" - -"tv": - "type": "owner" - -"grafikkarte": - "type": "type" - -"amount": - "type": "natural" - -"root-server": - "type": "irgend ein owner ist root" - -"shared": - "type": "alle owner sind root" - -"oxberg": - "type": "root-server" - "location": "de" - "ipv4-address": "84.23.80.172" - "isp": "euserv" - "ram": "512MiB" - -"ram": - "must-match": /[0-9]+[MGk]iB/ - -"kremium": - "location": "nebula" - "type": "root-server" - "shared": true - -"euserv": - "type": "ISP" - diff --git a/Cancer/assets/doc/usecases.txt b/Cancer/assets/doc/usecases.txt deleted file mode 100644 index a3e2a4fa..00000000 --- a/Cancer/assets/doc/usecases.txt +++ /dev/null @@ -1,71 +0,0 @@ -# use case #1: asset einsetzen - Hat Krebs ein Grafikkarte, die gute genug ist. - Wenn ja, dann will ich die in mein Computer einbauen. - -# use case #2: asset soll in der Ursprungszustand versetzt werden. - Urkrebs Mainboard-Batterie is leer und braucht Ersatz. - Haben wir so eine Batterie und falls ja, dann soll sie - fuer immer in Urkrebs rein. - -# use case #3: asset einlagern - Grafikkarte aus use case #1 (#2) soll wieder zurueck. - -# use case #4: asset ausschlachten - Urkrebs ist bis auf das Netzteil zerstoert worden, - das Netzteil soll eingelagert werden. - -# use case #5: asset hinzufuegen - Krebs erhaelt einen neuen Computer. - -# use case #6: asset finden - Wo oder bei wem ist das USB-Thermometer? - -# use case #7: asset details finden - Wie viele 4-Port-USB-Hubs hat krebs und wo sind die? - -# use case #8: verlust eines assets - Urkrebs ist physikalisch verschwunden, aber noch in der datenbank - eingetragen. - Welt der Dinge und der Daten muessen wieder synchron sein. - -# use case #9: asset anzahl erniedrigen; assets mergen - Eines von hundert 4-Port-USB-Hubs soll von platz X entnommen werden - und an ein asset gestoepselt werden. - -# use case #A: asset entfernen - Urkrebs wir vom Besitzer ausserhalb von krebs benoetigt und dem Bestand - entnommen. - -# use case #B: verlust eines platzes - platz ist explodiert und ein Teil der eingelagerten assets wurde vernichtet, - der andere Teil muss migriert werden. - -# use case #C: assets eines platzes erfragen - Was in an platz X eingelagert? - -# use case #D: - X war noch nie KM, hat aber unberechtigter weise assets, plaetze, rechte. - assets muessen an andere plaetze migriert werden. - dinge, die wie assets waren, aber nie wirklich assets waren, muessen aus der - datenbank entfernt werden. - plaetze muessen aus datenbank entfernt werden. - X muss entrechtet werden. - -# use case #E: assets in assets - Batterien liegen im Bankschliesfach X an platz Y. - -# use case #F: - ein root-server ist verschwunden. - -# use case #G: - welche shared root-server hat krebs in uk? - -# use case #H: - ein asset soll umbenannt werden, da der alte name nicht passend war. - -# use case #I: - welchen namen hat der Rechner, auf dem ich gerade bin? - -# use case #I.2: - welchen namen hat das asset in meiner Hand? - diff --git a/Cancer/assets/hooks/pre-commit b/Cancer/assets/hooks/pre-commit deleted file mode 100755 index 6ad1ca2a..00000000 --- a/Cancer/assets/hooks/pre-commit +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -set -euf -if which truth2json;then - truth2json >/dev/null && echo "db verified" -else - echo "cannot verify as truth2json is not installed" -fi - diff --git a/Cancer/bigeye/bigeyed b/Cancer/bigeye/bigeyed deleted file mode 100755 index 5aa36210..00000000 --- a/Cancer/bigeye/bigeyed +++ /dev/null @@ -1,70 +0,0 @@ -#! /bin/sh -# -# usage: bigeyed -# - -set -euf - -mkdir -vp /tmp/bigeye -cd /tmp/bigeye - -cleanup() { - test -n "$spid" && kill -9 $spid && spid= -} - -port=`touch /dev/bigeye 2>/dev/null && rm /dev/bigeye && echo 3 || echo 3333` - -#python -m http.server $port & server=$! -python -m SimpleHTTPServer $port & spid=$? -trap cleanup EXIT HUP INT QUIT TERM - -base64 -d>favicon.ico</dev/null 2>/dev/null - mv 0000000$frame.jpg index.jpg - cat>00000001.html< - - - $hostname's bigeye -

$date

-

ZOMBIECANCER

-EOF - mv 00000001.html index.html -} - -while blink; do - sleep 1 -done - diff --git a/Cancer/bridge/README.md b/Cancer/bridge/README.md deleted file mode 120000 index 7c994fe2..00000000 --- a/Cancer/bridge/README.md +++ /dev/null @@ -1 +0,0 @@ -share/doc/bridge/README.md \ No newline at end of file diff --git a/Cancer/bridge/bin/bridge b/Cancer/bridge/bin/bridge deleted file mode 100755 index 33cf4577..00000000 --- a/Cancer/bridge/bin/bridge +++ /dev/null @@ -1,12 +0,0 @@ -#! /bin/sh -# -# Interface to the bridge commands. -# -# See commands below $bindir -# -set -euf - -bindir="$(dirname $(readlink -f "$0"))/../lib/bridge/bin" -cmd="$bindir/$1"; shift - -exec "$cmd" "$@" diff --git a/Cancer/bridge/etc/bash_completion.d/bridge b/Cancer/bridge/etc/bash_completion.d/bridge deleted file mode 100644 index 86d8a4e2..00000000 --- a/Cancer/bridge/etc/bash_completion.d/bridge +++ /dev/null @@ -1,18 +0,0 @@ -#! /bin/bash -function comp_bridge() { - local cword="${COMP_WORDS[$COMP_CWORD]}" - local bindir="$(dirname $(readlink -f "$BASH_SOURCE"))/../../lib/bridge/bin" - case $COMP_CWORD in - (1) - COMPREPLY=( $(cd "$bindir" && ls | grep "^$cword.*") ) - ;; - (2) - case "${COMP_WORDS[1]}" in - (attach|destroy|paste) - COMPREPLY=( $(bridge list 2>/dev/null | grep "^$cword.*") ) - ;; - esac - ;; - esac -} -complete -F comp_bridge bridge diff --git a/Cancer/bridge/lib/bridge/bin/attach b/Cancer/bridge/lib/bridge/bin/attach deleted file mode 100755 index f456f8a6..00000000 --- a/Cancer/bridge/lib/bridge/bin/attach +++ /dev/null @@ -1,10 +0,0 @@ -#! /bin/sh -# -# Attach current tty to a session. -# -## SYNOPSIS -# -# bridge attach SESSION -# -set -euf -exec tmux -L bridge attach-session -t "$1" diff --git a/Cancer/bridge/lib/bridge/bin/create b/Cancer/bridge/lib/bridge/bin/create deleted file mode 100755 index 2df8b214..00000000 --- a/Cancer/bridge/lib/bridge/bin/create +++ /dev/null @@ -1,15 +0,0 @@ -#! /bin/sh -# -# Create a new session. -# -## SYNOPSIS -# -# bridge create SESSION [COMMAND [ARGS ...]] -# -# COMMAND defaults to $SHELL (by implication / tmux) -# -set -euf -target="$1"; shift -tmux -L bridge new-session -d -s "$target" "$@" -tmux -L bridge set-buffer READY. -exec "$(dirname $0)/attach" "$target" diff --git a/Cancer/bridge/lib/bridge/bin/destroy b/Cancer/bridge/lib/bridge/bin/destroy deleted file mode 100755 index dffdbd8a..00000000 --- a/Cancer/bridge/lib/bridge/bin/destroy +++ /dev/null @@ -1,12 +0,0 @@ -#! /bin/sh -# -# Destroy a session. -# -## SYNOPSIS -# -# bridge destroy SESSION -# -# Note that this may destroy similar named sessions (by implication / tmux) -# -set -euf -tmux -L bridge kill-session -t "$1" diff --git a/Cancer/bridge/lib/bridge/bin/list b/Cancer/bridge/lib/bridge/bin/list deleted file mode 100755 index 0b767a9b..00000000 --- a/Cancer/bridge/lib/bridge/bin/list +++ /dev/null @@ -1,10 +0,0 @@ -#! /bin/sh -# -# Write a list of all session names to stdout. -# -## SYNOPSIS -# -# bridge list -# -set -euf -exec tmux -L bridge list-sessions | cut -d: -f1 diff --git a/Cancer/bridge/lib/bridge/bin/paste b/Cancer/bridge/lib/bridge/bin/paste deleted file mode 100755 index d3ed1fc5..00000000 --- a/Cancer/bridge/lib/bridge/bin/paste +++ /dev/null @@ -1,30 +0,0 @@ -#! /bin/sh -# -# Paste some data to a session. -# -## SYNOPSIS -# -# bridge paste SESSION DATA... -# bridge paste SESSION < DATA -# -set -euf - -target="$1"; shift - -# paste args or stdin -if test $# -gt 0; then - tmux -L bridge set-buffer -b 0 "$*" -else - # use aux file instead of direct stdin for Vim and when used from $SHELL - if test -n "${VIMRUNTIME-}" || tty >/dev/null; then - path=`mktemp` - trap "rm -f $path" EXIT INT TERM - cat>$path - else - path=- - fi - tmux -L bridge load-buffer -b 0 $path -fi - -tmux -L bridge paste-buffer -b 0 -t "$target" -tmux -L bridge set-buffer -b 0 READY. diff --git a/Cancer/bridge/share/doc/bridge/README.md b/Cancer/bridge/share/doc/bridge/README.md deleted file mode 100644 index 77c62374..00000000 --- a/Cancer/bridge/share/doc/bridge/README.md +++ /dev/null @@ -1,59 +0,0 @@ -Bridge is a tool to connect your favourite editor and interpreter (or -similar) for maximum profit. - - -## usage by example - - # start your favourite interpreter, e.g. bc, in a new session - bridge create my_fancy_interpreter bc - - # attach a terminal to the session - bridge attach my_fancy_interpreter - - # fire up your favourite editor (in another terminal) - vim - # press to connect to the session - # press return - # write interpreter stuff, e.g. 42^23 - # mark that stuff - # press return - - # paste some stuff into the session - bridge paste my_fancy_interpreter '1 + 2 + 4^M' - # (note that ^M is carriage return obtained by pressing ^V^M AKA C-V C-M) - - # or use bridge as a sink in your pipeline - echo 2^20 | bridge paste my_fancy_interpreter - - # you can use tab-completion everywhere (if installed) - - -## install bridge (bourne) shell integration - -Hint #1: reboot your system or similar for this to take full effect -Hint #2: you could also use ~/.profile or similar - - echo 'PATH="${PATH+$PATH:}//bridge/bin"' >> /etc/profile - - -## install bridge Vim integration - -Hint: your vim-setup probably differs - - ln -s //bridge/share/vim/plugin/bridge.vim ~/.vim/plugin/ - - -## install bridge bash completion - -Hint #1: reboot your system or similar for this to take full effect -Hint #2: this could differ on your system, of course -Hint #3: you could also use ~/.profile or similar - - ln -s //bridge/etc/bash_completion.d/bridge /etc/bash_completion.d/ - - -## install bridge into some usr-like hierarchy [advanced] - - tar -C //bridge -c . | - tar --exclude=./README.md -C ~/opt -v --keep-newer-files -x - diff --git a/Cancer/bridge/share/vim/vimfiles/plugin/bridge.vim b/Cancer/bridge/share/vim/vimfiles/plugin/bridge.vim deleted file mode 100644 index 91f072d1..00000000 --- a/Cancer/bridge/share/vim/vimfiles/plugin/bridge.vim +++ /dev/null @@ -1,113 +0,0 @@ -" /vim/bridge.vim - -if ! exists('s:bridge_name') - let s:bridge_name = "" -endif - -fun! Bridge_complete(A,L,P) - let a = strpart(a:A,0,a:P) - return split(system("bridge list \"".a.".*\""), "\n") -endfun - -fun! Bridge_status() - if s:bridge_name == "" - return "Disconnected" - else - return "Connected to " . s:bridge_name - else - endif -endfun - -setlocal statusline=%<%f\ \(%{Bridge_status()}\)\ %h%m%r%=%-14.(%l,%c%V%)\ %P\ of\ %L\ \(%.45{getcwd()}\) - -fun! Bridge_display() - if s:bridge_name == "" - echo "Not connected!" - return - endif - let cmd = "bridge attach ".s:bridge_name - silent exe "!" . cmd - redraw! -endfun - -fun! Bridge_connect() - if s:bridge_name == "" - let m = "boot new" - else - let m = s:bridge_name - endif - let name = input("Connect to [".m."]: ", "", "customlist,Bridge_complete") - if name == "" - if s:bridge_name != '' - " stay connected - echo - return - endif - let system = input("Command: ", "") - if system == "" - echo "Aborted!" - return - endif - let name = input("Session name: ", "") - if name == "" - echo "Aborted!" - return - endif - TODO_boot_new - endif - if system("bridge list ".name) == "" - echo "No such session: ".name - return - endif - let s:bridge_name = name - let s:laststatus = &laststatus - let &laststatus = 2 - echo "Connected to " . s:bridge_name -endfun - -fun! Bridge_disconnect(m) - if s:bridge_name == "" - echo "Not connected!" - else - let &laststatus = s:laststatus - let m = "Disconnected from ".s:bridge_name - if a:m != "" - let m .= ": ".a:m - endif - echo m."!" - let s:bridge_name = "" - endif -endfun - -function! Bridge_paste( data ) - if a:data == '' - echo "Nothing to send!" - else - let l:data = a:data - if exists("g:bridge_prologue") | let l:data = g:bridge_prologue . l:data | endif - if exists("g:bridge_epilogue") | let l:data = l:data . g:bridge_epilogue | endif - call system("bridge paste " . s:bridge_name, l:data . "\") - endif -endfunction - -nmap :call Bridge_display() -nmap [24^ -nmap :call Bridge_connect() -nmap :call Bridge_disconnect("") -nmap [24$ - -nmap el :call Bridge_paste(getline(".")) -nmap ec m'ya(:call Bridge_paste(getreg('"'))`' -nmap et m'(y%:call Bridge_paste(getreg('"'))`' - -nmap ee :call Bridge_paste(input("paste: ", "")) - -" sugar -nmap ec - -"" visual shell -vmap m'y:call Bridge_paste(getreg('"'))v`' -vmap ee :call Bridge_paste(input("paste: ", "")) -vmap et - - diff --git a/Cancer/git/git-clone-into b/Cancer/git/git-clone-into deleted file mode 100755 index 67e820e6..00000000 --- a/Cancer/git/git-clone-into +++ /dev/null @@ -1,48 +0,0 @@ -#! /bin/sh -# -# usage: git-clone-into repository directory -# -set -euf - -tempdir() { - set -- `tempnam $1` - mkdir $1 - echo $1 -} - -## [prefix] -> tempnam -tempnam() { - until set -- $1 ${1-}`candnam` && ! test -e $2; do :; done - echo $2 -} - -candnam() { - uuidgen 2>/dev/null || date +%s%N -} - - - - tmp_remote=`candnam` - tmp_branch=`candnam` - - subdir=$2 - if test -e $subdir; then - echo 'You are made of stupid!' >&2 - exit 23 - fi - tmpdir=`tempdir /tmp/tempdir-` - #trap "test -d $tmpdir && rm -vfR $tmpdir" EXIT - trap "test -d $tmpdir && rm -fR $tmpdir" EXIT - repository="${1-$repository}" - git clone "$repository" $tmpdir - (cd $tmpdir - subdir="$subdir" git filter-branch --tree-filter ' - if ! test -d $subdir; then - mkdir -p $subdir - git ls-tree -z --name-only $GIT_COMMIT | xargs -I. --null mv . $subdir - fi - ' - git checkout -b $tmp_branch) - git remote add $tmp_remote $tmpdir - git fetch $tmp_remote - git merge $tmp_remote/$tmp_branch # TODO configurable branch diff --git a/Cancer/git/git-eternal-move b/Cancer/git/git-eternal-move deleted file mode 100755 index 50361e7b..00000000 --- a/Cancer/git/git-eternal-move +++ /dev/null @@ -1,15 +0,0 @@ -#! /bin/sh -# -# git-eternal-move FROM TO-DIRECTORY -# -set -euf -if test $# -ne 2; then - echo 'Error 1: You are made of stupid!' >&2 - exit 23 -fi -exec git filter-branch --tree-filter " - set -euf - if test -e '$1'; then - mkdir -p '$2' - mv '$1' '$2' - fi" diff --git a/Cancer/ircbot/bot.py b/Cancer/ircbot/bot.py deleted file mode 100755 index 25a1014f..00000000 --- a/Cancer/ircbot/bot.py +++ /dev/null @@ -1,81 +0,0 @@ -#!/usr/bin/python -import irc.bot -import feedparser -import _thread -import math -from time import sleep - -class TestBot(irc.bot.SingleServerIRCBot): - def __init__(self, rss, name, server='10.243.231.66', port=6667, chan='#news', timeout=60): - irc.bot.SingleServerIRCBot.__init__(self, [(server, port)], name, name) - self.url = rss - self.feed = feedparser.parse(self.url) - self.name = name - self.server = server - self.port = port - self.chan = chan - self.to = timeout - self.oldnews = [] - self.sendqueue = [] - for entry in self.feed.entries: - try: - self.sendqueue.append(entry.title + " " + entry.link + " com: " + entry.comments) - except AttributeError: - self.sendqueue.append(entry.title + " " + entry.link) - - self.oldnews.append(entry.link) - - def start(self): - self.upd_thread = _thread.start_new_thread(self.updateloop, ()) - self.bot = _thread.start_new_thread(irc.bot.SingleServerIRCBot.start, (self,)) - - - def updateloop(self): - while True: - sleep(self.to) - self.feed = feedparser.parse(self.url) - for entry in self.feed.entries: - if not entry.link in self.oldnews: - try: - self.send(entry.title + " " + entry.link + " com: " + entry.comments) - except AttributeError: - self.send(entry.title + " " + entry.link) - self.oldnews.append(entry.link) - - def sendall(self): - while len(self.sendqueue) > 0: - sleep(1) - self.send(self.sendqueue.pop()) - - def send(self, string): - if len(string) < 450: - self.connection.privmsg(self.chan, string) - else: - space = 0 - for x in range(math.ceil(len(string)/400)): - oldspace = space - space = string.find(" ", (x+1)*400, (x+1)*400+50) - self.connection.privmsg(self.chan, string[oldspace:space]) - sleep(1) - - - def on_welcome(self, connection, event): - connection.join(self.chan) - -# def on_privmsg(self, connection, event): -# print event.source().split('!')[0], event.arguments() - -F = open("feeds", "r") -lines = F.readlines() -F.close() - -botarray = [] -for line in lines: - lineArray = line.split('|') - bot = TestBot(lineArray[1], lineArray[0]) - #bot.start() - botarray.append(bot) - -def startall(): - for bot in botarray: - bot.start() diff --git a/Cancer/ircbot/feeds b/Cancer/ircbot/feeds deleted file mode 100644 index 50fe0667..00000000 --- a/Cancer/ircbot/feeds +++ /dev/null @@ -1,2 +0,0 @@ -HN|http://news.ycombinator.com/rss -Fefe|http://blog.fefe.de/rss.xml diff --git a/Cancer/minikrebs b/Cancer/minikrebs deleted file mode 160000 index fa0c14a2..00000000 --- a/Cancer/minikrebs +++ /dev/null @@ -1 +0,0 @@ -Subproject commit fa0c14a2c221da6e1f2f04c75fe8ed6bff858a61 diff --git a/Cancer/query/jquery/index b/Cancer/query/jquery/index deleted file mode 100755 index 3c49dac9..00000000 --- a/Cancer/query/jquery/index +++ /dev/null @@ -1,19 +0,0 @@ -#! /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/Cancer/query/realpath/install b/Cancer/query/realpath/install deleted file mode 100755 index 74671c81..00000000 --- a/Cancer/query/realpath/install +++ /dev/null @@ -1,41 +0,0 @@ -#! /bin/sh -set -euf - -cd `dirname $0` - -target=../../bin/realpath - -findexe() { - OLDIFS="$IFS" - IFS=: - for d in $PATH; do - f="$d/$1" - if test -f "$f" -a -x "$f"; then - echo $f - IFS="$OLDIFS" - return - fi - done - IFS="$OLDIFS" - ! : -} - -if exe="`findexe readlink`" && $exe -f install | grep -q /install$; then - ! test -e $target || rm $target - cat > $target <&2 - exit -fi - -if type ruby 1>/dev/null 2>/dev/null; then - ln -snf ../query/realpath/src/realpath.rb $target - echo '//query/realpath: install realpath.rb' >&2 - exit -fi - -echo 'Error 2: your system is made of stupid!' -exit 23 diff --git a/Cancer/query/realpath/src/realpath.rb b/Cancer/query/realpath/src/realpath.rb deleted file mode 100755 index 8e19785b..00000000 --- a/Cancer/query/realpath/src/realpath.rb +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env ruby - -begin - $stdout.print File.realpath(ARGV[0]) - $stdout.print "\n" -rescue Exception => err - $stderr.print err - $stderr.print "\n" - exit 1 -end diff --git a/Cancer/webchat/Makefile b/Cancer/webchat/Makefile deleted file mode 100644 index d661ae30..00000000 --- a/Cancer/webchat/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -server.key: - openssl genrsa -des3 -out server.key 2048 -server_npw.key: server.key - openssl rsa -in server.key -out server_npw.key -server.csr: server_npw.key - openssl req -new -key server_npw.key -out server.csr -server.crt: server.csr server_npw.ley - openssl x509 -req -days 365 -in server.csr -signkey server_npw.key -out server.crt diff --git a/Cancer/webchat/index.js b/Cancer/webchat/index.js deleted file mode 100644 index 9569fc80..00000000 --- a/Cancer/webchat/index.js +++ /dev/null @@ -1,172 +0,0 @@ -'use strict'; -var fs = require('fs'); -var http = require('https'); -var sockjs = require('sockjs'); -var connect = require('connect'); -var irc = require('irc'); -var make_sockjs_server_connection_transport = require('./sockjs_server_connection_transport.js') -var RPC = require('./public/rpc.js'); -var irc_nicks = [] - -function pluck (key) { - return function (object) { - return object[key] - } -} - -var clients = []; -clients.broadcast = function (method, params) { - clients.map(pluck('rpc')).forEach(function (rpc) { - rpc.send(method, params) - }) -} - -var irc_reconnect = function() { //reconnt to irc - console.log("would reconnect now") -// irc_client.disconnect() -// irc_client.connect() -} - -var pingTimeoutDelay = 3*60*1000 -var lastping = setTimeout(irc_reconnect, pingTimeoutDelay) - -var irc_client = new irc.Client('irc.freenode.net', 'kweb', { //create irc_client to talk to irc - channels: ['#krebs'], //todo: read from local_config - sasl: true, - secure: true, - userName: 'kweb', //todo: read from local_config - realName: 'kweb', //todo: read from local_config - password: fs.readFileSync(__dirname+'/local_config/irc.key').toString(), - debug: true, - showErrors: true, - floodProtection: true, - port: 6697, - autoRejoin: true, - autoConnect: true, - stripColors: true -}); - -irc_client.on('ping', function(server) { //restart timer on server ping - console.log("got ping from server, renewing timeout for automatic reconnect"); - clearTimeout(lastping); - lastping = setTimeout(irc_reconnect, pingTimeoutDelay); //reconnect after irc timeout -}) - -irc_client.on('message#krebs', function(from, message) { - console.log({ from: from, message: message }); - clients.broadcast('msg', {nick: from, msg: message}) - clearTimeout(lastping); -}); - -irc_client.on('names#krebs', function(nicks) { - Object.keys(nicks).forEach(function (nick) { - irc_nicks.push(nick) - clients.broadcast('join', {type: 'irc', nick: nick}) - }) -}) - -irc_client.on('join#krebs', function(nick, msg) { - if (nick !== 'kweb'){ - irc_nicks.push(nick) - clients.broadcast('join', {type: 'irc', nick: nick}) - } -}) - -irc_client.on('part#krebs', function(nick, rs, msg) { - clients.broadcast('part', {type: 'irc', nick: nick}) -}); - -irc_client.on('error', function (error) { - irc_nicks.forEach( function(nick) { - client.rpc.send('part', {type: 'irc', nick: nick}) - irc_nicks.splice(irc_nicks.indexOf(nick)) - }) - console.log('irc-client error', error) -}) - -var echo = sockjs.createServer(); - -var total_clients_ever_connected = 0 - -echo.on('connection', function (connection) { - var client = {} - client.rpc = new RPC(make_sockjs_server_connection_transport(connection)) - client.nick = 'anon'+(++total_clients_ever_connected) - client.rpc.send('your_nick', {nick: client.nick}) - client.rpc.register('msg', {msg: 'string'}, function (params, callback) { - callback(null) - clients.broadcast('msg', {type: 'web', nick: client.nick, msg: params.msg}) - irc_client.say('#krebs', client.nick + ' → ' + params.msg) - }) - client.rpc.register('nick', {nick: 'string'}, function (params, callback) { - if (!!~clients.map(pluck('nick')).indexOf(params.nick)) { - callback('name already taken') - } else if (/^anon[0-9]+$/.test(params.nick)) { - callback('bad nick') - } else { - var oldnick = client.nick - client.nick = params.nick - callback(null) - clients.broadcast('nick', {type: 'web', newnick: client.nick, oldnick: oldnick}) - irc_client.say('#krebs', oldnick + ' is now known as ' + client.nick) - } - }) - connection.on('close', function() { //propagate if client quits the page - clients.splice(clients.indexOf(client)); - clients.broadcast('part', {type: 'web', nick: client.nick}) - irc_client.say('#krebs', client.nick + ' has parted') - }) - //send the irc nicklist to the new joined client - irc_nicks.forEach( function(nick) { - client.rpc.send('join', {type: 'irc', nick: nick}) - }) - //send nicklist to newly joined client - clients.map(pluck('nick')).forEach(function (nick) { - client.rpc.send('join', {type: 'web', nick: nick}) - }) - //add new client to list - clients.push(client) - //send all including the new client the join - clients.broadcast('join', {type: 'web', nick: client.nick}) - //send join to irc - irc_client.say('#krebs', client.nick + ' has joined') -}) - -var app = connect() - .use(connect.logger('dev')) - .use(connect.static(__dirname+'/public')) - .use( function (req, res) { - res.writeHead(200, {'Content-Type': 'text/html'}); - var page_template='\n'; - page_template+='\n'; - page_template+='\n'; - page_template+='\n'; - page_template+='\n'; - page_template+='\n'; - page_template+='\n'; - page_template+='\n'; - page_template+='\n'; - page_template+='
'; - page_template+='
'; - page_template+='
'; - page_template+='hello, this is the official krebs support:
\n'; - page_template+='
\n'; - page_template+='
'; - page_template+='
'; - page_template+='
'; - res.end(page_template); - - }) - -var web_serv_options = { //certificates for https - key: fs.readFileSync(__dirname+'/local_config/server_npw.key'), - cert: fs.readFileSync(__dirname+'/local_config/server.crt'), -}; -var server = http.createServer(web_serv_options, app); -echo.installHandlers(server, {prefix:'/echo'}); -server.listen(1337, '0.0.0.0'); -console.log('Server running at https://127.0.0.1:1337/'); diff --git a/Cancer/webchat/package.json b/Cancer/webchat/package.json deleted file mode 100644 index 1a9ad47d..00000000 --- a/Cancer/webchat/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "krebs-webbot", - "version": "0.0.1", - "dependencies": { - "connect": "2.11.0", - "irc": "0.3.6", - "sockjs": "0.3.8", - "redis": "0.9.0" - }, - "scripts": { - "test": "tap test/*.js" - }, - "author": "lassulus", - "license": "WTFPL" -} diff --git a/Cancer/webchat/proto_spec b/Cancer/webchat/proto_spec deleted file mode 100644 index fffce165..00000000 --- a/Cancer/webchat/proto_spec +++ /dev/null @@ -1,62 +0,0 @@ -server -> client: -#old -type: 'message' | 'join' | 'quit' | 'nicklist' | 'nickchange' | 'usererror' -nick: the clients nickname ('message','nickchange') -newnick: new nick after nickchange ('nickchange') -from: the clients ip ('message','quit','join') -message: the data send ('message', 'nicklist','usererror' - - -#new -type: 'irc_msg' | 'irc_join' | 'irc_quit' | 'irc_nickchange' | 'irc_client_connect' | 'irc_client_disconnect' | 'web_welcome' |'web_msg' | 'web_join' | 'web_quit' | 'web_nickchange' | 'usererror' -params:{ nick:, oldnick:, nicklist:, msg:, errormsg: } - -'irc_msg': nick, msg -'irc_join': nick -'irc_quit': nick -'irc_nickchange': oldnick, nick -'kweb_irc_connect': nicklist -'kweb_irc_disconnect': -- -'web_welcome': msg, nicklist, nick -'web_msg': nick, msg -'web_join': nick -'web_quit': nick -'web_nickchange': oldnick, nick -'usererror': msg - - -client -> server -#old -method: 'say', 'nick' -params:{ msg:, nick: } - -'say': msg -'nick': nick - - -##############JSON RPC################ -server->client: -{method: 'say', params: {msg: msg}, id: id} --> {result: {ok: ok}, error {error muted?}, id: id} - -{method: 'nick', params: {nick: nick}, id: id} --> {result: {nick: nick}, error: {error name taken?/reserved/not allowed}, id: id} - - -client->server: -broadcast: - {method: 'irc_msg', params: {nick: nick, msg: msg}, id: 0} #notification - {method: 'irc_join', params: {nick: nick}, id: 0} #notification - {method: 'irc_quit', params: {nick: nick}, id: 0} #notification - {method: 'irc_nickchange', params: {nick: nick, oldnick: oldnick}, id: 0} #notification - {method: 'kweb_irc_connect', params: {nicklist: nicklist}, id: 0} #notification - {method: 'kweb_irc_disconnect', params: {}, id: 0} #notification - {method: 'web_msg', params: {nick: nick, msg: msg}, id: 0} #notification - {method: 'web_join', params: {nick: nick}, id: 0} #notification - {method: 'web_quit', params: {nick: nick}, id: 0} #notification - {method: 'web_nickchange', params: {nick: nick, oldnick: oldnick}, id: 0} #notification - -unicast: - {method: 'coi', params: {}, id: id} - -> {result: {result: {nick: nick, addr: addr}, error: {connection error?}, id: id} - {method: 'usererror', params: {msg: 'error type'}, id: 0} #notification diff --git a/Cancer/webchat/public/client.js b/Cancer/webchat/public/client.js deleted file mode 100644 index 54ccfe34..00000000 --- a/Cancer/webchat/public/client.js +++ /dev/null @@ -1,70 +0,0 @@ -var settings = {} -settings.sock = new SockJS('/echo'); -settings.waiting_callbacks = {} - -var transport = make_sockjs_client_transport(settings.sock) -settings.rpc = new RPC(transport) - -settings.rpc.register('msg', {type: 'string', nick: 'string', msg: 'string'}, function(params, callback) { - var safe_message = $('
').text(params.msg).html(); - safe_message = replaceURLWithHTMLLinks(safe_message); - var safe_from = $('
').text(params.nick).html(); - chatboxAppend(safe_from, safe_message, 'web_msg') - return callback(null) -}) -settings.rpc.register('nick', {type: 'string', newnick: 'string', oldnick: 'string'}, function(params, callback) { - var safe_oldnick = $('
').text(params.oldnick).html(); - var safe_newnick = $('
').text(params.newnick).html(); - var safe_type = $('
').text(params.type).html(); - if (safe_oldnick === settings.nick){ - settings.nick = safe_newnick - $('#nick').html(settings.nick) - } - $(getNicklistElement(safe_oldnick,safe_type)).remove(); - $('#nicklist').append('
' + safe_newnick + '
') ; - chatboxAppend(safe_oldnick, 'is now known as ' + safe_newnick, 'nick'); - return callback(null) -}) -settings.rpc.register('your_nick', {nick: 'string'}, function(params, callback) { - var safe_nick = $('
').text(params.nick).html(); - settings.nick = safe_nick - $('#nick').html(settings.nick) - return callback(null) -}) -settings.rpc.register('join', {type: 'string', nick: 'string'}, function(params, callback) { - var safe_nick = $('
').text(params.nick).html(); - var safe_type = $('
').text(params.type).html(); - $('#nicklist').append('
' + safe_nick + '
') ; - chatboxAppend(safe_nick, 'has joined'); - return callback(null) -}) -settings.rpc.register('part', {type: 'string', nick: 'string'}, function(params, callback) { - var safe_nick = $('
').text(params.nick).html(); - var safe_type = $('
').text(params.type).html(); - $(getNicklistElement(safe_nick,safe_type)).remove(); - chatboxAppend(safe_nick, 'has parted'); - return callback(null) -}) - -$(function updateTime () { - $('#time').html(getCurTime()); - setTimeout(updateTime,'1000'); - return true; -}); - - -$(function() { - $('#input').keydown(function(e) { - if (e.keyCode === 13) { - e.preventDefault(); - e.stopPropagation(); - e.stopImmediatePropagation(); - var input = ($('#input').val()); - $('#input').val('') - - var command = inputParser(input) - return (commands[command.method] || commands.badcommand)(settings, command.params) - } - }); - -}); diff --git a/Cancer/webchat/public/functions.js b/Cancer/webchat/public/functions.js deleted file mode 100644 index 781fafce..00000000 --- a/Cancer/webchat/public/functions.js +++ /dev/null @@ -1,54 +0,0 @@ -function inputParser (str) { - var match = /^\/([a-z]+)(?:\s+(.*\S))?\s*$/.exec(str) - if (match) { - return { method: match[1], params: match[2] } - } else { - return { method: 'msg', params: str } - } -} - -function replaceURLWithHTMLLinks (text) { - var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig; - return text.replace(exp,"$1"); -} - -function getNicklistElement(name, type) { - var el; - $('.'+type+'_name').each(function (i,e) { - if (e.innerHTML === name) { - if (typeof el !== 'undefined') { - throw new Error('duplicate name: ' + name); - }; - el = e; - }; - }); - return el; -} - -function chatboxAppend (chat_from, chat_msg, type) { - type = type||'msg' - $(''+getCurTime()+''+chat_from+''+chat_msg+'').insertBefore('#foot'); - - var elem = document.getElementById('chatter'); - elem.scrollTop = elem.scrollHeight; -}; - -function getCurTime () { - date = new Date; - h = date.getHours(); - if(h<10) - { - h = "0"+h; - } - m = date.getMinutes(); - if(m<10) - { - m = "0"+m; - } - s = date.getSeconds(); - if(s<10) - { - s = "0"+s; - } - return ''+h+':'+m+':'+s; -}; diff --git a/Cancer/webchat/public/jquery-2.0.3.min.js b/Cancer/webchat/public/jquery-2.0.3.min.js deleted file mode 100644 index 2be209dd..00000000 --- a/Cancer/webchat/public/jquery-2.0.3.min.js +++ /dev/null @@ -1,6 +0,0 @@ -/*! jQuery v2.0.3 | (c) 2005, 2013 jQuery Foundation, Inc. | jquery.org/license -//@ sourceMappingURL=jquery-2.0.3.min.map -*/ -(function(e,undefined){var t,n,r=typeof undefined,i=e.location,o=e.document,s=o.documentElement,a=e.jQuery,u=e.$,l={},c=[],p="2.0.3",f=c.concat,h=c.push,d=c.slice,g=c.indexOf,m=l.toString,y=l.hasOwnProperty,v=p.trim,x=function(e,n){return new x.fn.init(e,n,t)},b=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,w=/\S+/g,T=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,C=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,k=/^-ms-/,N=/-([\da-z])/gi,E=function(e,t){return t.toUpperCase()},S=function(){o.removeEventListener("DOMContentLoaded",S,!1),e.removeEventListener("load",S,!1),x.ready()};x.fn=x.prototype={jquery:p,constructor:x,init:function(e,t,n){var r,i;if(!e)return this;if("string"==typeof e){if(r="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:T.exec(e),!r||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof x?t[0]:t,x.merge(this,x.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:o,!0)),C.test(r[1])&&x.isPlainObject(t))for(r in t)x.isFunction(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return i=o.getElementById(r[2]),i&&i.parentNode&&(this.length=1,this[0]=i),this.context=o,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):x.isFunction(e)?n.ready(e):(e.selector!==undefined&&(this.selector=e.selector,this.context=e.context),x.makeArray(e,this))},selector:"",length:0,toArray:function(){return d.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=x.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return x.each(this,e,t)},ready:function(e){return x.ready.promise().done(e),this},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(x.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:h,sort:[].sort,splice:[].splice},x.fn.init.prototype=x.fn,x.extend=x.fn.extend=function(){var e,t,n,r,i,o,s=arguments[0]||{},a=1,u=arguments.length,l=!1;for("boolean"==typeof s&&(l=s,s=arguments[1]||{},a=2),"object"==typeof s||x.isFunction(s)||(s={}),u===a&&(s=this,--a);u>a;a++)if(null!=(e=arguments[a]))for(t in e)n=s[t],r=e[t],s!==r&&(l&&r&&(x.isPlainObject(r)||(i=x.isArray(r)))?(i?(i=!1,o=n&&x.isArray(n)?n:[]):o=n&&x.isPlainObject(n)?n:{},s[t]=x.extend(l,o,r)):r!==undefined&&(s[t]=r));return s},x.extend({expando:"jQuery"+(p+Math.random()).replace(/\D/g,""),noConflict:function(t){return e.$===x&&(e.$=u),t&&e.jQuery===x&&(e.jQuery=a),x},isReady:!1,readyWait:1,holdReady:function(e){e?x.readyWait++:x.ready(!0)},ready:function(e){(e===!0?--x.readyWait:x.isReady)||(x.isReady=!0,e!==!0&&--x.readyWait>0||(n.resolveWith(o,[x]),x.fn.trigger&&x(o).trigger("ready").off("ready")))},isFunction:function(e){return"function"===x.type(e)},isArray:Array.isArray,isWindow:function(e){return null!=e&&e===e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[m.call(e)]||"object":typeof e},isPlainObject:function(e){if("object"!==x.type(e)||e.nodeType||x.isWindow(e))return!1;try{if(e.constructor&&!y.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(t){return!1}return!0},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||o;var r=C.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=x.buildFragment([e],t,i),i&&x(i).remove(),x.merge([],r.childNodes))},parseJSON:JSON.parse,parseXML:function(e){var t,n;if(!e||"string"!=t