dot

packages and services management
Log | Files | Refs | README

commit 374131d791289242a45dd171840930317628ba80
parent b19debc264bac7a29b21fb406525ade319e5ecf1
Author: josuah <mail@josuah.net>
Date:   Sun, 18 Sep 2016 00:22:20 -0400

Cleanup and added a draft for simple cli version control system

Diffstat:
Mbin/.cache/todo | 1-
Mbin/adagio | 5++++-
Mbin/agenda | 9+++++----
Dbin/align | 26--------------------------
Mbin/bkm | 9+++++----
Mbin/blawk | 3++-
Mbin/buffers | 3++-
Dbin/comment | 64----------------------------------------------------------------
Mbin/complete | 3++-
Mbin/dna | 7++++---
Mbin/drawk | 3++-
Dbin/fdiff | 79-------------------------------------------------------------------------------
Mbin/feeds | 3++-
Mbin/fig | 22+++++++++++++++-------
Mbin/irc | 10++++++----
Mbin/lsync | 3++-
Mbin/music | 5+++--
Mbin/peax | 3++-
Mbin/piano | 3++-
Mbin/piped | 3++-
Mbin/src | 11+++++++----
Mbin/swiper | 3++-
Mbin/todo | 8++++++++
Mbin/updd | 7++++---
Abin/version | 39+++++++++++++++++++++++++++++++++++++++
Mbin/www | 4++--
26 files changed, 122 insertions(+), 214 deletions(-)

