dot

packages and services management
Log | Files | Refs | README

commit 2ddff3a60ffd44480c2c3710796475f35ab363ae
parent 6f5af8039859bdc32888cbb184f818a2f3f3640a
Author: Josuah Demangeon <mail@josuah.net>
Date:   Tue, 28 Nov 2017 22:16:56 +0100

Merge branch 'master' of /home/srv/git/etc

Diffstat:
Mbin/io | 75+++++++++++++++++++++++++++++++++++++++++++++++++++------------------------
Dbin/io-cache | 32--------------------------------
Dbin/io-find | 3---
Dbin/io-mail | 13-------------
Dbin/io-netstat | 3---
Dbin/io-ps | 6------
Dbin/io-src | 9---------
Mbin/xdg-open | 58++++++++++++++++++++++++++++++++++++----------------------
Rio/cal -> cal | 0
Mdaemon/ssh-agent | 4++--
Mdot/profile | 6+++---
Dio/9p | 2--
Dio/gopher | 16----------------
Dio/http | 30------------------------------
Dio/irc | 7-------
Dio/sftp | 2--
Dio/ssh | 7-------
Dio/telnet | 2--
Auri | 59+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
19 files changed, 151 insertions(+), 183 deletions(-)

diff --git a/bin/io b/bin/io @@ -1,29 +1,56 @@ #!/bin/sh -# attach to an abduco session with iomenu and manage the names export LC_COLLATE=C -touch "$ABDUCO_SOCKET_DIR/abduco/names" "$HOME/.cache/io" +case $1 in +(f|find) + for dir in "$HOME"/* + do + cache=$HOME/.cache/find/${dir##*/} + [ "$dir" -nt "$cache" ] && + find "$dir" -name .git -prune -o -print | sort > "$cache" + done + mkdir -p "$HOME/.cache/find" + exec xdg-open "$(cat "$HOME/.cache/find"/* | iomenu -p find)" + ;; +(m|mblaze) + cd "$MAIL/.." + mdirs "$PWD" | sort | while IFS='' read -r dir + do printf '%s\t%s\n' "$(mlist -s "$dir" | wc -l)" "${dir#$PWD/}" + done | iomenu | cut -f 2 | mlist | mthread | msort -r -d | mseq -S | + mscan -f '%6n %u %D %20f %t%2i%120S' | iomenu -p mail | + sed -r 's/^ *([0-9]*) .*/\1/'| xargs mless + ;; +(n|netstat) + netstat -a | sed 's/^[AP]/#&/' | iomenu -# + ;; +(p|ps) + { ps -ax || ps; } | sed '1 s/^/#/' | iomenu -p ps -# | + sed -r 's/[^ ]* *([0-9]*).*/\1/' + ;; +(s|src) + xdg-open "$(find "$2" -type f ! -path '*/.git/*' | sort | xargs -n 1 awk ' + FNR == 1 { printf("#%s\n", FILENAME); } + { printf("%7s\t%s\n", FNR, $0); } + ' | iomenu -# -p search | sed 's/ .*//')" + ;; +(m|man) + spc=' ' + exec man "$(man -k ' ' | + sed -r -e "s/ - /$spc - /" -e 's/(.{25}[^ ]* ) * - /\1- /' | + iomenu -p man | sed 's/[^_a-zA-Z0-9].*//')" + ;; +(a|abduco) + id=$(abduco | sed '1 s/^/#/' | iomenu -# -p abduco | cut -f 4) + [ "$SSH_TTY" ] && e='^\' || e='^Z' + exec abduco -e "$e" -a "$id" + ;; +(u|uri) + exec xdg-open "$(iomenu -p uri < "$HOME/etc/uri")" + ;; +(*) + printf 'usage: io [f[ind] | m[blaze] | n[etstat] | p[s] | s[rc] path\n' + printf ' u[ri] | c[ache] | m[an] | a[bduco]]\n' + ;; +esac -grep -F "$ABDUCO_SOCKET_DIR/abduco/names" -e "$( - abduco | sed 1d | cut -d ' ' -f 3- -)" | sort -uo "$ABDUCO_SOCKET_DIR/abduco/names" - -IFS=' ' -[ $# = 0 ] && set -- $( - cut -d ' ' -f 3- "$ABDUCO_SOCKET_DIR/abduco/names" | - cat - "$HOME/.cache/io" "$HOME/etc/io"/* | iomenu -p io -# -) -unset IFS - -for path in "$@"; do continue; done -[ -e "$path" ] && path=$(cd "$(dirname "$path")" && pwd)/$(basename "$path") -hash=$(printf %s "$path" | cksum | cut -d ' ' -f 1) - -[ "$*" ] || exit 1 -[ $# = 1 ] && set -- xdg-open "$1" - -printf '\033];%s\007' "$path" -printf '%s %s\n' "$hash" "$path" >> "$ABDUCO_SOCKET_DIR/abduco/names" -[ "$SSH_TTY" ] && e='^\' || e='^Z' -[ "$ABDUCO" != "$hash" ] && ABDUCO=$hash exec abduco -e "$e" -A "$hash" "$@" diff --git a/bin/io-cache b/bin/io-cache @@ -1,32 +0,0 @@ -#!/bin/sh -# build a list of files preceded by '#command to open them' - -mkdir -p "$HOME/.cache" -exec 1> "$HOME/.cache/io" - -echo '#rlwrap ii-client' -find "$HOME/var/irc" -maxdepth 1 -mindepth 1 -type d | -sort - -echo '#io-mail' -mdirs "$HOME/var/mail" | sort | while IFS='' read -r dir -do printf '%s\t%s\n' "$(mlist -s "$dir" | wc -l)" "$dir" -done - -echo '#play' -find "$HOME/lib/video" "$HOME/lib/music" | -sort - -echo '#mandoc -a' -IFS=: -find $MANPATH -name '*.[0-9]' -o -name '*.[0-9]p' -o -name '*.[0-9].gz' | -sort -unset IFS - -echo '#qemu-start' -find "$HOME/var/qemu" -type f | -sort - -echo "#xdg-open" -find "$HOME" -name .git -prune -o -print | -sort diff --git a/bin/io-find b/bin/io-find @@ -1,3 +0,0 @@ -#!/bin/sh - -find "$HOME" -name .git -prune -o -print | iomenu diff --git a/bin/io-mail b/bin/io-mail @@ -1,13 +0,0 @@ -#!/bin/sh -# list mail from all inboxes using mblaze - -for box in "$@"; do continue; done - -# sort messages -mdirs "$box" | mlist | mthread | msort -r -d | mseq -S | - -# prompt for a mail with iomenu -mscan -f '%6n %u %D %20f %t%2i%120S' | iomenu -p mail | - -# open it -sed -r 's/^ *([0-9]*) .*/\1/'| xargs mless diff --git a/bin/io-netstat b/bin/io-netstat @@ -1,3 +0,0 @@ -#!/bin/sh - -netstat -a | sed 's/^[AP]/#&/' | iomenu -# diff --git a/bin/io-ps b/bin/io-ps @@ -1,6 +0,0 @@ -#!/bin/sh - -{ ps -ax || ps; } | -sed '1 s/^/#/' | -iomenu -p ps -# | -sed -r 's/[^ ]* *([0-9]*).*/\1/' diff --git a/bin/io-src b/bin/io-src @@ -1,9 +0,0 @@ -#!/bin/sh -# interactively search a string in all code of a directory - -io "$( - find "$1" -type f ! -path '*/.git/*' | sort | xargs -n 1 awk ' - FNR == 1 { printf("#%s\n", FILENAME); } - { printf("%7s\t%s\n", FNR, $0); } - ' | iomenu -# -p search | sed 's/ .*//' -)" diff --git a/bin/xdg-open b/bin/xdg-open @@ -1,80 +1,94 @@ #!/bin/sh # override the xdg-open utility -case $(tty) in (/dev/pts/*|/dev/tty*) ;; (*) exec st -e "$0" "$1" ;; esac +tty | grep -q -e '^/dev/pts/.*' -e '^/dev/tty*' || +exec st -f terminus:pixelsize=18 -e "$0" "$1" -printf '\033]0;%s\007' "$*" +# Wrap everything in an abduco session +aexec() +{ + for name in "$@"; do continue; done + [ -e "$name" ] && + name=$(cd "$(dirname "$name")"; pwd)/$(basename "$name") + name=$(printf %s "$name" | tr / !) + [ "$SSH_TTY" ] && e='^\' || e='^Z' + printf '\033]0;%s\007' "$name" + ABDUCO=$name exec abduco -A "$name" "$@" +} case $1 in (http*://*.mp3) - exec mplayer "$1" + aexec mplayer "$1" ;; (http*://*) for b in firefox chromium chromium-browser chrome x-www-browser do command -v "$b" && break done - exec "$b" "$1" + aexec "$b" "$1" ;; (gopher://*) - exec sacc "$1" + aexec sacc "$1" ;; (ssh://*) address=${1#ssh://} case $address in (*:*) - exec ssh -p "${address#*:}" "${address%:*}" + aexec ssh -p "${address#*:}" "${address%:*}" ;; (*) - exec ssh "$address" + aexec ssh "$address" ;; esac ;; (sftp://*) - exec sftp ${1#sftp://} + aexec sftp ${1#sftp://} ;; (ftp://*) - exec ftp ${1#ftp://} + aexec ftp ${1#ftp://} ;; (9p://*) address=${1#9p://} dir=$HOME/var/9p/$address mkdir -p "$dir" - exec doas 9pfs "$address" "$dir" + aexec doas 9pfs "$address" "$dir" ;; (git://*) cd "$HOME/src" || exit 1 - exec git clone "$1" + aexec git clone "$1" ;; (telnet://*) address=${1#telnet://} - exec telnet "${address%:*}" "${address##*:}" + aexec telnet "${address%:*}" "${address##*:}" ;; (mailto:*) - exec mcom "${1#mailto:}" + aexec mcom "${1#mailto:}" ;; (magnet:*) - exec transmission-cli "${1#magnet:}" + aexec transmission-cli "${1#magnet:}" ;; (*.torrent) - exec transmission-cli "$1" + aexec transmission-cli "$1" ;; (*.pdf) - exec mupdf "$1" + aexec mupdf "$1" ;; (*.jpg|*.jpeg|*.png) - exec feh -. "$1" + aexec feh -. "$1" ;; (*.gif|*.webm|*.mp4|*.mkv|*.mp3|*.flac|*.ogg|*.opus) - exec mplayer "$1" + aexec mplayer "$1" ;; (*.[0-9]|*.[0-9]p|*.[0-9].gz) - exec mandoc -a "$1" + aexec mandoc -a "$1" ;; (*.o|*.a) - exec radare2 "$1" + aexec radare2 "$1" + ;; +(*/music/*) + aexec play "$1" ;; (*) - [ -d "$1" ] && exec io-src "$1" - exec less "$1" + [ -d "$1" ] && aexec io-src "$1" + aexec less "$1" ;; esac diff --git a/io/cal b/cal diff --git a/daemon/ssh-agent b/daemon/ssh-agent @@ -1,6 +1,6 @@ #!/bin/sh mkdir -p "$HOME/var/run" -pgrep -qx ssh-agent && rm -f "$HOME/var/run/ssh-agent" +pgrep -qx ssh-agent && rm -f "$SSH_AUTH_SOCK" -exec ssh-agent -a "$HOME/var/run/ssh-agent" +exec ssh-agent -a "$SSH_AUTH_SOCK" diff --git a/dot/profile b/dot/profile @@ -2,6 +2,7 @@ export NAME="Josuah Demangeon" export TZ="Europe/Paris" export NICK="josuah" export EMAIL="mail@josuah.net" + export EDITOR="edit" VISUAL="edit" export PAGER="less" MANPAGER="less" @@ -22,13 +23,12 @@ export LC_MESSAGES=en_US.UTF-8 export LC_NUMERIC=en_US.UTF-8 export LC_TIME=en_US.UTF-8 -export ABDUCO_SOCKET_DIR="$HOME/var/run" +export ABDUCO_SOCKET_DIR="$HOME/.cache" export LESS="-R" -export LESSCHARSET="utf-8" export BLIH="josuah.demangeon@epitech.eu" -export SSH_AUTH_SOCK="$HOME/var/run/ssh-agent" +export SSH_AUTH_SOCK="$HOME/.cache/ssh-agent" [ -z "${-##*i*}" ] && . "$HOME/.bashrc" diff --git a/io/9p b/io/9p @@ -1,2 +0,0 @@ -#xdg-open -9p://9p.io diff --git a/io/gopher b/io/gopher @@ -1,16 +0,0 @@ -#sacc -gopher://bitreich.org -gopher://drkhsh.at/ -gopher://gopher.leveck.us/1/cgi-bin/pg -gopher://gopher.raumzeitlabor.org/1 -gopher://gopherpedia.com -gopher://gopherproject.org -gopher://jgw.mdns.org/7/.bin-cgi/gophermap.dcgi -gopher://josuah.net -gopher://me0w.net/7/searx.dcgi -gopher://port70.net -gopher://r-36.net -gopher://tx.god.jp -gopher://tx.god.jp/1 -gopher://tx.god.jp/1/yt -gopher://z3bra.org diff --git a/io/http b/io/http @@ -1,30 +0,0 @@ -#xdg-open -http://cyberia.systems -http://josuah.net -http://lobste.rs -http://n-gate.com -http://nixers.net -http://reddit.com -http://suckless.org -http://2f30.org -http://nixers.net -http://lobste.rs -http://gnu.moe -http://nullprogram.com/ -http://fuwafuwa.moe -http://mixtape.moe -http://thecontext.net -http://lainzine.neocities.org/txt-releases/lainzine-3.txt -http://www.tldp.org/guides.html -https://www.destroyallsoftware.com/compendium/network-protocols/ -https://gxamjbnu7uknahng.onion.rip/wiki/index.php/Infornography:_The_Tao_of_Memetic_(Meta)Engineering -http://calomel.org -http://www.3x6x.com/discography.html -http://systemspace.network -http://tttthis.com/rememberwebsites.php -https://wiby.me -http://wurstcaptures.untergrund.net/music/ -http://win95.ajf.me/win95.html -http://pdp11.aiju.de -http://n-gate.com -http://idiotbox.codemadness.org diff --git a/io/irc b/io/irc @@ -1,7 +0,0 @@ -#xdg-open -irc://irc.cyberia.is:6697 -irc://irc.freenode.net:6697 -irc://irc.lainchan.org:6697 -irc://irc.oftc.net:6697 -irc://irc.scalix.gandi.net:6667 -irc://unix.chat:6697 diff --git a/io/sftp b/io/sftp @@ -1,2 +0,0 @@ -#xdg-open -sftp://lainon@archive.sh diff --git a/io/ssh b/io/ssh @@ -1,7 +0,0 @@ -#xdg-open -ssh://josuah@josuah.net -ssh://josuah@cyberia.systems -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/io/telnet b/io/telnet @@ -1,2 +0,0 @@ -#xdg-open -telnet://entropy.bbses.info:23999 diff --git a/uri b/uri @@ -0,0 +1,59 @@ +9p://9p.io +gopher://bitreich.org +gopher://drkhsh.at/ +gopher://gopher.leveck.us/1/cgi-bin/pg +gopher://gopher.raumzeitlabor.org/1 +gopher://gopherpedia.com +gopher://gopherproject.org +gopher://jgw.mdns.org/7/.bin-cgi/gophermap.dcgi +gopher://josuah.net +gopher://me0w.net/7/searx.dcgi +gopher://port70.net +gopher://r-36.net +gopher://tx.god.jp +gopher://tx.god.jp/1 +gopher://tx.god.jp/1/yt +gopher://z3bra.org +http://2f30.org +http://calomel.org +http://cyberia.systems +http://fuwafuwa.moe +http://gnu.moe +http://idiotbox.codemadness.org +http://josuah.net +http://lainzine.neocities.org/txt-releases/lainzine-3.txt +http://lobste.rs +http://lobste.rs +http://mixtape.moe +http://n-gate.com +http://n-gate.com +http://nixers.net +http://nixers.net +http://nullprogram.com/ +http://pdp11.aiju.de +http://reddit.com +http://suckless.org +http://systemspace.network +http://thecontext.net +http://tttthis.com/rememberwebsites.php +http://win95.ajf.me/win95.html +http://wurstcaptures.untergrund.net/music/ +http://www.3x6x.com/discography.html +http://www.tldp.org/guides.html +https://gxamjbnu7uknahng.onion.rip/wiki/index.php/Infornography:_The_Tao_of_Memetic_(Meta)Engineering +https://wiby.me +https://www.destroyallsoftware.com/compendium/network-protocols/ +irc://irc.cyberia.is:6697 +irc://irc.freenode.net:6697 +irc://irc.lainchan.org:6697 +irc://irc.oftc.net:6697 +irc://irc.scalix.gandi.net:6667 +irc://unix.chat:6697 +sftp://lainon@archive.sh +ssh://josuah@cyberia.systems +ssh://josuah@josuah.net +ssh://josuahdemangeon@grex.org +ssh://root@0.0.0.0:5555 +ssh://root@pushswap.josuah.net +ssh://root@store.josuah.net:2222 +telnet://entropy.bbses.info:23999