dot

packages and services management
Log | Files | Refs | README

commit 2ed044f616c6aea4ceb87ca5ebb143bd0171779c
parent 9a7302b886aee1079b37e0ae95947cd4b5613a09
Author: Josuah Demangeon <mail@josuah.net>
Date:   Sun, 18 Feb 2018 23:32:13 +0100

added comments

Diffstat:
Mbin/agenda | 1+
Mbin/back | 21+++++++++++++++------
Mbin/edit | 6++++++
Mbin/irc | 3++-
Mbin/lt | 20++++++++++++++++++++
Mbin/mv-sane | 3++-
6 files changed, 46 insertions(+), 8 deletions(-)

diff --git a/bin/agenda b/bin/agenda @@ -1,4 +1,5 @@ #!/bin/sh + # plain text agenda reading ical with its own simpler format AGENDA="${AGENDA:-$HOME/.config/agenda}" diff --git a/bin/back b/bin/back @@ -1,23 +1,32 @@ #!/bin/sh -e -# store data in hash-indexed backups + +# store a directory tree in compressed and hash-indexed backups + +# A b2sum hash of every file in current directory is calculated and every file +# is copied to a $BACK/0/obj/ directory with the hash as its name. BACK="${BACK:-$HOME/back}" mkdir -p "$BACK/0/rev" "$BACK/0/obj" sum='b2sum -l 256' [ -r "$BACK/log" ] && -log="$BACK/0/rev/$(sed -n '$ s/[^ ]* // p' "$BACK/log")" +rev="$BACK/0/rev/$(sed -n '$ s/[^ ]* // p' "$BACK/log")" case "$1" in (up) [ -e "$BACK/0/new" ] && exit 1 + # Find all files in current directory. If newer than the latest + # revision, calculate their hash, otherwise, lookup their hash in + # the latest revision. For every file if they were not in the + # $BACK/0/obj directory already, copy them as a compressed file. + find . -type f '(' \ - -exec test "$log" -nt {} ';' \ - -exec grep -F {} "$log" ';' -o \ - -exec $sum {} + \ + -exec test "$rev" -nt {} ';' \ + -exec grep -F {} "$rev" ';' -o \ + -exec $sum {} + \ ')'| - tee "$BACK/0/new" | + tee "$BACK/0/new" | while read -r hash path do [ -f "$BACK/0/obj/$hash.lz4" ] || diff --git a/bin/edit b/bin/edit @@ -1,3 +1,9 @@ #!/bin/sh -e +# script to be used as EDITOR + +# If $EDITOR is set to vi(1), some shell switch to vi-style input, and I prefer +# emacs(1)-style input key bindings for everything REPL. This also permit to +# change the $EDITOR without reloading the environment variables. + exec vi "$@" diff --git a/bin/irc b/bin/irc @@ -1,5 +1,6 @@ #!/bin/sh -# ii client with iomenu(1) (selection), eel(1) (formatting), srw(1) (input) + +# ii(1) client with iomenu(1) (selection), eel(1) (formatting), srw(1) (input) if [ "$#" -eq 1 ] then diff --git a/bin/lt b/bin/lt @@ -1,6 +1,26 @@ #!/bin/sh + # list paths in a tree with some stat infos +# find walk the entire tree and then ({} + means call at the end) +# call ls -ld with all the result, which are then sorted. The +# result will be a list with all ls -l information and the the path +# name from the current directory (./). This pattern is used to +# delimit the find-style output, which is transformed into tree(1)-style +# output: +# +# drwxr-xr-x 2 josuah josuah 512 Feb 16 13:19 |- .ssh +# -rw-r--r-- 1 josuah josuah 870 Feb 9 02:24 | `- config +# drwxr-xr-x 2 josuah josuah 512 Feb 16 13:18 |- agenda +# -rw-r--r-- 1 josuah josuah 431094 Feb 14 14:06 | |- fosdem +# -rw-r--r-- 1 josuah josuah 1254 Feb 10 12:58 | `- main +# drwxr-xr-x 2 josuah josuah 1536 Feb 18 21:24 |- bin +# -rwxr-xr-x 1 josuah josuah 1351 Feb 18 22:30 | |- lt +# -rwxr-xr-x 1 josuah josuah 565 Feb 17 19:53 | |- mfilter +# -rwxr-xr-x 1 josuah josuah 76 Feb 17 19:41 | |- msearch +# -rwxr-xr-x 1 josuah josuah 5430 Feb 17 19:51 | `- xdg-open +# -rwxr-xr-x 1 josuah josuah 468 Feb 17 19:55 ... + LC_COLLATE=C cd "${1:-.}" diff --git a/bin/mv-sane b/bin/mv-sane @@ -1,5 +1,6 @@ #!/bin/sh -# remove evil characters + +# Remove evil characters. find . -mindepth 1 | while IFS='' read -r path do