diff --git a/bin/.cache/todo b/bin/.cache/todo @@ -11,4 +11,3 @@ vis-menu and completion: on CTRL + N, start vis-menu right under the cursor. vis: 0, $ and ^ to work even on empty lines irc: ASCII mail pizza delivering irc server Call 0223233079 to tell if OK for UR1.fr ---help diff --git a/bin/adagio b/bin/adagio @@ -3,8 +3,11 @@ # / /_ ___ ___ ____ # / __ \ .'__ \ .'__ \ / __ \ # / /_/ // ____// ____// /_/ / -# \____/ \___\ \___\ / ____/ - Albinoni, Adagio fog G minor adapted to 'beep' +# \____/ \___\ \___\ / ____/ #=====================\/======================================================== +# Albinoni, Adagio fog G minor adapted to 'beep' +# +# # Works better with busybox's beep #===[ NOTES FREQUENCIES ]======================================================= diff --git a/bin/agenda b/bin/agenda @@ -1,10 +1,11 @@ #!/bin/sh -# /\ -# _____ _____ ___ ____ ___/ / _____ +# /\ +# _____ _____ ___ ____ ___/ / _____ # .'__ /.'__ /.'__ \ / __ \ .'__ /.'__ / # / /_/ // /_/ // ____// / / // /_/ // /_/ / -# \____/_\__ / \___\ \/ \/ \____/ \____/ - Agenda from the command line +# \____/_\__ / \___\ \/ \/ \____/ \____/ #=======\__,-'================================================================= +# Agenda from the command line AGENDA="${AGENDA-$HOME/.cache/agenda}" COLUMNS="$(stty size | cut -d ' ' -f 2)" @@ -281,7 +282,7 @@ do ;; esac - [ -z "$DATE" ] && SEC="$(date +%s)" || SEC="$(date +%s -d "$DATE")" + [ "$DATE" ] && SEC="$(date +%s -d "$DATE")" || SEC="$(date +%s)" done $action diff --git a/bin/align b/bin/align @@ -1,26 +0,0 @@ -# /\ __ -# _____ / / \/ _____ ____ -# .'__ // / /\ .'__ // __ \ -# / /_/ // / / // /_/ // / / / -# \____/ \/ \/_\__ / \/ \/ - align text at char from stdin -#==============\__,-"=========================================================== - -NL=' -' - -lines="$(tee)" -align="$( - dd if=/dev/tty bs=1 count=1 2> /dev/null -)" -max=0 - -for line in $lines -do - current="${line%%$align*}" - [ ${#current} -gt $max ] && max="${#current}" -done - -printf '%s\n' "$lines" | while IFS="$NL" read -r line -do - printf "%-${max}s%s%s\n" "${line%%$align*}" "$align" "${line#*$align}" -done diff --git a/bin/bkm b/bin/bkm @@ -1,10 +1,11 @@ #!/bin/sh -# /\ /\ -# / /_ / / __ ________ -# / __ \ / /,','/ __ __ \ +# /\ /\ +# / /_ / / __ ________ +# / __ \ / /,','/ __ __ \ # / /_/ // ,' / / / / / / -# \____/ \/\_\ \/ \/ \/ - Tiny shell bookmark manager +# \____/ \/\_\ \/ \/ \/ #=============================================================================== +# Tiny shell bookmark manager BOOKMARKS="${BKM:-$HOME/.cache/bkm}" diff --git a/bin/blawk b/bin/blawk @@ -3,8 +3,9 @@ # / /_ /\ _____.__ /\ / / __ # / __ \ / /.'__ // /\/ // /,',' # / /_/ // // /_/ // / / // ,' -# \____/ \/ \____/ \____/ \/\_\ - Draw an image using block characters +# \____/ \/ \____/ \____/ \/\_\ #=============================================================================== +# Draw an image using block characters # USAGE: # blawk [columns lines] file [imagemagick_arguments] diff --git a/bin/buffers b/bin/buffers @@ -3,8 +3,9 @@ # / /_ __ /\ .' ___\.' ___\ ___ _____ # / __ \ / / / // .'_ / .'_ .'__ \ / ____\ # / /_/ // /_/ // ___/ / ___/ / ____// / -# \____/ \____/ \/ \/ \___\ \/ - run commands in detachable buffers +# \____/ \____/ \/ \/ \___\ \/ #=============================================================================== +# Run commands in detachable buffers # # External: stest, fzy, abduco # Busybox: mkdir, tee, sort, clear, tr, sed diff --git a/bin/comment b/bin/comment @@ -1,64 +0,0 @@ -#!/bin/sh -# comment - add comment to a code chunk from stdin -# /\ -# ____ ____ ________ ________ ___ ____ / /_ -# / ___\ / __ \ / __ __ \ / __ __ \ .'__ \ / __ \ / ___\ -# / /__ / /_/ // / / / / // / / / / // ____// / / // / -# \____\ \____/ \/ \/ \/ \/ \/ \/ \___\ \/ \/ \/ -#=============================================================================== - -NL=' -' -help=' -' -NL=' -' - -while [ $# -gt 0 ] -do - case "$1" in - -t ) type="$2" ;; - * ) printf '%s\n' ;; - shift 1 - esac -done - -case "$(printf %s "$filetype" | tr [A-Z] [a-z])" in -html | xml ) - start='<!' middle='--' end='>' - ;; -c | c++ | 'c#' | go | java | js ) - start='/' middle='*' end='/' - ;; -lua | sql ) - middle='--' - ;; -python | sh | bash | perl | ruby | r | rust | scala ) - middle='#' - ;; -haskell ) - start='{' middle='-' end='}' - ;; -ocaml | pascal ) - start='(' middle='*' end=')' - ;; -php ) - start='<' middle='*' end='>' - ;; -lisp ) - middle=';;' - ;; -* ) - printf 'Unknown file type\n' 1>&2 - exit 1 - ;; -esac - -while IFS="$NL" read -r line -do - [ "$start" ] && printf '%s\n' "$start" - - printf "%$((${#start} + 1))s%s\n" "$middle" "$line" - - [ "$end" ] && printf "%((${#start} + 1))s\n" "$end" -done diff --git a/bin/complete b/bin/complete @@ -3,8 +3,9 @@ # ____ ____ ________ ____ / / ___ / /_ ___ # / ___\ / __ \ / __ __ \ / __ \ / /.'__ \ / ___\.'__ \ # / /__ / /_/ // / / / / // /_/ // // ____// / / ____/ -# \____\ \____/ \/ \/ \// ____/ \/ \___\ \/ \___\ - with word in a file +# \____\ \____/ \/ \/ \// ____/ \/ \___\ \/ \___\ #=========================\/==================================================== +# Complete string with a word from a file. help=' NAME diff --git a/bin/dna b/bin/dna @@ -1,10 +1,11 @@ #!/bin/sh -# /\ -# ___/ /____ _____ +# /\ +# ___/ /____ _____ # .'__ // __ \ .'__ / # / /_/ // / / // /_/ / -# \____/ \/ \/ \____/ - Prints $dna with full structure, sequentially +# \____/ \/ \/ \____/ #=============================================================================== +# Prints $dna with full structure, sequentially # Usage: # dna [ATCG] with ATCG a string of one of these characters diff --git a/bin/drawk b/bin/drawk @@ -3,8 +3,9 @@ # ___/ /_____ _____ __ /\ / / __ # .'__ // ____\.'__ // /\/ // /,',' # / /_/ // / / /_/ // / / // ,' -# \____/ \/ \____/ \____/ \/\_\ - Drawille implementation in awk +# \____/ \/ \____/ \____/ \/\_\ #=============================================================================== +# Drawille implementation in awk # # USAGE: # drawk [columns lines] file [imagemagick_arguments] diff --git a/bin/fdiff b/bin/fdiff @@ -1,79 +0,0 @@ -# ____ /\ __ ____ ____ -# .' ___\ ___/ / \/ .' ___\.' ___\ -# / .'_ .'__ / /\ / .'_ / .'_ -# / ___/ / /_/ / / // ___/ / ___/ -# \/ \____/ \/ \/ \/ - Diff the file content of two directories -#=============================================================================== - -help=' -NAME - FDiff - Show a diff of the file content of two directories - -SYNTAX - fdiff [-e PATTERN] DIR1 DIR2 - -OPTIONS - -e Exclude PATTERN from search, matching the whole path. - DIR The two directories to mirror. -' - -[ $# -lt 2 ] && printf '%s\n\n' "$help" && exit 0 - -while [ $# -gt 0 ] -do - case "$1" in - '-e' ) e="$2"; shift ;; - '-'* ) printf '%s\n\n' "$help"; exit 0 ;; - * ) [ -z "$d1" ] && d1="${1%/}" || d2="${1%/}" ;; - esac - shift -done - -impaired=0 different=0 directories=0 identical=0 - -# Generate a path list for all the files from both directories -{ - find "$d1/" -mindepth 1 ! -path "$e" | cut -c $((${#d1} + 2))- - find "$d2/" -mindepth 1 ! -path "$e" | cut -c $((${#d2} + 2))- -} | sort -u | { - - while read -r path - do - if [ -d "$d1/$path" ] || [ -d "$d2/$path" ] - then - directories=$(($directories + 1)) - printf ': :\033[1;30m' - - elif [ ! -e "$d2/$path" ] - then - impaired=$(($impaired + 1)) - printf ': \033[32;1m>\033[0m :' - - elif [ ! -e "$d1/$path" ] - then - impaired=$(($impaired + 1)) - printf ': \033[32;1m<\033[0m :' - - elif cmp "$d2/$path" "$d1/$path" - then - identical=$(($identical + 1)) - printf ': \033[36;1m=\033[0m :' - - else - different=$(($different + 1)) - printf ': \033[31;1m!\033[0m :' - fi - - unset b - printf ' %s\033[0m\n' "$path" - done - - printf ' \ \ %-40s \033[1;30m%5s directories\033[0m - \ \__ %-40s \033[1;32m%5s\033[0m impaired - \_____ %-40s \033[1;36m%5s\033[0m identical - %-40s \033[1;31m%5s\033[0m different\n' \ - '' "$directories" \ - "$d1" "$impaired" \ - "$d2" "$identical" \ - '' "$different" -} diff --git a/bin/feeds b/bin/feeds @@ -3,8 +3,9 @@ # .' ___\ ___ ___ ___/ / ____ # / .'_ .'__ \ .'__ \ .'__ / / __/ # / ___/ / ____// ____// /_/ /__\ \ -# \/ \___\ \___\ \____/ \___/ - Simple RSS/ATOM feed reader +# \/ \___\ \___\ \____/ \___/ #=============================================================================== +# Simple RSS/ATOM feed reader FEEDS="${FEEDS-$HOME/.config/feeds}" BROWSER="${BROWSER-firefox}" diff --git a/bin/fig b/bin/fig @@ -1,5 +1,11 @@ #!/bin/sh -# fig - Figlet without all the bells and fanciness. +# ____ __ +# .' ___\ \/ _____ +# / .'_ /\ .'__ / +# / ___/ / // /_/ / +# \/ \/_\__ / +#===========\__,-"============================================================== +# Figlet without all the bells and fanciness. for word in $@ do line="$line $word" @@ -318,9 +324,11 @@ do done unset IFS -printf ' %s\n' "$l1" -printf ' %s\n' "$l2" -printf ' %s\n' "$l3" -printf ' %s\n' "$l4" -printf ' %s\n' "$l5" -printf '%s\n' "$l6" +{ + printf ' %s\n' "$l1" + printf ' %s\n' "$l2" + printf ' %s\n' "$l3" + printf ' %s\n' "$l4" + printf ' %s\n' "$l5" + printf '%s\n' "$l6" +} | sed 's/ *$//' diff --git a/bin/irc b/bin/irc @@ -3,8 +3,9 @@ # \/ _____ ____ # /\ / ____\/ ___\ # / // / / /__ -# \/ \/ \____\ - Irc client in 300 lines of shell script +# \/ \/ \____\ #=============================================================================== +# Irc client in 300 lines of shell script # # With help of http://xero.nu, inspired by http://tools.suckless.org/ii @@ -16,7 +17,7 @@ NL=' DIR="$HOME/.cache/irc" -# Functions +# FUNCTIONS #------------------------------------------------------------------------------- # @@ -35,7 +36,8 @@ write() connect() { local srv="$1" - [ -f "$srv/NICK" ] && user="$(tail "$srv/NICK")" [ -z "$user" ] && user="$NICK" + [ -f "$srv/NICK" ] && user="$(tail "$srv/NICK")" + [ -z "$user" ] && user="$NICK" mkdir -p "$srv" [ -p "$srv/IN" ] || mkfifo "$srv/IN" @@ -249,7 +251,7 @@ print_msg() } -# Algorythm +# ALGORYTHM #------------------------------------------------------------------------------- # Kill background jobs and delete named pipes while quitting diff --git a/bin/lsync b/bin/lsync @@ -3,8 +3,9 @@ # / / ____ __ /\ ____ ____ # / / / __// / / // __ \ / ___\ # / /__\ \ \ \/ // / / // /__ -# \/ \___/ __\ / \/ \/ \____\ - Sync from two local dirs +# \/ \___/ __\ / \/ \/ \____\ #==========\__,'================================================================ +# Sync two local directories. help=' NAME diff --git a/bin/music b/bin/music @@ -3,8 +3,9 @@ # ________ __ /\ ____ \/ ____ # / __ __ \ / / / / / __/ /\ / ___\ # / / / / / // /_/ /__\ \ / // /__ -# \/ \/ \/ \____/ \___/ \/ \____\ - prompt for a music to play with ffplay -#------------------------------------------------------------------------------- +# \/ \/ \/ \____/ \___/ \/ \____\ +#=============================================================================== +# Prompt for a music to play with ffplay cd "$HOME/Music" diff --git a/bin/peax b/bin/peax @@ -3,8 +3,9 @@ # ____ ___ _____ __ __ # / __ \ .'__ \ .'__ / \ \' / # / /_/ // ____// /_/ / ,' ,' -# / ____/ \___\ \____/ /_,\_\ - Pick a line from stdin +# / ____/ \___\ \____/ /_,\_\ #=\/============================================================================ +# Pick a line from stdin # Read the file from stdin BEGIN { diff --git a/bin/piano b/bin/piano @@ -3,8 +3,9 @@ # ____ \/ _____ ____ ____ # / __ \ /\ .'__ // __ \ / __ \ # / /_/ / / // /_/ // / / // /_/ / -# / ____/ \/ \____/ \/ \/ \____/ - Console beep piano! +# / ____/ \/ \____/ \/ \/ \____/ #=\/============================================================================ +# Console beep piano! BEGIN { diff --git a/bin/piped b/bin/piped @@ -2,8 +2,9 @@ # ____ \/ ____ ___ ___/ / # / __ \ /\ / __ \ .'__ \ .'__ / # / /_/ / / // /_/ // ____// /_/ / -# / ____/ \// ____/ \___\ \____/ - Pipe from stdin to stdout with $EDITOR +# / ____/ \// ____/ \___\ \____/ #=\/=========\/================================================================= +# Pipe from stdin to stdout with $EDITOR tmp="$(mktemp)" diff --git a/bin/src b/bin/src @@ -1,16 +1,18 @@ #!/bin/sh -# # ____ _____ ____ # / __// ____\/ ___\ # __\ \ / / / /__ -# \___/ \/ \____\ - install sources using crux-like package declaration. +# \___/ \/ \____\ #=============================================================================== +# Install sources using crux-like package declaration. + PROGRAMS="${PROGRAMS-$HOME/Programs}" PREFIX="$HOME/.local" CONFIG="${CONFIG-$HOME/Config}" CPATH="${CPATH-$PREFIX/include}" -#===[ FUNCTIONS ]=============================================================== +# FUNCTIONS +#------------------------------------------------------------------------------- help() { @@ -116,7 +118,8 @@ remove() rm -rf "$PROGRAMS/$name" } -#===[ ALGORYTHM ]=============================================================== +# ALGORYTHM +#------------------------------------------------------------------------------- [ $# -le 1 ] && help diff --git a/bin/swiper b/bin/swiper @@ -3,8 +3,9 @@ # ____ __ /\ \/ ____ ___ _____ # / __// /\/ / /\ / __ \ .'__ \ / ____\ # __\ \ / / / / / // /_/ // ____// / -# \___/ \____/ \// ____/ \___\ \/ - a search with an overview. +# \___/ \____/ \// ____/ \___\ \/ #=================\/================================================ +# A search with an overview. Oh, man! FILTER=fzy i=0 diff --git a/bin/todo b/bin/todo @@ -1,3 +1,11 @@ +# /\ /\ +# / /_ ____ ___/ /____ +# / ___\/ __ \ .'__ // __ \ +# / / / /_/ // /_/ // /_/ / +# \/ \____/ \____/ \____/ +#=============================================================================== +# Small todo list implementation + todo="$HOME/.cache/todo" t='' cmd='' if [ "$1" = e ]; then $EDITOR "$todo"; return 0; fi diff --git a/bin/updd b/bin/updd @@ -2,12 +2,14 @@ # __ /\ ____ ___/ / ___/ / # / / / // __ \ .'__ /.'__ / # / /_/ // /_/ // /_/ // /_/ / -# \____// ____/ \____/ \____/ - UPDate Date +# \____// ____/ \____/ \____/ #=======\/====================================================================== +# UPDate the Date in the end of the line or add some. + IFS=' ' read -r line; line="${line% *}" -printf "%s%$((80 - ${#line}))s\n" "$line" "$(date +"${1-%Y-%m-%d}")"- \ No newline at end of file +printf "%s%$((80 - ${#line}))s\n" "$line" "$(date +"${1-%Y-%m-%d}")" diff --git a/bin/version b/bin/version @@ -0,0 +1,39 @@ +#!/bin/sh +# __ +# __ /\ ___ _____ ____ \/ ____ ____ +# / / / /.'__ \ / ____\ / __/ /\ / __ \ / __ \ +# \ \/ // ____// / __\ \ / // /_/ // / / / +# \_,' \___\ \/ \___/ \/ \____/ \/ \/ +#=============================================================================== +# A very very simple version control system tool, made + +/ The top directory of the project. +| +|_ .version Version information. +| | +| |_ history History of all changes. +| | +| |_ 2016-01-30-18-20-18-5eOLF Result of mktemp [1]. +| |_ 2016-01-30-18-23-39-j3iuw +| |_ 2016-01-31-05-25-01-lT8xh +| |_ ... +| | +| |_ .version Result of find [2]. +| | +| |_ file1.txt Files that changed since previous state. +| +|_ README Content of the project at current state. +|_ src +| |_ Makefile +| |_ main.c +|_ file1.txt +|_ file2.txt +|_ ... + +version commit + +--- + +[1] mktemp -u "$(date +'%0Y-%0m-%0d-%0H:%0M:%0S')XXXXX" + +[2] . ! -path '*.version/*' diff --git a/bin/www b/bin/www @@ -1,10 +1,10 @@ #!/bin/sh -# # __ /\ __ /\ __ /\ # / /\/ // /\/ // /\/ / # / / / // / / // / / / -# \____/ \____/ \____/ - Static website generator +# \____/ \____/ \____/ #=============================================================================== +# Static website generator LAYOUT="layout.html" OUT="$(pwd)/.site" NL=' ' help='