dot

packages and services management
Log | Files | Refs | README

commit e8e1818fb9343d5893891b3be55b846e307aad26
parent b5315c07b37edad0f7f9190150e7e13940048915
Author: Josuah Demangeon <mail@josuah.net>
Date:   Sun, 26 Nov 2017 00:55:06 +0100

cleanup the scripts

Diffstat:
Mbin/daemon | 2+-
Mbin/etc | 8++++----
Mbin/fun-dna | 162++++++++++++++++++++++++++++++-------------------------------------------------
Mbin/fun-psyche | 46+++++++++++++++++++++-------------------------
Mbin/fun-troll | 14+++++++-------
Mbin/http | 11+++++++----
Mbin/io-ps | 6+++---
Abin/lineart | 8++++++++
Mbin/package | 4++--
Mbin/term | 2+-
Abin/tls | 4++++
Mbin/twt | 4++--
Mdaemon/ngircd | 2+-
Mdaemon/ssh-agent | 3+++
Adaemon/tor | 3+++
Mdot/ssh/config | 4++--
Detc/ngircd.conf | 123-------------------------------------------------------------------------------
Aetc/ngircd/conf | 42++++++++++++++++++++++++++++++++++++++++++
Retc/ngircd.motd -> etc/ngircd/motd | 0
Mio/ssh | 6+++---
Mpackage/ngircd/build | 3+--
21 files changed, 177 insertions(+), 280 deletions(-)

