From 7d3d099f8de3891e897112906d47cd8428d27122 Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 22 Sep 2011 23:02:57 +0200 Subject: ukrepl: chain modes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ukrepl is able to chain modes e.g. echo "aidsballs" | ./ukrepl cf => а і d s b а l l s --- crypto/bin/ukrepl | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/crypto/bin/ukrepl b/crypto/bin/ukrepl index 21aa4d84..867f1858 100755 --- a/crypto/bin/ukrepl +++ b/crypto/bin/ukrepl @@ -6,12 +6,13 @@ wont_change = { ' ' : ' ' , } fixed_active = False def fixed_width_replace(char): - if char in wont_change: print char, + if char in wont_change: return unicode(char) else: try: - print unichr(0xFF00 + ord(char)-32), + if not 32 < ord(char) < 126: raise Exception("not in range") + return unichr(0xFF00 + ord(char)-32) except: - print char, + return char cyr_active = False cyrillic_dict = { @@ -32,7 +33,7 @@ cyrillic_dict = { } def cyrillic_replace(char): - print cyrillic_dict.get(char,char), + return cyrillic_dict.get(char,unicode(char)) def helpme(): print "usage %s [modes]" % sys.argv[0] @@ -49,14 +50,14 @@ if not modes : modes = "f" if 'h' in modes: helpme() -for mode in modes: - for line in sys.stdin: - for char in line: +for line in sys.stdin: + for char in line: + for mode in modes: if mode is 'c': - cyrillic_replace(char) + char = cyrillic_replace(char) elif mode is 'f': - fixed_width_replace(char) + char = fixed_width_replace(char) else: print "unknown mode %c" % mode helpme() - + print char, -- cgit v1.2.3 From cc74c033c19db59069f9bb5e12670e9916eadcf9 Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 23 Sep 2011 12:01:21 +0200 Subject: ukrepl: add punctuation mode --- crypto/bin/ukrepl | 44 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 40 insertions(+), 4 deletions(-) diff --git a/crypto/bin/ukrepl b/crypto/bin/ukrepl index 867f1858..f40e93ea 100755 --- a/crypto/bin/ukrepl +++ b/crypto/bin/ukrepl @@ -1,11 +1,11 @@ #!/usr/bin/python # -*- coding: utf-8 -*- import sys + wont_change = { ' ' : ' ' , '\n' : '\n' } -fixed_active = False -def fixed_width_replace(char): +def fixed_width_replace(char): #f if char in wont_change: return unicode(char) else: try: @@ -14,7 +14,6 @@ def fixed_width_replace(char): except: return char -cyr_active = False cyrillic_dict = { 'A' : u'А', 'a' : 'а','Ä' : u'Ӓ', 'ä' : u'ӓ', 'B' : u'В', @@ -32,9 +31,42 @@ cyrillic_dict = { 'T' : u'г' } -def cyrillic_replace(char): +def cyrillic_replace(char): #c return cyrillic_dict.get(char,unicode(char)) +historic_latin_dict = { + 'B' : u'Ɓ', + 'b' : u'ƅ', + 'u' : u'ư', + 'U' : u'Ư', + '' : 'Ǟ', + #'5' : 'ƽ', + 'o' : 'ơ', + 'O' : 'Ơ', + '5' : 'Ƽ' + } +def historic_latin(char): #H + return historic_latin_dict.get(char,unicode(char)) +punctuation_dict = { + '!' : u'ǃ', + '\'': u'’', + '\"': u'ˮ', + '(' : u'⟨', + ')' : u'⟩', + ':' : u'ː', + #'-' : u'‒', + #'-' : u'—', + #'-' : u'―', + #'-' : u'‐', + #'-' : u'⁃', + '-' : u'–', + '_' : u'−', + '~' : u'⁓', + #'~' : u'∼', + #'~' : u'〜', + } +def punctuation(char): #p + return punctuation_dict.get(char,unicode(char)) def helpme(): print "usage %s [modes]" % sys.argv[0] print "modes:" @@ -57,6 +89,10 @@ for line in sys.stdin: char = cyrillic_replace(char) elif mode is 'f': char = fixed_width_replace(char) + elif mode is 'H': + char = historic_latin(char) + elif mode is 'p': + char = punctuation(char) else: print "unknown mode %c" % mode helpme() -- cgit v1.2.3 From 77ba054b1e3a55a54f4643bc544e7c3550006a00 Mon Sep 17 00:00:00 2001 From: momo Date: Fri, 23 Sep 2011 17:26:45 +0200 Subject: //god/licht: minor code improvements --- god/licht | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/god/licht b/god/licht index cbff9ad0..cd67d338 100755 --- a/god/licht +++ b/god/licht @@ -13,9 +13,11 @@ # ghetto - toggles the lights in the hallway # 0-7 - toggles individual lights +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'` + #TOGGLE=`echo "$2" | sed -n '/^[0-1]/p'` if ! [ "$LAMPE" -a "$TOGGLE" ];then echo "you are made of stupid" exit 1 @@ -76,38 +78,30 @@ case "$1" in 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 ;; *) -- cgit v1.2.3 From 41c07676d37dff4a46ca5e18aaa05fbe970acb63 Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 23 Sep 2011 17:41:40 +0200 Subject: ukrepl: add new modes to help message punctuation and historic latin are now part of the help message --- crypto/bin/ukrepl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crypto/bin/ukrepl b/crypto/bin/ukrepl index f40e93ea..b3b25db9 100755 --- a/crypto/bin/ukrepl +++ b/crypto/bin/ukrepl @@ -72,6 +72,8 @@ def helpme(): print "modes:" print " c -- cyrillic replace" print " f -- fixed width" + print " p -- replace punctuation" + print " H -- replace with historic latin chars" print " h -- this message" sys.exit(0) -- cgit v1.2.3 From 41619778f2a32c9c78422a0bd7b15209bc13f68a Mon Sep 17 00:00:00 2001 From: momo Date: Fri, 23 Sep 2011 21:20:14 +0200 Subject: //util/bin/untouch: initial commit --- util/bin/untouch | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100755 util/bin/untouch diff --git a/util/bin/untouch b/util/bin/untouch new file mode 100755 index 00000000..17fd46b8 --- /dev/null +++ b/util/bin/untouch @@ -0,0 +1,8 @@ +#!/bin/sh +# +#This script toggles the touchpad on a netbook using synclient. + +status=`synclient|awk '/TouchpadOff/{printf$3}'` +status=`expr \( $status + 1 \) \% 2` +synclient TouchpadOff=$status + -- cgit v1.2.3 From d28df2570e5e30da5f6b3d619da1a30cf5f1f6ca Mon Sep 17 00:00:00 2001 From: momo Date: Sat, 24 Sep 2011 01:06:00 +0200 Subject: //streams/strams.db: add RFK to db --- streams/stream.db | 1 + 1 file changed, 1 insertion(+) diff --git a/streams/stream.db b/streams/stream.db index 47ccf7b5..29949980 100644 --- a/streams/stream.db +++ b/streams/stream.db @@ -7,3 +7,4 @@ http://localhost:8000/stream.ogg icecast http://stream2.jungletrain.net:8000 jungletrain http://playlist.tormentedradio.com/tormentedradio.pls tormented http://filebitch.shack:8000 mpd +http://radio.krautchan.net:8000/radio.mp3 radiofreieskrautchan -- cgit v1.2.3 From 67cbf3751c594aea88a71e350259943370b51b5f Mon Sep 17 00:00:00 2001 From: root Date: Sat, 24 Sep 2011 19:12:23 +0200 Subject: //god/licht: add long help for noise --- god/licht | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/god/licht b/god/licht index cd67d338..9284f622 100755 --- a/god/licht +++ b/god/licht @@ -14,18 +14,39 @@ # 0-7 - toggles individual lights TOGGLE=`echo "$2" | sed -n '/^[0-1]/p'` +shorthelp() { + echo "Usage: $0 [OPTIONS] [0|1]" + echo "Toggle the lights in the shack." +} +longhelp(){ + shorthelp + +cat < <0/1>" + longhelp + exit 1 else echo "Toggle light $LAMPE ($TOGGLE)" printf "$STRING" | nc -u -w1 licht.shack 1337 @@ -73,9 +94,11 @@ porsche(){ } case "$1" in - --help) - echo "Toggle the lights" - echo "Usage: lich <0/1>" + (--help) + if [ "$2" == "--verbose" ] + then longhelp + else shorthelp + fi ;; all) toggle_all -- cgit v1.2.3 From 702389e0c0c22c657c4c0e40c7403dc8366c8cff Mon Sep 17 00:00:00 2001 From: momo Date: Sat, 24 Sep 2011 19:21:20 +0200 Subject: //util/bin/untouch: rename to TouchpadToggle --- util/bin/TouchpadToggle | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100755 util/bin/TouchpadToggle diff --git a/util/bin/TouchpadToggle b/util/bin/TouchpadToggle new file mode 100755 index 00000000..17fd46b8 --- /dev/null +++ b/util/bin/TouchpadToggle @@ -0,0 +1,8 @@ +#!/bin/sh +# +#This script toggles the touchpad on a netbook using synclient. + +status=`synclient|awk '/TouchpadOff/{printf$3}'` +status=`expr \( $status + 1 \) \% 2` +synclient TouchpadOff=$status + -- cgit v1.2.3 From 53679fedeb1db9d68399638fc44aa4cf4ac5ee1c Mon Sep 17 00:00:00 2001 From: momo Date: Sat, 24 Sep 2011 19:28:07 +0200 Subject: //god/licht: add abstraction for specific toggles --- god/licht | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/god/licht b/god/licht index 9284f622..12e4555f 100755 --- a/god/licht +++ b/god/licht @@ -56,7 +56,7 @@ toggle() { toggle_all() { for i in `seq 0 7` do - printf "\\xA5\\x5A\\x$i\\x$TOGGLE" | nc -u -w1 licht.shack 1337 & + toggle $i $TOGGLE done wait } @@ -64,7 +64,7 @@ toggle_all() { kuschel(){ for i in 0 2 do - printf "\\xA5\\x5A\\x$i\\x$TOGGLE" | nc -u -w1 licht.shack 1337 & + toggle $i $TOGGLE done wait } @@ -72,7 +72,7 @@ kuschel(){ software(){ for i in 1 3 do - printf "\\xA5\\x5A\\x$i\\x$TOGGLE" | nc -u -w1 licht.shack 1337 & + toggle $i $TOGGLE done wait } @@ -80,17 +80,19 @@ software(){ tische(){ for i in 4 6 do - printf "\\xA5\\x5A\\x$i\\x$TOGGLE" | nc -u -w1 licht.shack 1337 & + toggle $i $TOGGLE done wait } ghetto(){ - printf "\\xA5\\x5A\\x7\\x$TOGGLE" | nc -u -w1 licht.shack 1337 + i=7 + toggle $i $TOGGLE } porsche(){ - printf "\\xA5\\x5A\\x5\\x$TOGGLE" | nc -u -w1 licht.shack 1337 + i=5 + toggle $i $TOGGLE } case "$1" in -- cgit v1.2.3