dot

packages and services management
Log | Files | Refs | README

commit 6a42f32af7921877e8bfc3d5099bed8e505616bb
parent c313d7ae65e04b53cc9c2d6ffd284371ca95d61c
Author: Josuah Demangeon <mail@josuah.net>
Date:   Fri, 17 Nov 2017 15:23:54 +0100

small fixes

Diffstat:
Mbin/io | 2++
Mbin/io-cache | 10+++++-----
Mbin/io-mail | 4++--
Mbin/mblaze-filter | 107+++++++++++++++++++++++++++++++++++++++++--------------------------------------
Mbin/monitor | 58+++++++++++++++++++++++++++++++++++++++++++++++++---------
Dbin/monitor-step | 54------------------------------------------------------
Abin/status | 28++++++++++++++++++++++++++++
Mbin/xdg-open | 2+-
Mdaemon/monitor | 3++-
Mdot/emacs.d/init.el | 12++++++++++++
Mdot/profile | 8++++++++
Mdot/xinitrc | 17+----------------
Mio/gopher | 1+
Mman/git-index.1 | 7+++----
14 files changed, 170 insertions(+), 143 deletions(-)

diff --git a/bin/io b/bin/io @@ -9,10 +9,12 @@ 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/var/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") diff --git a/bin/io-cache b/bin/io-cache @@ -4,20 +4,20 @@ mkdir -p "$HOME/var/cache" exec 1> "$HOME/var/cache/io" -echo '#rlwrap ii-client' +echo '#rlwrap ii-client' find "$HOME/var/irc" -maxdepth 1 -mindepth 1 -type d | sort echo '#io-mail' -mdirs "$HOME/var/mail" | while IFS='' read -r dir -do printf '%-50s %4s\n' "$dir" "$(mlist -s "$dir" | wc -l | sed 's/^ *0$//')" -done | sort +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' +echo '#mandoc -a' IFS=: find $MANPATH -name '*.[0-9]' -o -name '*.[0-9]p' -o -name '*.[0-9].gz' | sort diff --git a/bin/io-mail b/bin/io-mail @@ -1,10 +1,10 @@ #!/bin/sh # list mail from all inboxes using mblaze -set -- "${1%% *}" +for box in "$@"; do continue; done # sort messages -mdirs "$1" | mlist | mthread | msort -r -d | mseq -S | +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 | diff --git a/bin/mblaze-filter b/bin/mblaze-filter @@ -9,56 +9,61 @@ do mkdir -p "${MAIL%/*}/$dir/new" mkdir -p "${MAIL%/*}/$dir/tmp" printf '%-25s ' "$dir" - mlist "$MAIL" | mpick -t "$test" | xe mv {} "${MAIL%/*}/$dir/new" + mlist "$MAIL" | mpick -t "$test" | while IFS='' read -r mail + do mv "$mail" "${MAIL%/*}/$dir/new" + done done << 'EOF' -actux.eu.org "Reply-To" ~~~ "*@actux.eu.org*" -amazon.com "From" ~~~ "*@amazon.*" -amnesty.org "From" ~~~ "*amnesty.*" -bandcamp.com "From" ~~~ "*Cryo Chamber*" -bandcamp.com "From" ~~~ "*makeupandvanityset.com*" -bandcamp.com "Reply-To" ~~~ "*bandcamp.com*" -breizh-entropy.org "List-Id" ~~~ "*breizh-entropy.org*" -coinbase.com "From" ~~~ "*coinbase.com*" -crous-rennes.fr "From" ~~~ "*crous-rennes.fr*" -dropbox.com "From" ~~~ "*dropbox.*" -ebay.com "From" ~~~ "*ebay.*" -epitech.eu "From" ~~~ "*bde.epitech.rennes@gmail.com*" -epitech.eu "From" ~~~ "*epitech.eu*" -free.fr "From" ~~~ "*@free-mobile.fr*" -freebsd.org "From" ~~~ "*freebsd.org*" -fsf.org "From" ~~~ "*fsf.org*" -gandi.net "From" ~~~ "*gandi.net*" -github.com "From" ~~~ "*github.com*" -gobolinux.org "Subject" ~~~ "*\[gobolinux\]*" -google.com "From" ~~~ "*google.com*" -keybase.io "From" ~~~ "*keybase.io*" -lobste.rs "From" ~~~ "*@lobste.rs*" -nixers.net "From" ~~~ "*@nixers.net*" -noip.com "From" ~~~ "*@noip.com*" -openbsd.org/tech "To" ~~~ "*tech@openbsd.org*" -openbsd.org/tech "Cc" ~~~ "*tech@openbsd.org*" -paypal.com "From" ~~~ "*paypal.*" -reddit.com "From" ~~~ "*@reddit.*" -repo.or.cz "Subject" ~~~ "*\[repo.or.cz\]*" -researchgate.net "From" ~~~ "*@researchgate.*" -researchgate.net "From" ~~~ "*@researchgatemail.*" -stackexchange.com "From" ~~~ "*@stackexchange.com*" -suckless.org "Cc" ~~~ "*@suckless.org*" -suckless.org "From" ~~~ "*@suckless.org*" -suckless.org "To" ~~~ "*@suckless.org*" -transports "From" ~~~ "*@captaintrain.com*" -transports "From" ~~~ "*BlaBlaCar*" -transports "From" ~~~ "*flixbus*" -transports "From" ~~~ "*keolis.com*" -transports "From" ~~~ "*megabus*" -transports "From" ~~~ "*ouibus*" -transports "From" ~~~ "*ouigo*" -transports "From" ~~~ "*sncf.com*" -univ-rennes1.fr "List-Id" ~~~ "*foad.univ-rennes1.fr*" -univ-rennes1.fr "Received" ~~~ "*vmsympa1.univ-rennes1.fr*" -univ-rennes1.fr "Return-Path" ~~~ "*listes.univ-rennes1.fr*" -univ-rennes1.fr "To" ~~~ "*listes.etudiant.univ-rennes1.fr*" -wordpress.com "From" ~~~ "*wordpress.com*" -yammer.com "From" ~~~ "*yammer.com*" -youtube.com "From" ~~~ "*youtube.com*" +actux.eu.org "Reply-To" ~~~ "*@actux.eu.org*" +amazon.com "From" ~~~ "*@amazon.*" +amnesty.org "From" ~~~ "*amnesty.*" +bandcamp.com "From" ~~~ "*Cryo Chamber*" +bandcamp.com "From" ~~~ "*makeupandvanityset.com*" +bandcamp.com "Reply-To" ~~~ "*bandcamp.com*" +breizh-entropy.org "List-Id" ~~~ "*breizh-entropy.org*" +coinbase.com "From" ~~~ "*coinbase.com*" +crous-rennes.fr "From" ~~~ "*crous-rennes.fr*" +dropbox.com "From" ~~~ "*dropbox.*" +ebay.com "From" ~~~ "*ebay.*" +epitech.eu "From" ~~~ "*bde.epitech.rennes@gmail.com*" +epitech.eu "From" ~~~ "*epitech.eu*" +epitech.eu "From" ~~~ "*ionis-group.org*" +free.fr "From" ~~~ "*@free-mobile.fr*" +freebsd.org "From" ~~~ "*freebsd.org*" +fsf.org "From" ~~~ "*fsf.org*" +gandi.net "From" ~~~ "*gandi.net*" +github.com "From" ~~~ "*github.com*" +gobolinux.org "Subject" ~~~ "*\[gobolinux*\]" +google.com "From" ~~~ "*google.com*" +keybase.io "From" ~~~ "*keybase.io*" +lobste.rs "From" ~~~ "*@lobste.rs*" +nixers.net "From" ~~~ "*@nixers.net*" +noip.com "From" ~~~ "*@noip.com*" +openbsd.org/tech "Cc" ~~~ "*tech@openbsd.org*" +openbsd.org/tech "To" ~~~ "*tech@openbsd.org*" +openbsd.org/announce "To" ~~~ "*announce@openbsd.org*" +paypal.com "From" ~~~ "*paypal.*" +reddit.com "From" ~~~ "*@reddit.*" +repo.or.cz "Subject" ~~~ "*\[repo.or.cz\]*" +researchgate.net "From" ~~~ "*@researchgate.*" +researchgate.net "From" ~~~ "*@researchgatemail.*" +sabotage.tech "From" ~~~ "sabotage-*@lists.openwall.com" +stackexchange.com "From" ~~~ "*@stackexchange.com*" +suckless.org "Cc" ~~~ "*@suckless.org*" +suckless.org "From" ~~~ "*@suckless.org*" +suckless.org "To" ~~~ "*@suckless.org*" +transports "From" ~~~ "*@captaintrain.com*" +transports "From" ~~~ "*BlaBlaCar*" +transports "From" ~~~ "*flixbus*" +transports "From" ~~~ "*keolis.com*" +transports "From" ~~~ "*megabus*" +transports "From" ~~~ "*ouibus*" +transports "From" ~~~ "*ouigo*" +transports "From" ~~~ "*sncf.com*" +univ-rennes1.fr "List-Id" ~~~ "*foad.univ-rennes1.fr*" +univ-rennes1.fr "Received" ~~~ "*vmsympa1.univ-rennes1.fr*" +univ-rennes1.fr "Return-Path" ~~~ "*listes.univ-rennes1.fr*" +univ-rennes1.fr "To" ~~~ "*listes.etudiant.univ-rennes1.fr*" +wordpress.com "From" ~~~ "*wordpress.com*" +yammer.com "From" ~~~ "*yammer.com*" +youtube.com "From" ~~~ "*youtube.com*" EOF diff --git a/bin/monitor b/bin/monitor @@ -1,13 +1,53 @@ #!/bin/sh -# script monitoring performances and recording data to $HOME/var/stat +# ressources monitoring script -STEP="${1:-900}" +# It will produce one line with the following values, separated with a space: +# +# 1. hostname 5. load average (1 minute) +# 2. unix time 6. disk I/O +# 3. free memory 7. total free storage +# 4. cpu usage -mkdir -p "$HOME/var/stat" +case "$(uname)" in +(Linux ) mem=free bi=bi bo=bo ;; +(*BSD ) mem=fre bi='' bo='' ;; +(Solaris) mem=free bi='' bo='' ;; +(SunOS ) mem=free bi='' bo='' ;; +esac -while true -do - monitor-step "$STEP" >> "$HOME/var/stat/data" - printf '\033[2J\033[H' - tail -n 100 "$HOME/var/stat/data" | monitor-plot "$STEP" -done +exec awk -v mem="$mem" -v bi="$bi" -v bo="$bo" ' + +BEGIN { + "date +%s" | getline time; + "hostname" | getline host; + "uptime" | getline load; + + sub(/.* /, "", load); + + while ("df" | getline) + if ($1 ~ "^/dev/" || $1 == "zroot") stor += $4; +} + +NR == 2 { + split($0, keys); + + for (key in keys) + if (keys[key] ~ /[0-9]$/) + disks[i++] = keys[key]; +} + +NR >= 4 { + for (i = 1 + split($0, values); i > 0; i--) + table[keys[i]] = values[i]; + + mem = table[mem]; + cpu = 100 - table['id']; + load = load; + diskio = table[bi] + table[bo]; + + for (disk in disks) + diskio += table[disks[disk]]; + + print(host " " time " " mem " " cpu " " load " " diskio " " stor); + fflush(); +}' diff --git a/bin/monitor-step b/bin/monitor-step @@ -1,54 +0,0 @@ -#!/bin/sh -# ressources monitoring script - -# It will produce one line with the following values, separated with a space: -# -# 1. hostname 5. load average (1 minute) -# 2. unix time 6. disk I/O -# 3. free memory 7. total free storage -# 4. cpu usage - -case "$(uname)" in -(Linux ) mem=free cpu=id bi=bi bo=bo ;; -(*BSD ) mem=fre cpu=id bi='' bo='' ;; -(Solaris) mem=free cpu=id bi='' bo='' ;; -(SunOS ) mem=free cpu=id bi='' bo='' ;; -esac - -vmstat "${1:-15}" 2 | -awk -v mem="$mem" -v cpu="$cpu" -v bi="$bi" -v bo="$bo" ' - -BEGIN { - "date +%s" | getline time - "hostname" | getline host - "uptime" | getline load - - sub(/.* /, "", load) - - while ("df" | getline) - if ($1 ~ "^/dev/" || $1 == "zroot") stor += $4 -} - -NR == 2 { - split($0, keys) - - for (key in keys) { - if (keys[key] ~ /[0-9]$/) - disks[i++] = keys[key] - } -} - -NR >= 4 { - for (i = 1 + split($0, values); i > 0; i--) - table[keys[i]] = values[i] - - mem = table[mem] - cpu = 100 - table[cpu] - load = load - diskio = table[bi] + table[bo] - - for (disk in disks) - diskio += table[disks[disk]] - - print host " " time " " mem " " cpu " " load " " diskio " " stor -}' diff --git a/bin/status b/bin/status @@ -0,0 +1,28 @@ +#!/bin/sh + +uptime | sed 's/.*: *//' | tr -d ',\n' +printf ' ' + +# battery + +case $(uname) in +(Linux) + cat /sys/class/power_supply/BAT*/capacity + ;; +(*BSD) + sysctl hw.sensors | sed -nr 's/.*(acpibat.).*/\1/p' | sort -u | + while IFS='' read -r bat + do + bat=hw.sensors.${bat} + max=$(sysctl -n "${bat}.watthour4" | tr -cd 0-9) + cur=$(sysctl -n "${bat}.watthour3" | tr -cd 0-9) + expr "$cur" '*' 100 / "$max" + done + ;; +esac | xargs printf ' %s%%' + +printf ' ' + +date +'%Y/%m/%d %H:%M' | tr -d '\n' + +printf '\n' diff --git a/bin/xdg-open b/bin/xdg-open @@ -68,7 +68,7 @@ magnet:*) exec mandoc -a "$1" ;; *.o|*.a) - exec objdump -d "$1" | exec less + exec radare2 "$1" ;; *) [ -d "$1" ] && exec io-src "$1" diff --git a/daemon/monitor b/daemon/monitor @@ -1,3 +1,4 @@ #!/bin/sh -exec monitor "$1" & +mkdir -p "$HOME/var/stat/data" +exec vmstat "${1:-15}" | exec monitor > "$HOME/var/stat/data" & diff --git a/dot/emacs.d/init.el b/dot/emacs.d/init.el @@ -281,4 +281,16 @@ ; ------------------------------------------------------------------------------ +(c-add-style "epitech" + '("linux" + (c-offsets-alist + (func-decl-cont . 8) + (topmost-intro-cont . 8) + (member-init-cont . 8) + (inher-cont . 8) + (statement-cont . 8) + (arglist-cont . 8) + (arglist-cont-nonempty . 8)))) +(setq c-default-style "epitech") + (provide 'init) diff --git a/dot/profile b/dot/profile @@ -14,6 +14,14 @@ export C_INCLUDE_PATH="$HOME/usr/include" export LIBRARY_PATH="$HOME/usr/lib:/usr/local/lib/inotify" export LD_LIBRARY_PATH="$HOME/usr/lib:/usr/local/lib/inotify" +export LANG=en_US.UTF-8 +export LC_LC_COLLATE=C +export LC_CTYPE=en_US.UTF-8 +export LC_MONETARY=en_US.UTF-8 +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 LESS="-R" diff --git a/dot/xinitrc b/dot/xinitrc @@ -3,22 +3,7 @@ xsetroot -solid '#000000' xset +fp "$HOME/etc/fonts" while sleep 10 -do - xsetroot -name "$( - case $(uname) in - (Linux) - cat /sys/class/power_supply/BAT1/capacity - ;; - (*BSD) - bat=hw.sensors.acpibat1.watthour - prev="$(sysctl "${bat}3" | sed 's/.*=//' | tr -cd 0-9)" - curr="$(sysctl "${bat}4" | sed 's/.*=//' | tr -cd 0-9)" - expr "$prev" '*' 100 / "$curr" - ;; - esac - )% $( - date +'%Y/%m/%d %H:%M' - )" +do xsetroot -name "$(status)" done & exec dwm diff --git a/io/gopher b/io/gopher @@ -11,3 +11,4 @@ gopher://me0w.net/7/searx.dcgi gopher://jgw.mdns.org/7/.bin-cgi/gophermap.dcgi gopher://gopher.raumzeitlabor.org/1 gopher://gopher.leveck.us/1/cgi-bin/pg +gopher://tx.god.jp/1 diff --git a/man/git-index.1 b/man/git-index.1 @@ -11,8 +11,9 @@ .Sh DESCRIPTION The .Nm -script creates a static website presenting the files and commits of a git -repository. The build is incremential so that it can be triggered at every +script creates a static page listing the commits of a git repository, +as well as one page per commit. +The build process is incremential so that it can be triggered at every commit without large overhead. .Pp It only requires @@ -33,8 +34,6 @@ file will be created in the repository directory, containing a list of the files and the commits. .It Pa ./repository/commit/4279dbc3735e1e38bf33120c9234640d99fee650.html One html page per commit is created. -.It Pa ./repository/file/path/to/the/file -The file content of the .El .Sh EXAMPLES A script generating an index of multiple repositories might look like this: