From adbcd7318331f8c2d4bff87ebb0594586c35f55d Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 29 Dec 2013 21:09:04 +0100 Subject: ship build: add #@mainifyme [NAME] directive If NAME is not provided, then "main" will be used. --- ship/build | 12 ++++++++++++ ship/src/remaster_arch_iso | 1 + 2 files changed, 13 insertions(+) diff --git a/ship/build b/ship/build index f7dcf3c2..3f96cfe1 100755 --- a/ship/build +++ b/ship/build @@ -59,6 +59,18 @@ $1a\\ EOF } +## usage: #@mainifyme\( \([A-Za-z_][A-Za-z0-9_]*\)\)\? -> build_mainifyme \1 \3 +build_mainifyme() { + mainifyme_name="${2:-main}" + cat< Date: Mon, 30 Dec 2013 02:56:54 +0100 Subject: krebs: moved crypto to Cancer --- Cancer/crypto/bin/ukrepl | 109 +++++++++++++++++++++++++++++++++++++ Cancer/crypto/git/git-eternal-move | 15 +++++ crypto/bin/ukrepl | 109 ------------------------------------- crypto/git/git-eternal-move | 15 ----- 4 files changed, 124 insertions(+), 124 deletions(-) create mode 100755 Cancer/crypto/bin/ukrepl create mode 100755 Cancer/crypto/git/git-eternal-move delete mode 100755 crypto/bin/ukrepl delete mode 100755 crypto/git/git-eternal-move diff --git a/Cancer/crypto/bin/ukrepl b/Cancer/crypto/bin/ukrepl new file mode 100755 index 00000000..9b084027 --- /dev/null +++ b/Cancer/crypto/bin/ukrepl @@ -0,0 +1,109 @@ +#!/usr/bin/python2 +# -*- coding: utf-8 -*- +import sys + +wont_change = { ' ' : ' ' , + '\n' : '\n' + } +def fixed_width_replace(char): #f + if char in wont_change: return unicode(char) + else: + try: + if not 32 < ord(char) < 126: raise Exception("not in range") + return unichr(0xFF00 + ord(char)-32) + except: + return char + +cyrillic_dict = { + 'A' : u'А', 'a' : 'а','Ä' : u'Ӓ', 'ä' : u'ӓ', + 'B' : u'В', + 'c' : u'с', + 'E' : u'Е', + 'e' : u'е', + 'H' : u'Н', + 'I' : u'І', 'i' : u'і', + 'j' : u'ј','J' : u'Ј', + 'K' : u'К', + 'M' : u'М', + 'O' : u'О', 'o' : u'о', 'Ö' : u'Ӧ', 'ö' : u'ӧ', + 'P' : u'Р', 'p' : u'р', + 'S' : u'Ѕ', + 'T' : u'г' + } + +def cyrillic_replace(char): #c + return cyrillic_dict.get(char,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,char) +punctuation_dict = { + '!' : u'ǃ', + '\'': u'’', + '\"': u'ˮ', + '(' : u'⟨', + ')' : u'⟩', + ':' : u'ː', + ' ' : u' ', + # all different spaces, made for perfect trolling + #' ' : u' ', + #' ' : u' ', + #' ' : u'⁠', + #'-' : u'‒', + #'-' : u'—', + #'-' : u'―', + #'-' : u'‐', + #'-' : u'⁃', + '-' : u'–', + '_' : u'−', + '~' : u'⁓', + #'~' : u'∼', + #'~' : u'〜', + + } +def punctuation(char): #p + return punctuation_dict.get(char,char) +def helpme(): + print "usage %s [modes]" % sys.argv[0] + 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) + +#parsing happens inside the nested loop +modes = ''.join(sys.argv[1:]) +# sane defaults if no mode given +if not modes : modes = "f" + +if 'h' in modes: helpme() + +for line in sys.stdin: + for char in line: + for mode in modes: + if mode is 'c': + 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() + try: + sys.stdout.write(char) + except: + sys.stdout.write(char.encode("utf-8")) diff --git a/Cancer/crypto/git/git-eternal-move b/Cancer/crypto/git/git-eternal-move new file mode 100755 index 00000000..50361e7b --- /dev/null +++ b/Cancer/crypto/git/git-eternal-move @@ -0,0 +1,15 @@ +#! /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/crypto/bin/ukrepl b/crypto/bin/ukrepl deleted file mode 100755 index 9b084027..00000000 --- a/crypto/bin/ukrepl +++ /dev/null @@ -1,109 +0,0 @@ -#!/usr/bin/python2 -# -*- coding: utf-8 -*- -import sys - -wont_change = { ' ' : ' ' , - '\n' : '\n' - } -def fixed_width_replace(char): #f - if char in wont_change: return unicode(char) - else: - try: - if not 32 < ord(char) < 126: raise Exception("not in range") - return unichr(0xFF00 + ord(char)-32) - except: - return char - -cyrillic_dict = { - 'A' : u'А', 'a' : 'а','Ä' : u'Ӓ', 'ä' : u'ӓ', - 'B' : u'В', - 'c' : u'с', - 'E' : u'Е', - 'e' : u'е', - 'H' : u'Н', - 'I' : u'І', 'i' : u'і', - 'j' : u'ј','J' : u'Ј', - 'K' : u'К', - 'M' : u'М', - 'O' : u'О', 'o' : u'о', 'Ö' : u'Ӧ', 'ö' : u'ӧ', - 'P' : u'Р', 'p' : u'р', - 'S' : u'Ѕ', - 'T' : u'г' - } - -def cyrillic_replace(char): #c - return cyrillic_dict.get(char,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,char) -punctuation_dict = { - '!' : u'ǃ', - '\'': u'’', - '\"': u'ˮ', - '(' : u'⟨', - ')' : u'⟩', - ':' : u'ː', - ' ' : u' ', - # all different spaces, made for perfect trolling - #' ' : u' ', - #' ' : u' ', - #' ' : u'⁠', - #'-' : u'‒', - #'-' : u'—', - #'-' : u'―', - #'-' : u'‐', - #'-' : u'⁃', - '-' : u'–', - '_' : u'−', - '~' : u'⁓', - #'~' : u'∼', - #'~' : u'〜', - - } -def punctuation(char): #p - return punctuation_dict.get(char,char) -def helpme(): - print "usage %s [modes]" % sys.argv[0] - 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) - -#parsing happens inside the nested loop -modes = ''.join(sys.argv[1:]) -# sane defaults if no mode given -if not modes : modes = "f" - -if 'h' in modes: helpme() - -for line in sys.stdin: - for char in line: - for mode in modes: - if mode is 'c': - 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() - try: - sys.stdout.write(char) - except: - sys.stdout.write(char.encode("utf-8")) diff --git a/crypto/git/git-eternal-move b/crypto/git/git-eternal-move deleted file mode 100755 index 50361e7b..00000000 --- a/crypto/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" -- cgit v1.2.3