dot

packages and services management
Log | Files | Refs | README

commit 19e012e7fdf0f8d190d45d95bf37638335dec46b
parent 908947e9d1453189ed2108ec44e9876815860f29
Author: Josuah Demangeon <mail@josuah.net>
Date:   Tue, 18 Apr 2017 23:31:08 +0200

added scripts and recipes

Diffstat:
Abin/fun-dump | 16++++++++++++++++
Mbin/fun-piano | 20++++++++++----------
Mbin/ii-client | 4++--
Mbin/io-grep | 25++++++++++++++++++-------
Abin/io-search | 11+++++++++++
Abin/io-unicode | 9+++++++++
Abuild/sent | 3+++
Abuild/wendy | 3+++
8 files changed, 72 insertions(+), 19 deletions(-)

diff --git a/bin/fun-dump b/bin/fun-dump @@ -0,0 +1,16 @@ +hexdump -C /dev/random | awk ' + + /eb/ { + printf("\033[1;32m"); + } + + /da/ { + printf("\033[1;7m"); + } + + { + gsub(/31/, "\033[1;31m##\033[m"); + gsub(/41/, "\033[1;7;31m**\033[m"); + printf("%s\033[m\n", $0); + } +' diff --git a/bin/fun-piano b/bin/fun-piano @@ -1,9 +1,9 @@ +#!/bin/awk -f # console piano using speaker-test -awk ' BEGIN { - # qwerty +# qwerty # ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ______ # |Esc |F1 |F2 |F3 |F4 |F5 |F6 |F7 |F8 |F9 |F10 |F11 |F12 |Del | # |____|____|____|____|____|____|____|____|____|____|____|____|____|______| @@ -23,7 +23,7 @@ BEGIN { QWERTY = "ZSXDCVGBHNJM<L>:/" "Q@W#ER%T^Y&UI(O)P{+}"; # With shift qwerty = qwerty QWERTY; - # dvorak +# dvorak # ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ______ # |Esc |F1 |F2 |F3 |F4 |F5 |F6 |F7 |F8 |F9 |F10 |F11 |F12 |Del | # |____|____|____|____|____|____|____|____|____|____|____|____|____|______| @@ -111,28 +111,28 @@ BEGIN { # convert the text line of frequencies into an array of frequencies split(row1 row2, frequencies, " "); - # main execution loop + system("stty raw -echo"); + # main execution loop while (1) { # get one character at a time from stdin (keyboard) - cmd = "dd bs=1 count=1 if=/dev/tty 2>/dev/null" - system("stty raw -echo"); + cmd = "dd bs=1 count=1 2>/dev/null" cmd | getline key - system("stty -raw echo"); close(cmd); # which key check it is, and play corresponding note # if Ctrl + C, quit if (key == "") { - exit; + break; # else, get the note from the array using key position in layout } else if (note = frequencies[index(layout, key)]) { # play the note with this frequency with some command - system("speaker-test -t sine -f " note " 1>&2 > /dev/null &" \ + system("speaker-test -Dsysdefault:Generic -t sine -f " note " 1>&2 > /dev/null &" \ "(sleep 0.5 && kill -9 $!) &"); } } + + system("stty -raw echo"); } -' diff --git a/bin/ii-client b/bin/ii-client @@ -14,7 +14,7 @@ get_char() } -# 1: key to use +#1 - key to use key() { @@ -113,7 +113,7 @@ main() stty sane - rm "$INPUT" + rm -f "$INPUT" } diff --git a/bin/io-grep b/bin/io-grep @@ -1,8 +1,19 @@ -# interactively search string in code +# run grep -r for a prompted directory and regex -find "$HOME" -type d | iomenu -p path | -xargs -I % find % -type f ! -path '*/.git/*' | -xargs awk ' - BEGIN { printf("# %s\n", FILENAME); } - { printf("%7s\t%s\n", FNR, $0); } -' | iomenu -s -h +# enter a regex +printf '\033[30;47m regex \033[m ' +IFS='' read -r regex + +find $HOME -type d ! -path '*/.git/*' | iomenu -p path | +xargs -I % find % -type f ! -path '*/.git/*' | while IFS='' read -r file +do + printf '# %s\n' "$file" + grep -n "$regex" "$file" +done | awk 'match($0, /:/) { + num = substr($0, 1, RSTART - 1); + sub(/^[^:]*:/, ""); + printf("%7s\t", num); +} { print }' | iomenu -s -h | { + IFS=' ' read -r path number content + ${EDITOR:-vi} +"$number" "${path#\# }" +} diff --git a/bin/io-search b/bin/io-search @@ -0,0 +1,11 @@ +# interactively search string in code + +find "$HOME" -type d ! -path '*/.git/*' | iomenu -p path | +xargs -I % find % -type f ! -path '*/.git/*' | +xargs -n 1 awk ' + FNR == 1 { printf("# %s\n", FILENAME); } + { printf("%7s\t%s\n", FNR, $0); } +' | iomenu -s -h | { + IFS=' ' read -r path number content + ${EDITOR:-vi} +"$number" "${path#\# }" +} diff --git a/bin/io-unicode b/bin/io-unicode @@ -0,0 +1,9 @@ +# prompt for an unicode character + +mkdir -p "$CACHE" +CACHE="$HOME/.cache/io" + +[ -f "$CACHE/unicode" ] || +wget -O- http://www.unicode.org/Public/UNIDATA/UnicodeData.txt | +cut -d ';' -f + diff --git a/build/sent b/build/sent @@ -0,0 +1,3 @@ +# simple presentation tool + +tar=http://dl.suckless.org/tools/sent-0.2.tar.gz diff --git a/build/wendy b/build/wendy @@ -0,0 +1,3 @@ +# monitor filesystem changes + +tar=http://dl.z3bra.org/releases/wendy-1.0.tar.bz2