diff --git a/bin/daemon b/bin/daemon @@ -23,6 +23,6 @@ case $cmd in printf '%-14s: %s\n' "$1" "$(pgrep -x "$1" | tr '\n' ' ')" ;; (*) - printf 'usage: %s [start|stop service]\n' "${0##*/}" + printf 'usage: daemon [start service | stop service]\n' ;; esac diff --git a/bin/etc b/bin/etc @@ -8,8 +8,6 @@ case $1 in find * -type d -exec mkdir -p "$HOME/.{}" ';' find * -type f -exec ln -fs "$ETC/dot/{}" "$HOME/.{}" ';' find -L "$HOME" -maxdepth 3 -type l -exec rm {} + - ;; -(config) cd "$ETC/config" || exit 1 find * -type d -exec mkdir -p "$HOME/.config/{}" ';' find * -type f -exec ln -fs "$ETC/config/{}" "$HOME/.config/{}" ';' @@ -29,7 +27,9 @@ case $1 in ;; (git) git clone josuah@git.josuah.net:srv/git/srv.git "$HOME/srv" - git clone josuah@git.josuah.net:srv/git/notes.git "$HOME/git/notes" + mkdir -p "$HOME/git/josuah.net" + cd "$HOME/git/josuah.net" || exit 1 + git clone josuah@git.josuah.net:srv/git/notes.git ;; (setup) [ -f "$ETC/cron/$2" ] && cat "$ETC/cron/$2" >> "$HOME/.config/cron" @@ -41,5 +41,5 @@ case $1 in fc-cache "$ETC/fonts" ;; (*) - printf 'usage: etc dot | config | mkdir | setup service | fonts\n' + printf 'usage: etc [dot | mkdir | setup service | fonts]\n' esac diff --git a/bin/fun-dna b/bin/fun-dna @@ -1,106 +1,68 @@ #!/bin/sh -# prints nucleotides with full structure, sequentially - -# Usage: dna [ATCG]... - - -R='' B='' -f1=''; f2=''; f3=''; f4=''; f5=''; f6=''; f7='' - -A="\ - ${f1}O${R} ${f1}O${R} *---* - \\\\ / / \\ - ${f3}P${R} ${f4}N${R}. ${f4}N${R}H2 ${f6}|||||||${R} ${f1}O${R} * * - / \\ // \`. / \\\\ / \`. ,'| - ${f1}O${R}- ${f1}O${R} * *---* *---${f4}N${R} \`${f1}O${R}' * - / \\ // \\\\ / \\ / - * ,${f1}O${R}. ${f4}N${R}---* ${f4}N${R} ${f6}||||||||${R} H${f4}N${R} * ${f1}O${R} ${f1}O${R}- - |,' \`. / \\ / \\ // \\ / - * * ${f4}N${R}===* *---* ${f3}P${R} - \\ / // \\ / \\\\ - *---* Adenine ${f1}O${R} * ${f1}O${R} ${f1}O${R} +# print random ATCG nucleotides from stdin with full structure + +od -An /dev/random | tr -cd 0-7 | fold -w 1 | while read n +do + case "$n" in + (0|1) cat << 'EOF' + O O *---* + \\ / / \ + P N. NH2 ||||||||| O * * + / \ // '. / \\ / '. .'| + O- O * *---* *---N 'O' * + / \ // \\ / \ / + * .O. N---* N |||||||||| HN * O O- + |.' '. / \ / \ // \ / + * * N===* *---* P + \ / // \ / \\ + *---* Adenine O * O O | | -" - -G="\ - ${f1}O${R} ${f1}O${R} *---* - \\\\ / / \\ - ${f3}P${R} ${f4}N${R}. ${f1}O${R} ${f6}|||||||${R} H2${f4}N${R} * * - / \\ // \`. // \\ / \`. ,'| - ${f1}O${R}- ${f1}O${R} * *---* *---${f4}N${R} \`${f1}O${R}' * - / \\ // \\ / \\ / - * ,${f1}O${R}. ${f4}N${R}---* ${f4}N${R}H ${f6}||||||||${R} ${f4}N${R} * ${f1}O${R} ${f1}O${R}- - |,' \`. / \\ / \\\\ // \\ / - * * ${f4}N${R}===* *---* ${f3}P${R} - \\ / \\ // / \\\\ - *---* Guanine ${f4}N${R}H2 ${f6}|||||||${R} ${f1}O${R} ${f1}O${R} ${f1}O${R} +EOF + ;; + (2|3) cat << 'EOF' + O O * O *---* + \\ / \ // / \ + P *---* *===N * * + / \ // \ / \ / '. .'| + O- O * NH |||||||||| N *---N 'O' * + / \ / \\ // \ / + * .O. N---* *---* * O O- + |.' '. / \\ / '. // \ / + * * O ||||||||| H2N 'N P + \ / / \\ + *---* Thymine O O | | -" - -C="\ - ${f1}O${R} ${f1}O${R} ${f1}O${R} ${f6}|||||||${R} H2${f4}N${R} *---* - \\\\ / // \\ / \\ - ${f3}P${R} *---* *===${f4}N${R} * * - / \\ // \\\\ / \\ / \`. ,'| - ${f1}O${R}- ${f1}O${R} * ${f4}N${R} ${f6}||||||||${R} H${f4}N${R} *---${f4}N${R} \`${f1}O${R}' * - / \\ / \\ // \\ / - * ,${f1}O${R}. ${f4}N${R}---* *---* * ${f1}O${R} ${f1}O${R}- - |,' \`. / \\ // \`. // \\ / - * * ${f4}N${R}H2 ${f6}|||||||${R} ${f1}O${R} \`${f4}N${R} ${f3}P${R} - \\ / / \\\\ - *---* Cytosine ${f1}O${R} ${f1}O${R} +EOF + ;; + (4|5) cat << 'EOF' + O O O ||||||||| H2N *---* + \\ / // \ / \ + P *---* *===N * * + / \ // \\ / \ / '. .'| + O- O * N |||||||||| HN *---N 'O' * + / \ / \ // \ / + * .O. N---* *---* * O O- + |.' '. / \ // '. // \ / + * * NH2 ||||||||| O 'N P + \ / / \\ + *---* Cytosine O O | | -" - -T="\ - ${f1}O${R} ${f1}O${R} * ${f1}O${R} *---* - \\\\ / \\ // / \\ - ${f3}P${R} *---* *===${f4}N${R} * * - / \\ // \\ / \\ / \`. ,'| - ${f1}O${R}- ${f1}O${R} * ${f4}N${R}H ${f6}||||||||${R} ${f4}N${R} *---${f4}N${R} \`${f1}O${R}' * - / \\ / \\\\ // \\ / - * ,${f1}O${R}. ${f4}N${R}---* *---* * ${f1}O${R} ${f1}O${R}- - |,' \`. / \\\\ / \`. // \\ / - * * ${f1}O${R} ${f6}|||||||${R} H2${f4}N${R} \`${f4}N${R} ${f3}P${R} - \\ / / \\\\ - *---* Thymine ${f1}O${R} ${f1}O${R} +EOF + ;; + (6|7) cat << 'EOF' + O O *---* + \\ / / \ + P N. O ||||||||| H2N * * + / \ // '. // \ / '. .'| + O- O * *---* *---N 'O' * + / \ // \ / \ / + * .O. N---* NH |||||||||| N * O O- + |.' '. / \ / \\ // \ / + * * N===* *---* P + \ / \ // / \\ + *---* Guanine NH2 ||||||||| O O O | | -" - - -nucleotide() -{ - case "$1" in - ( A* ) printf %s "$A" ;; ( T* ) printf %s "$T" ;; - ( C* ) printf %s "$C" ;; ( G* ) printf %s "$G" ;; +EOF + ;; esac -} - - -random() -{ - while date +%s | md5sum | tr -cd '0-9a-f\n' | - tr 0-9a-f ATCGATCGATCGATCG | fold -w 1 - do - sleep 4 - done | while read -r n - do - nucleotide "$n" - sleep 1 - done -} - - -main() -{ - [ -z "$1" ] && random - - while [ "$1" ] - do - nucleotide "$1" - set -- "${1#?}" - done -} - - -main "$@" +done diff --git a/bin/fun-psyche b/bin/fun-psyche @@ -1,13 +1,9 @@ #!/bin/sh -pause() -{ - dd if=/dev/zero of=/dev/null bs=1 count=327680 2> /dev/null -} -set -- ` +set -- $( printf '%s\n' "$*" | fold -w 1 | sed 's/[ ]/_/; /^$/ s/^/_/' seq 10 | sed 's/.*/_/' -` +) b=`printf '\033[31;1m'` e=`printf '\033[0m'` @@ -33,7 +29,7 @@ printf '\033[H%s' ' (_) `-|____|/_______\________________/ ' -pause +sleep 1 printf '\033[H%s' ' _____ _ ___ ___,--._________ @@ -53,7 +49,7 @@ printf '\033[H%s' ' (_) `-|____|/_______\________________/ ' -pause +sleep 1 printf '\033[H%s' ' _____ _ ___ ___,--._________ @@ -73,7 +69,7 @@ printf '\033[H%s' ' (_) `-|____|/_______\________________/ ' -pause +sleep 1 printf '\033[H%s' ' _____ _ ___ ___,--._________ @@ -93,7 +89,7 @@ printf '\033[H%s' ' (_) `-|____|/_______\________________/ ' -pause +sleep 1 printf '\033[H%s' ' _____ '$b' _'$e' ___ ___,--._________ @@ -113,7 +109,7 @@ printf '\033[H%s' ' (_) `-|____|/_______\________________/ ' -pause +sleep 1 printf '\033[H%s' ' '$b'_____'$e' _ '$b'___'$e' ___,--._________ @@ -133,7 +129,7 @@ printf '\033[H%s' ' (_) '$b'`-'$e'|____|'$b'/'$e'_______'$b'\___'$e'_____________/ ' -pause +sleep 1 printf '\033[H%s' ' _____ _ ___ ___,--._________ @@ -153,7 +149,7 @@ printf '\033[H%s' ' '$b'(_)'$e' `-|____|/_______'$b'\________________/'$e' ' -pause +sleep 1 printf '\033[H%s' ' _____ _ ___ ___,--._________ @@ -173,7 +169,7 @@ printf '\033[H%s' ' (_) `-|____|/_______\_____'$b'___________/'$e' ' -pause +sleep 1 printf '\033[H%s' ' _____ _ ___ ___,--._________ @@ -193,7 +189,7 @@ printf '\033[H%s' ' (_) `-|____|/_______\________________/ ' -pause +sleep 1 printf '\033[H%s' ' _____ _ ___ ___'$b',--._________'$e' @@ -213,7 +209,7 @@ printf '\033[H%s' ' (_) `-|____|/_______\________________/ ' -pause +sleep 1 printf '\033[H%s' ' _____ _ ___ ___,--._________ @@ -233,7 +229,7 @@ printf '\033[H%s' ' (_) `-|____|/_______\________________/ ' -pause +sleep 1 printf '\033[H%s' ' _____ _ ___ ___,--._________ @@ -253,7 +249,7 @@ printf '\033[H%s' ' (_) `-|____|/_______\________________/ ' -pause +sleep 1 printf '\033[H%s' ' _____ _ ___ ___,--._________ @@ -273,7 +269,7 @@ printf '\033[H%s' ' (_) `-|____|/_______\________________/ ' -pause +sleep 1 printf '\033[H%s' ' _____ _ ___ ___,--._________ @@ -293,7 +289,7 @@ printf '\033[H%s' ' (_) `-|____|/_______\________________/ ' -pause +sleep 1 printf '\033[H%s' ' _____ _ ___ ___,--._________ @@ -313,7 +309,7 @@ printf '\033[H%s' ' (_) `-|____|/_______\________________/ ' -pause +sleep 1 printf '\033[H%s' ' _____ _ ___ ___,--._________ @@ -333,7 +329,7 @@ printf '\033[H%s' ' (_) `-|____|/_______\________________/ ' -pause +sleep 1 printf '\033[H%s' ' _____ _ ___ ___,--._________ @@ -353,7 +349,7 @@ printf '\033[H%s' ' (_) `-|____|/_______\________________/ ' -pause +sleep 1 printf '\033[H%s' ' _____ _ ___ ___,--._________ @@ -373,7 +369,7 @@ printf '\033[H%s' ' (_) `-|____|/_______\________________/ ' -pause +sleep 1 printf '\033[H%s' ' _____ _ ___ ___,--._________ @@ -399,7 +395,7 @@ while [ "$#" -gt 10 ] do shift - pause + sleep 1 printf '\033[H%s' ' _____ _ ___ ___,--._________ diff --git a/bin/fun-troll b/bin/fun-troll @@ -9,13 +9,13 @@ sed -r 's/^(..)(..)/\1 \2/' | while read row col do printf '\033[%s;%sH' "$row" "$col" - printf '\033[10C\v%s' ',--------.' - printf '\033[11D\v%s' '/ ,===-=== `.' - printf '\033[14D\v%s' '//__(*= (*-.\\' + printf '\033[10C\v%s' ',--------.' + printf '\033[11D\v%s' '/ ,===-=== `.' + printf '\033[14D\v%s' '//__(*= (*-.\\' printf '\033[16D\v%s' '(((,__` ,c-).~~))' - printf '\033[16D\v%s' '\ \ `------'\''||' - printf '\033[14D\v%s' '\ `-.______, |' - printf '\033[18D\v%s' ' `-._ ------ |' - printf '\033[9D\v%s' '`-.____/' + printf '\033[16D\v%s' '\ \ `------'\''||' + printf '\033[14D\v%s' '\ `-.______, |' + printf '\033[13D\v%s' '`-._ ------ |' + printf '\033[9D\v%s' '`-.____/' done diff --git a/bin/http b/bin/http @@ -2,22 +2,25 @@ # client to various http services case $1 in +(0x0) + curl -F file=@- 0x0.st + ;; (ip) curl icanhazip.com ;; (ix) curl -F f:1=@- ix.io ;; +(sprunge) + curl -F sprunge=@- sprunge.us + ;; (w1r3) curl -F upload=@- w1r3.net ;; (wttr) curl wttr.in ;; -(sprunge) - curl -F 'sprunge=<-' http://sprunge.us - ;; (*) - printf 'usage: %s ip | ix | w1r3 | wttr [< data]\n' "${0##*/}" + printf 'usage: http 0x0 | ip | ix | sprunge | w1r3 | wttr [< data]\n' ;; esac diff --git a/bin/io-ps b/bin/io-ps @@ -1,6 +1,6 @@ #!/bin/sh -ps -ax | -sed '1 s/^/#/' | -iomenu -p ps -# | +{ ps -ax || ps; } | +sed '1 s/^/#/' | +iomenu -p ps -# | sed -r 's/[^ ]* *([0-9]*).*/\1/' diff --git a/bin/lineart b/bin/lineart @@ -0,0 +1,8 @@ +#!/bin/sh +# cool lines to paste + +iomenu << 'EOF' | sed 's/^[^ ]* *//' +put sunglasses on (•_•) / ( •_•)>⌐■-■ / (⌐■_■) +shrug ¯\_(ツ)_/¯ +rose --{@ +EOF diff --git a/bin/package b/bin/package @@ -1,7 +1,5 @@ #!/bin/sh -: ${2:?usage: ${0##*/} [tar git get build add del] package} - export SYSROOT="$HOME/.local" export PKG="$HOME/etc/package/$2" export SRC="$HOME/.local/src/$2" @@ -67,6 +65,8 @@ case "$1" in find -L "$SYSROOT" -type l -exec rm {} + ;; (*) + printf 'usage: package [tar pkg | git pkg | get pkg | build pkg\n' + printf ' add pkg | del pkg]\n' exit 1 ;; esac diff --git a/bin/term b/bin/term @@ -6,6 +6,6 @@ case $1 in ;; (name) shift - printf '\033]0;%s\007' "$*" + printf '\033]0;%s\a "$*" ;; esac diff --git a/bin/tls b/bin/tls @@ -0,0 +1,4 @@ +#!/bin/sh + +case $1 in +esac diff --git a/bin/twt b/bin/twt @@ -155,7 +155,7 @@ case "$1" in sed -re's/[[:space:]]/ /' -e's/(.{12}[^ ]*) */\1 @ /' "$CONF" ;; (*) - printf 'usage: twt tweet msg | view user | timeline | update\n' - printf ' follow user url | unfollow user | following\n' + printf 'usage: twt [tweet msg | view user | timeline | update\n' + printf ' follow user url | unfollow user | following]\n' ;; esac diff --git a/daemon/ngircd b/daemon/ngircd @@ -1,3 +1,3 @@ #!/bin/sh -exec ngircd -nf "$HOME/etc/ngircd.conf" & +exec ngircd -nf "$HOME/etc/ngircd/conf" & diff --git a/daemon/ssh-agent b/daemon/ssh-agent @@ -1,3 +1,6 @@ #!/bin/sh +mkdir -p "$HOME/var/run" +pgrep -qx ssh-agent && rm -f "$HOME/var/run/ssh-agent" + exec ssh-agent -a "$HOME/var/run/ssh-agent" diff --git a/daemon/tor b/daemon/tor @@ -0,0 +1,3 @@ +#!/bin/sh + +exec tor & diff --git a/dot/ssh/config b/dot/ssh/config @@ -30,6 +30,6 @@ host git.josuah.net IdentityFile /mnt/key/ssh/josuah.net.key AddKeysToAgent yes -host store.josuah.net - IdentityFile /mnt/key/ssh/josuah.net.key +host pushswap.josuah.net + IdentityFile /mnt/key/ssh/store.josuah.net.key AddKeysToAgent yes diff --git a/etc/ngircd.conf b/etc/ngircd.conf @@ -1,123 +0,0 @@ -[Global] - Name = irc.josuah.net - - ;AdminInfo1 = Description - ;AdminInfo2 = Location - ;AdminEMail = mail@josuah.net - - ;HelpFile = ~/.config/ngircd/Commands.txt - - Info = Personnal IRC server for learning - - ;Listen = 0.0.0.0 - - # set to ~/etc/ngircd.motd - MotdFile = /home/etc/ngircd.motd - ;MotdPhrase = "Welcome to cyberia.systems" - - Network = irc.cyberia.systems - - ;Password = none - - ;PidFile = /var/run/ngircd/ngircd.pid - - Ports = 6667 - - ;ServerGID = 65534 - ;ServerUID = 65534 - -[Limits] - ;ConnectRetry = 60 - ;IdleTimeout = 0 - - ;MaxConnections = 0 - ;MaxConnectionsIP = 5 - ;MaxJoins = 10 - MaxNickLength = 14 - ;MaxListSize = 100 - - ;PingTimeout = 120 - ;PongTimeout = 20 - -[Options] - AllowedChannelTypes = # - AllowRemoteOper = no - - ;ChrootDir = /var/empty - - ;CloakHost = cloaked.host - ;CloakHostModeX = cloaked.user - ;CloakHostSalt = abcdefghijklmnopqrstuvwxyz - ;CloakUserToNick = yes - - ;ConnectIPv4 = yes - ;ConnectIPv6 = yes - - DefaultUserModes = i - - ;DNS = yes - - ;Ident = yes - - ;IncludeDir = ~/etc/ngircd.d - - MorePrivacy = yes - - ;NoticeBeforeRegistration = no - - ;OperCanUseMode = no - ;OperChanPAutoOp = yes - ;OperServerMode = no - - ;PAM = yes - ;PAMIsOptional = no - ;PAMServiceName = ngircd - - ;RequireAuthPing = no - - ScrubCTCP = yes - - ;SyslogFacility = local1 - - ;WebircPassword = xyz - -;[SSL] - ;CertFile = /home/.local/tls/server-cert.pem - - ;CipherList = HIGH:!aNULL:@STRENGTH:!SSLv3 - - ;DHFile = /home/pi/programs/ngircd/etc/ssl/dhparams.pem - - ;KeyFile = /home/pi/programs/ngircd/etc/ssl/server-key.pem - ;KeyFilePassword = secret - - ;Ports = 6697, 9999 - -[Server] - ;Name = irc2.example.net - ;Host = connect-to-host.example.net - ;Bind = 10.0.0.1 - ;Port = 6667 - - ;MyPassword = MySecret - ;PeerPassword = PeerSecret - - ;Group = 123 - - ;Passive = no - - ;SSLConnect = yes - - ;ServiceMask = *Serv,Global - -[Channel] - ;Name = #TheName - - ;Topic = a great topic - - ;Modes = tnk - - ;Key = Secret - ;KeyFile = /home/pi/programs/ngircd/etc/#chan.key - - ;MaxUsers = 23 diff --git a/etc/ngircd/conf b/etc/ngircd/conf @@ -0,0 +1,42 @@ +[Global] + Name = XXX + AdminInfo1 = josuah + AdminInfo2 = XXX + AdminEMail = mail@josuah.net + Info = XXX + MotdFile = /var/ngircd/motd + Network = XXX + Ports = 6667 + +[Limits] + MaxConnectionsIP = 20 + MaxJoins = XXX + MaxNickLength = 10 + PingTimeout = 120 + PongTimeout = 120 + +[Options] + AllowedChannelTypes = #&+ + AllowRemoteOper = yes + CloakHost = %x%x + CloakHostSalt = XXX + DefaultUserModes = iC + DNS = no + Ident = no + MorePrivacy = yes + OperCanUseMode = yes + OperChanPAutoOp = yes + OperServerMode = yes + +[SSL] + CertFile = /var/tls/server-cert.pem + CipherList = XXX + DHFile = /var/ngircd/dhparams.pem + KeyFile = /var/ngircd/server-key.pem + Ports = 6697 + +[Server] + XXX + +[Channel] + XXX diff --git a/etc/ngircd.motd b/etc/ngircd/motd diff --git a/io/ssh b/io/ssh @@ -1,7 +1,7 @@ #xdg-open ssh://josuah@josuah.net -ssh://josuah@store.josuah.net ssh://josuah@cyberia.systems -ssh://josuahdemangeon@grex.org -ssh://josuah@0.0.0.0:5555 +ssh://root@pushswap.josuah.net +ssh://root@store.josuah.net:2222 ssh://root@0.0.0.0:5555 +ssh://josuahdemangeon@grex.org diff --git a/package/ngircd/build b/package/ngircd/build @@ -1,5 +1,4 @@ ./configure CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" --with-openssl \ - --prefix="$OPT" --sbindir="$OPT/bin" \ - --sysconfdir="$HOME/etc/ngircd.conf" + --prefix="$OPT" --sbindir="$OPT/bin" --sysconfdir="$HOME/etc/ngircd" make install