diff options
author | Chinaman <root@chinaman> | 2011-09-06 19:47:58 +0200 |
---|---|---|
committer | Chinaman <root@chinaman> | 2011-09-06 19:47:58 +0200 |
commit | 108f3616e3f4958752d881192ef29e5fc4c2b045 (patch) | |
tree | 3c67478c852265219b72e6e1b05467d7065b7ba8 /util/bin | |
parent | b2d65500160bcdf7abb2bf985f7da582b810e25c (diff) | |
parent | c3bc5a6d16868c121aca780f3109155797b51d76 (diff) |
Merge branch 'master' of github.com:krebscode/painload
Diffstat (limited to 'util/bin')
-rwxr-xr-x | util/bin/galileo | 3 | ||||
-rwxr-xr-x | util/bin/hrefs | 20 | ||||
-rwxr-xr-x | util/bin/naturalvoices.att | 44 | ||||
-rwxr-xr-x | util/bin/wiki.firstpar | 23 | ||||
-rwxr-xr-x | util/bin/wikipedia | 5 |
5 files changed, 95 insertions, 0 deletions
diff --git a/util/bin/galileo b/util/bin/galileo new file mode 100755 index 00000000..854f1302 --- /dev/null +++ b/util/bin/galileo @@ -0,0 +1,3 @@ +#!/bin/sh +export voice=klara +./wiki.firstpar http://de.m.wikipedia.org/wiki/::Random | xargs ./naturalvoices.att diff --git a/util/bin/hrefs b/util/bin/hrefs new file mode 100755 index 00000000..3a1a51de --- /dev/null +++ b/util/bin/hrefs @@ -0,0 +1,20 @@ +#! /bin/sh + +_hrefs() { + sed -n 's/href="\([^"]\+\)"/\n&\n/gp' | + sed -n 's/^href="\([^"]\+\)"$/\1/p'; } + +_add_prefix_to_relative_hrefs() { + sed '/^http:/!s^'"$1"''; } + +_main() { + case $# in + (0) _hrefs;; + (1) _hrefs | _add_prefix_to_relative_hrefs "$1";; + (*) + echo "bad command line: $0 $*" >&2; exit 23;; + esac; } + +set -euf +_main "$@" +#### end of file. diff --git a/util/bin/naturalvoices.att b/util/bin/naturalvoices.att new file mode 100755 index 00000000..9a944d8b --- /dev/null +++ b/util/bin/naturalvoices.att @@ -0,0 +1,44 @@ +#! /bin/sh +set -euf + +A=Mozilla +baseURL="http://192.20.225.36" +url="$baseURL/tts/cgi-bin/nph-talk" + +if test -h "$0"; then + voice="${voice-"`basename "$0"`"}" +fi + +pwd="$(dirname "$(readlink -f "$0")")" + +for x in \ + "$pwd/../../submodules/github/tmpvar" \ + "$pwd/../../submodules/github/mikeal" \ + "$pwd/../../submodules/github/NV" \ + "$pwd/../../submodules/github/tautologistics" \ +; do + export NODE_PATH="`readlink -f "$x"`${NODE_PATH+:$NODE_PATH}" +done + +# ensure query is ready +(cd "$pwd/../.." && git submodule update --init) + +{ + for arg; do echo "$arg"; done | sed -rn ' + s/^--(.*=.*)/\1/p;t + s/.*/text="${text+$text }&"/p;t + ' + cat<<EOF + query() { + node "$(readlink -f "$pwd/../../submodules/github/visionmedia/query")" "\$@" + } + curl -sS -A "\${A-Mozilla}" \\ + -d "voice=\${voice-`basename "$0"`}" \\ + -d "txt=\$text" \\ + -d "downloadButton=DOWNLOAD" \\ + "$url" | + query 'p a' +EOF +} | sh | while read url; do + curl -sS "$baseURL$url" | aplay -q - +done diff --git a/util/bin/wiki.firstpar b/util/bin/wiki.firstpar new file mode 100755 index 00000000..d2181f1b --- /dev/null +++ b/util/bin/wiki.firstpar @@ -0,0 +1,23 @@ +#! /bin/bash +set -euf + +A=Mozilla + +pwd="$(dirname "$(readlink -f "$0")")" + +for x in \ + "$pwd/../../submodules/github/tmpvar" \ + "$pwd/../../submodules/github/mikeal" \ + "$pwd/../../submodules/github/NV" \ + "$pwd/../../submodules/github/tautologistics" \ +; do + export NODE_PATH="`readlink -f "$x"`${NODE_PATH+:$NODE_PATH}" +done + +# ensure query is ready +(cd "$pwd/../.." && git submodule update --init) + +query() { + node "$(readlink -f "$pwd/../../submodules/github/visionmedia/query")" "$@" +} +curl -b redirect=seen -L -e http://de.wikipedia.org/wiki/$RANDOM -sS -A "\${A-Mozilla}" "$1" | query 'p' 'first' |w3m -T text/html -dump| cut -c -750 diff --git a/util/bin/wikipedia b/util/bin/wikipedia new file mode 100755 index 00000000..cad0d8b1 --- /dev/null +++ b/util/bin/wikipedia @@ -0,0 +1,5 @@ +#! /bin/sh +set -euf +for w in "$@"; do + dig +short txt "$w.wp.dg.cx" +done |