From 77cfffee6177fb0421fa0fce15d6a1875bde4816 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20W=C3=BChrer?= Date: Sat, 18 May 2024 21:04:34 +0200 Subject: manuals, sum-down, radix --- all | 6 - any | 6 - bin/all | 6 + bin/any | 6 + bin/capitalise | 137 +++++++++++++++++ bin/clone | 24 +++ bin/colourlist | 26 ++++ bin/countdown | 23 +++ bin/countdown2 | 30 ++++ bin/ean13 | 22 +++ bin/embolden | 390 +++++++++++++++++++++++++++++++++++++++++++++++++ bin/giteval | 15 ++ bin/italicise | 269 ++++++++++++++++++++++++++++++++++ bin/map | 11 ++ bin/map-db | 60 ++++++++ bin/pf | 38 +++++ bin/pivot | 11 ++ bin/radix | 39 +++++ bin/reduce | 9 ++ bin/spt | 55 +++++++ bin/strjoin | 6 + bin/sum-down | 14 ++ bin/sum-up | 4 + bin/xmlbrowser | 39 +++++ bin/yamlbrowser | 58 ++++++++ capitalise | 137 ----------------- clone | 24 --- colorlist | 26 ---- countdown | 23 --- countdown2 | 30 ---- ean13 | 22 --- embolden | 390 ------------------------------------------------- giteval | 15 -- italicise | 269 ---------------------------------- man/man1/all.1 | 39 +++++ man/man1/any.1 | 41 ++++++ man/man1/capitalise.1 | 21 +++ man/man1/clone.1 | 44 ++++++ man/man1/colourlist.1 | 29 ++++ man/man1/countdown.1 | 25 ++++ man/man1/countdown2.1 | 26 ++++ man/man1/ean13.1 | 35 +++++ man/man1/embolden.1 | 21 +++ man/man1/giteval.1 | 31 ++++ man/man1/italicise.1 | 21 +++ man/man1/map-db.1 | 18 +++ man/man1/map.1 | 34 +++++ man/man1/pf.1 | 23 +++ man/man1/pivot.1 | 21 +++ man/man1/radix.1 | 31 ++++ man/man1/reduce.1 | 28 ++++ man/man1/spt.1 | 41 ++++++ man/man1/strjoin.1 | 40 +++++ man/man1/sum-down.1 | 25 ++++ man/man1/sum-up.1 | 25 ++++ man/man1/xmlbrowser.1 | 35 +++++ man/man1/yamlbrowser.1 | 44 ++++++ map | 11 -- map-db | 60 -------- pf | 38 ----- pivot | 11 -- reduce | 9 -- spt | 55 ------- strjoin | 6 - sum_up | 4 - xmlbrowser | 39 ----- yamlbrowser | 58 -------- 67 files changed, 1990 insertions(+), 1239 deletions(-) delete mode 100755 all delete mode 100755 any create mode 100755 bin/all create mode 100755 bin/any create mode 100755 bin/capitalise create mode 100755 bin/clone create mode 100755 bin/colourlist create mode 100755 bin/countdown create mode 100755 bin/countdown2 create mode 100755 bin/ean13 create mode 100755 bin/embolden create mode 100755 bin/giteval create mode 100755 bin/italicise create mode 100755 bin/map create mode 100755 bin/map-db create mode 100755 bin/pf create mode 100755 bin/pivot create mode 100755 bin/radix create mode 100755 bin/reduce create mode 100755 bin/spt create mode 100755 bin/strjoin create mode 100644 bin/sum-down create mode 100755 bin/sum-up create mode 100755 bin/xmlbrowser create mode 100755 bin/yamlbrowser delete mode 100755 capitalise delete mode 100755 clone delete mode 100755 colorlist delete mode 100755 countdown delete mode 100755 countdown2 delete mode 100755 ean13 delete mode 100755 embolden delete mode 100755 giteval delete mode 100755 italicise create mode 100644 man/man1/all.1 create mode 100644 man/man1/any.1 create mode 100644 man/man1/capitalise.1 create mode 100644 man/man1/clone.1 create mode 100644 man/man1/colourlist.1 create mode 100644 man/man1/countdown.1 create mode 100644 man/man1/countdown2.1 create mode 100644 man/man1/ean13.1 create mode 100644 man/man1/embolden.1 create mode 100644 man/man1/giteval.1 create mode 100644 man/man1/italicise.1 create mode 100644 man/man1/map-db.1 create mode 100644 man/man1/map.1 create mode 100644 man/man1/pf.1 create mode 100644 man/man1/pivot.1 create mode 100644 man/man1/radix.1 create mode 100644 man/man1/reduce.1 create mode 100644 man/man1/spt.1 create mode 100644 man/man1/strjoin.1 create mode 100644 man/man1/sum-down.1 create mode 100644 man/man1/sum-up.1 create mode 100644 man/man1/xmlbrowser.1 create mode 100644 man/man1/yamlbrowser.1 delete mode 100755 map delete mode 100755 map-db delete mode 100755 pf delete mode 100755 pivot delete mode 100755 reduce delete mode 100755 spt delete mode 100755 strjoin delete mode 100755 sum_up delete mode 100755 xmlbrowser delete mode 100755 yamlbrowser diff --git a/all b/all deleted file mode 100755 index dc33367..0000000 --- a/all +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -for i in $(seq 1 $#) -do - [[ ${!i} ]] || exit 1 -done diff --git a/any b/any deleted file mode 100755 index 9fd9234..0000000 --- a/any +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -for i in $(seq 1 $#) -do - [[ ${!i} ]] && exit 0 -done diff --git a/bin/all b/bin/all new file mode 100755 index 0000000..dc33367 --- /dev/null +++ b/bin/all @@ -0,0 +1,6 @@ +#!/bin/bash + +for i in $(seq 1 $#) +do + [[ ${!i} ]] || exit 1 +done diff --git a/bin/any b/bin/any new file mode 100755 index 0000000..9fd9234 --- /dev/null +++ b/bin/any @@ -0,0 +1,6 @@ +#!/bin/bash + +for i in $(seq 1 $#) +do + [[ ${!i} ]] && exit 0 +done diff --git a/bin/capitalise b/bin/capitalise new file mode 100755 index 0000000..479c55d --- /dev/null +++ b/bin/capitalise @@ -0,0 +1,137 @@ +#!/bin/bash + + +# Latin letter small capital a: UTF-8: e1 b4 80 UTF-16BE: 1d00 +# .0 .1 .2 .3 .4 .5 .6 .7 .8 .9 .A .B .C .D .E .F +# 1D0. ᴀ ᴁ ᴂ ᴃ ᴄ ᴅ ᴆ ᴇ ᴈ ᴉ ᴊ ᴋ ᴌ ᴍ ᴎ ᴏ +# 1D1. ᴐ ᴑ ᴒ ᴓ ᴔ ᴕ ᴖ ᴗ ᴘ ᴙ ᴚ ᴛ ᴜ ᴝ ᴞ ᴟ +# 1D2. ᴠ ᴡ ᴢ ᴣ ᴤ ᴥ ᴦ ᴧ ᴨ ᴩ ᴪ ᴫ ᴬ ᴭ ᴮ ᴯ +# 1D3. ᴰ ᴱ ᴲ ᴳ ᴴ ᴵ ᴶ ᴷ ᴸ ᴹ ᴺ ᴻ ᴼ ᴽ ᴾ ᴿ +# 1D4. ᵀ ᵁ ᵂ ᵃ ᵄ ᵅ ᵆ ᵇ ᵈ ᵉ ᵊ ᵋ ᵌ ᵍ ᵎ ᵏ +# 1D5. ᵐ ᵑ ᵒ ᵓ ᵔ ᵕ ᵖ ᵗ ᵘ ᵙ ᵚ ᵛ ᵜ ᵝ ᵞ ᵟ +# 1D6. ᵠ ᵡ ᵢ ᵣ ᵤ ᵥ ᵦ ᵧ ᵨ ᵩ ᵪ ᵫ ᵬ ᵭ ᵮ ᵯ +# 1D7. ᵰ ᵱ ᵲ ᵳ ᵴ ᵵ ᵶ ᵷ ᵸ ᵹ ᵺ ᵻ ᵼ ᵽ ᵾ ᵿ +# 1D8. ᶀ ᶁ ᶂ ᶃ ᶄ ᶅ ᶆ ᶇ ᶈ ᶉ ᶊ ᶋ ᶌ ᶍ ᶎ ᶏ +# 1D9. ᶐ ᶑ ᶒ ᶓ ᶔ ᶕ ᶖ ᶗ ᶘ ᶙ ᶚ ᶛ ᶜ ᶝ ᶞ ᶟ +# 1DA. ᶠ ᶡ ᶢ ᶣ ᶤ ᶥ ᶦ ᶧ ᶨ ᶩ ᶪ ᶫ ᶬ ᶭ ᶮ ᶯ +# 1DB. ᶰ ᶱ ᶲ ᶳ ᶴ ᶵ ᶶ ᶷ ᶸ ᶹ ᶺ ᶻ ᶼ ᶽ ᶾ ᶿ +# TODO: Greek letter small capital +declare -A smallcaps=( + [a]=$'\xe1\xb4\x80' + [æ]=$'\xe1\xb4\x81' + [b]=$'\xca\x99' + [c]=$'\xe1\xb4\x84' + [d]=$'\xe1\xb4\x85' + [e]=$'\xe1\xb4\x87' + [f]=$'\xea\x9c\xb0' + [g]=$'\xc9\xa2' + [h]=$'\xca\x9c' + [i]=$'\xc9\xaa' + [j]=$'\xe1\xb4\x8a' + [k]=$'\xe1\xb4\x8b' + [l]=$'\xca\x9f' + [m]=$'\xe1\xb4\x8d' + [n]=$'\xc9\xb4' + [o]=$'\xe1\xb4\x8f' + [œ]=$'\xc9\xb6' + [p]=$'\xe1\xb4\x98' + [q]=$'\xea\x9e\xaf' + [r]=$'\xca\x80' + [s]=$'\xea\x9c\xb1' + [t]=$'\xe1\xb4\x9b' + [u]=$'\xe1\xb4\x9c' + [v]=$'\xe1\xb4\xa0' + [w]=$'\xe1\xb4\xa1' + [x]=x # Missing + [y]=$'\xca\x8f' + [z]=$'\xe1\xb4\xa2' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +# []=$'\x1d\x' +) + +while IFS= read -r line +do + replacement="" + for i in $(seq 0 "$((${#line}-1))") + do + c1=${line:$i:1} + # if [[ $c1 =~ [a-zA-Zα-ωΑ-Ω] ]] + if [[ $c1 =~ [a-zæœ] ]] + then replacement+=${smallcaps[$c1]} + else replacement+=$c1 + fi + done + echo "$replacement" +done diff --git a/bin/clone b/bin/clone new file mode 100755 index 0000000..cfad1af --- /dev/null +++ b/bin/clone @@ -0,0 +1,24 @@ +#!/bin/bash + +set -eu + +args=() +for url in "$@" +do + case $url in + https://*|git://*) + dir=${url#*//} + dir=${dir%/*} + ;; git@*) + dir=${url#git@} + dir=${dir/://} + dir=${dir%/*} + ;; *) + args+=("$url") + continue + esac + mkdir -vp ~/src/"$dir" + cd ~/src/"$dir" + git clone --verbose --progress "${args[@]}" "$url" + args=() +done diff --git a/bin/colourlist b/bin/colourlist new file mode 100755 index 0000000..49b8442 --- /dev/null +++ b/bin/colourlist @@ -0,0 +1,26 @@ +#!/usr/bin/python3 + +import tkinter +from tkinter.constants import * + +window = tkinter.Tk () +window.wm_title ('X11 Colours') + +canvas = tkinter.Canvas (window) +frame = tkinter.Frame (canvas) +scrollbar = tkinter.Scrollbar (window, command=canvas.yview) +canvas.configure (yscrollcommand=scrollbar.set) + +scrollbar.pack(fill=Y, expand=1, side=RIGHT) +canvas.pack (fill=BOTH, expand=1, side=LEFT) +canvas.create_window ((0,0), window=frame, anchor=NW) +frame.bind ("", lambda e: canvas.configure (scrollregion=canvas.bbox ('all'))) + +with open ("/etc/X11/rgb.txt") as txt: + colours = txt.readlines () + +for r,g,b,name in ((int(l[0]),int(l[1]),int(l[2]),l[3]) for l in (colour.rstrip ().split (maxsplit=3) for colour in colours[1:])): + # Each colour band should be weighted: Half red is not as bright as half green. + tkinter.Label (frame, text=f'{name} ({r+b+g})', bg=f'#{r:02x}{g:02x}{b:02x}',fg='black' if r+g+b > 381 else 'white').pack (fill=X, expand=1) + +window.mainloop () diff --git a/bin/countdown b/bin/countdown new file mode 100755 index 0000000..59daf56 --- /dev/null +++ b/bin/countdown @@ -0,0 +1,23 @@ +#!/bin/bash + +declare -i t=$1 + +while [ $((t--)) -ne 0 ]; do + if [ $t -gt 5400 ]; then + h=$((t/3600)) + m=$(((t-(h*3600))/60)) + if [ $m -lt 10 ]; then m=0$m; fi + s=$((t%60)) + if [ $s -lt 10 ]; then s=0$s; fi + echo -en "\r$h:$m:$s " + elif [ $t -gt 90 ]; then + m=$((t/60)) + s=$((t%60)) + if [ $s -lt 10 ]; then s=0$s; fi + echo -en "\r$m:$s " + else + echo -en "\r$t " + fi + sleep 1 +done +echo -en "\r" diff --git a/bin/countdown2 b/bin/countdown2 new file mode 100755 index 0000000..615f6eb --- /dev/null +++ b/bin/countdown2 @@ -0,0 +1,30 @@ +#!/bin/bash + +if [ -z "$1" ]; then echo "usage $0 date"; exit 1; fi + +declare -ir t=`date +%s -d "$1"`; + +declare -i d=t-`date +%s`; +while [ $d -gt 0 ]; do + #yyyy-mm-ddThh:mm:ss + #ww-dd hh:mm:ss + if [ $d -gt 5400 ]; then + h=$((d/3600)) + m=$(((d-(h*3600))/60)) + if [ $m -lt 10 ]; then m=0$m; fi + s=$((d%60)) + if [ $s -lt 10 ]; then s=0$s; fi + echo -en "\r$h:$m:$s " + elif [ $d -gt 90 ]; then + m=$((d/60)) + s=$((d%60)) + if [ $s -lt 10 ]; then s=0$s; fi + echo -en "\r$m:$s " + else + echo -en "\r$d " + fi + #echo -en "\r$d\t"; + sleep 1; + d=t-`date +%s`; +done +echo -en "\r" diff --git a/bin/ean13 b/bin/ean13 new file mode 100755 index 0000000..6fd125a --- /dev/null +++ b/bin/ean13 @@ -0,0 +1,22 @@ +#!/bin/bash +while [[ $1 ]] +do +[[ ${#1} -eq 13 ]] || [[ ${#1} -eq 12 ]] || { + printf >&2 'length is %d, should be 13\n' ${#1} + exit 1 +} +declare -i checksum=0 +declare -i factor=1 +for i in {0..11} +do + v=${1:i:1} + checksum=$((checksum+factor*v)) + factor=$((factor^2)) +#printf >&2 'v: %s : cs=%d f=%d\n' "$v" $checksum $factor +done +if [[ ${#1} -eq 12 ]] +then echo "$1"$((10-checksum%10)) +else [[ $((10-checksum%10)) -eq ${1:12} ]] || exit +fi +shift +done diff --git a/bin/embolden b/bin/embolden new file mode 100755 index 0000000..75df549 --- /dev/null +++ b/bin/embolden @@ -0,0 +1,390 @@ +#!/bin/bash + +# For bold and italic we can use the Mathematical font variant mappings, +# although those are only defined for Latin and Greek. +# Latin bold capital: u1d400 - u1d419 +# Latin bold small: u1d41a - u1d433 +# Latin italic capital: u1d434 - u1d44d +# Latin italic small: u1d44e - u1d467 +# Latin bold italic capital: u1d468 - u1d481 +# Latin bold italic small: u1d482 - u1d49b +# (Script capital, script small, bold script capital, bold script small) +# (Fraktur capital, fraktur small) +# (Double-struck capital, double-struck small) +# (some Hebrew symbol variants) +# (Bold fraktur capital, bold fraktur small) +# (Sans-serif capital, sans-serif small) +# (Sans-serif bold capital, sans-serif bold small) +# (Sans-serif italic capital, sans-serif italic small) +# (Sans-serif bold italic capital, sans-serif bold italic small) +# (Monospace capital, monospace small) +# Greek bold capital: u1d6a8 - u1d6c0 +# Greek bold small: u1d6c2 - u1d6da +# Greek italic capital: u1d6e2 - u1d6fa +# Greek italic small: u1dcfc - u1d714 +# Greek bold italic capital: u1d71c - u1d734 +# Greek bold italic small: u1d736 - u1d74e +# (Greek sans-serif bold capital: u1d756 - u1d76e) +# (Greek sans-serif bold small: u1d770 - u1d788) +# (Greek sans-serif bold italic capital: u1d790 - u1d7a8) +# (Greek sans-serif bold italic small: u1d7aa - u1d7c2) +# bold digits: u1d7ce - u1d7d7 +# (double-struck digits) +# (sans-serif digits) +# (sans-serif bold digits) +# (monospace digits) +# (Arabic mathematical) +# (Arabic stretched) +# (Arabic looped) +# (Arabic double-struck) +# +# It turns out there are no Unicode control codes for marking text +# bold or italic. There are for subscript and superscript, +# and ASCII has similar codes which nobody ever uses. + +declare -A bold=( + [0]=$'\xf0\x9d\x9f\x8e' + [1]=$'\xf0\x9d\x9f\x8f' + [2]=$'\xf0\x9d\x9f\x90' + [3]=$'\xf0\x9d\x9f\x91' + [4]=$'\xf0\x9d\x9f\x92' + [5]=$'\xf0\x9d\x9f\x93' + [6]=$'\xf0\x9d\x9f\x94' + [7]=$'\xf0\x9d\x9f\x95' + [8]=$'\xf0\x9d\x9f\x96' + [9]=$'\xf0\x9d\x9f\x97' + [A]=$'\xf0\x9d\x90\x80' + [B]=$'\xf0\x9d\x90\x81' + [C]=$'\xf0\x9d\x90\x82' + [D]=$'\xf0\x9d\x90\x83' + [E]=$'\xf0\x9d\x90\x84' + [F]=$'\xf0\x9d\x90\x85' + [G]=$'\xf0\x9d\x90\x86' + [H]=$'\xf0\x9d\x90\x87' + [I]=$'\xf0\x9d\x90\x88' + [J]=$'\xf0\x9d\x90\x89' + [K]=$'\xf0\x9d\x90\x8a' + [L]=$'\xf0\x9d\x90\x8b' + [M]=$'\xf0\x9d\x90\x8c' + [N]=$'\xf0\x9d\x90\x8d' + [O]=$'\xf0\x9d\x90\x8e' + [P]=$'\xf0\x9d\x90\x8f' + [Q]=$'\xf0\x9d\x90\x90' + [R]=$'\xf0\x9d\x90\x91' + [S]=$'\xf0\x9d\x90\x92' + [T]=$'\xf0\x9d\x90\x93' + [U]=$'\xf0\x9d\x90\x94' + [V]=$'\xf0\x9d\x90\x95' + [W]=$'\xf0\x9d\x90\x96' + [X]=$'\xf0\x9d\x90\x97' + [Y]=$'\xf0\x9d\x90\x98' + [Z]=$'\xf0\x9d\x90\x99' + [a]=$'\xf0\x9d\x90\x9a' + [b]=$'\xf0\x9d\x90\x9b' + [c]=$'\xf0\x9d\x90\x9c' + [d]=$'\xf0\x9d\x90\x9d' + [e]=$'\xf0\x9d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bd' + [Χ]=$'\xf0\x9d\x9a\xbe' + [Ψ]=$'\xf0\x9d\x9a\xbf' + [Ω]=$'\xf0\x9d\x9b\x80' + [α]=$'\xf0\x9d\x9b\x82' + [β]=$'\xf0\x9d\x9b\x83' + [γ]=$'\xf0\x9d\x9b\x84' + [δ]=$'\xf0\x9d\x9b\x85' + [ε]=$'\xf0\x9d\x9b\x86' + [ζ]=$'\xf0\x9d\x9b\x87' + [η]=$'\xf0\x9d\x9b\x88' + [θ]=$'\xf0\x9d\x9b\x89' + [ι]=$'\xf0\x9d\x9b\x8a' + [κ]=$'\xf0\x9d\x9b\x8b' + [λ]=$'\xf0\x9d\x9b\x8c' + [μ]=$'\xf0\x9d\x9b\x8d' + [ν]=$'\xf0\x9d\x9b\x8e' + [ξ]=$'\xf0\x9d\x9b\x8f' + [ο]=$'\xf0\x9d\x9b\x90' + [π]=$'\xf0\x9d\x9b\x91' + [ρ]=$'\xf0\x9d\x9b\x92' + [ς]=$'\xf0\x9d\x9b\x93' + [σ]=$'\xf0\x9d\x9b\x94' + [τ]=$'\xf0\x9d\x9b\x95' + [υ]=$'\xf0\x9d\x9b\x96' + [φ]=$'\xf0\x9d\x9b\x97' + [χ]=$'\xf0\x9d\x9b\x98' + [ψ]=$'\xf0\x9d\x9b\x99' + [ω]=$'\xf0\x9d\x9b\x9a' +# [𝐴̱]= +# [𝐵̱]= +# [𝐶̱]= +# [𝐷̱]= +# [𝐸̱]= +# [𝐹̱]= +# [𝐺̱]= +# [𝐻̱]= +# [𝐼̱]= +# [𝐽̱]= +# [𝐾̱]= +# [𝐿̱]= +# [𝑀̱]= +# [𝑁̱]= +# [𝑂̱]= +# [𝑃̱]= +# [𝑄̱]= +# [𝑅̱]= +# [𝑆̱]= +# [𝑇̱]= +# [𝑈̱]= +# [𝑉̱]= +# [𝑊̱]= +# [𝑋̱]= +# [𝑌̱]= +# [𝑍̱]= +# [𝑎̱]= +# [𝑏̱]= +# [𝑐̱]= +# [𝑑̱]= +# [𝑒̱]= +# [𝑓̱]= +# [𝑔̱]= +# [𝘩̱]= +# [𝑖̱]= +# [𝑗̱]= +# [𝑘̱]= +# [𝑙̱]= +# [𝑚̱]= +# [𝑛̱]= +# [𝑜̱]= +# [𝑝̱]= +# [𝑞̱]= +# [𝑟̱]= +# [𝑠̱]= +# [𝑡̱]= +# [𝑢̱]= +# [𝑣̱]= +# [𝑤̱]= +# [𝑥̱]= +# [𝑦̱]= +# [𝑧]= + [𝟢]=$'\xf0\x9d\x9f\xac' + [𝟣]=$'\xf0\x9d\x9f\xad' + [𝟤]=$'\xf0\x9d\x9f\xae' + [𝟥]=$'\xf0\x9d\x9f\xaf' + [𝟦]=$'\xf0\x9d\x9f\xb0' + [𝟧]=$'\xf0\x9d\x9f\xb1' + [𝟨]=$'\xf0\x9d\x9f\xb2' + [𝟩]=$'\xf0\x9d\x9f\xb3' + [𝟪]=$'\xf0\x9d\x9f\xb4' + [𝟫]=$'\xf0\x9d\x9f\xb5' +) + +declare -A italic=( + [A]=$'\xf0\x9d\x90\xb4' + [B]=$'\xf0\x9d\x90\xb5' + [C]=$'\xf0\x9d\x90\xb6' + [D]=$'\xf0\x9d\x90\xb7' + [E]=$'\xf0\x9d\x90\xb8' + [F]=$'\xf0\x9d\x90\xb9' + [G]=$'\xf0\x9d\x90\xba' + [H]=$'\xf0\x9d\x90\xbb' + [I]=$'\xf0\x9d\x90\xbc' + [J]=$'\xf0\x9d\x90\xbd' + [K]=$'\xf0\x9d\x90\xbe' + [L]=$'\xf0\x9d\x90\xbf' + [M]=$'\xf0\x9d\x91\x80' + [N]=$'\xf0\x9d\x91\x81' + [O]=$'\xf0\x9d\x91\x82' + [P]=$'\xf0\x9d\x91\x83' + [Q]=$'\xf0\x9d\x91\x84' + [R]=$'\xf0\x9d\x91\x85' + [S]=$'\xf0\x9d\x91\x86' + [T]=$'\xf0\x9d\x91\x87' + [U]=$'\xf0\x9d\x91\x88' + [V]=$'\xf0\x9d\x91\x89' + [W]=$'\xf0\x9d\x91\x8a' + [X]=$'\xf0\x9d\x91\x8b' + [Y]=$'\xf0\x9d\x91\x8c' + [Z]=$'\xf0\x9d\x91\x8d' + [a]=$'\xf0\x9d\x91\x8e' + [b]=$'\xf0\x9d\x91\x8f' + [c]=$'\xf0\x9d\x91\x90' + [d]=$'\xf0\x9d\x91\x91' + [e]=$'\xf0\x9d\x91\x92' + [f]=$'\xf0\x9d\x91\x93' + [g]=$'\xf0\x9d\x91\x94' + [h]=$'\xf0\x9d\x98\xa9' # Sans-serif, because f0 9d 91 95 is not assigned. + [i]=$'\xf0\x9d\x91\x96' + [j]=$'\xf0\x9d\x91\x97' + [k]=$'\xf0\x9d\x91\x98' + [l]=$'\xf0\x9d\x91\x99' + [m]=$'\xf0\x9d\x91\x9a' + [n]=$'\xf0\x9d\x91\x9b' + [o]=$'\xf0\x9d\x91\x9c' + [p]=$'\xf0\x9d\x91\x9d' + [q]=$'\xf0\x9d\x91\x9e' + [r]=$'\xf0\x9d\x91\x9f' + [s]=$'\xf0\x9d\x91\xa0' + [t]=$'\xf0\x9d\x91\xa1' + [u]=$'\xf0\x9d\x91\xa2' + [v]=$'\xf0\x9d\x91\xa3' + [w]=$'\xf0\x9d\x91\xa4' + [x]=$'\xf0\x9d\x91\xa5' + [y]=$'\xf0\x9d\x91\xa6' + [z]=$'\xf0\x9d\x91\xa7' + [Α]=$'\xf0\x9d\x9b\xa2' + [Β]=$'\xf0\x9d\x9b\xa3' + [Γ]=$'\xf0\x9d\x9b\xa4' + [Δ]=$'\xf0\x9d\x9b\xa5' + [Ε]=$'\xf0\x9d\x9b\xa6' + [Ζ]=$'\xf0\x9d\x9b\xa7' + [Η]=$'\xf0\x9d\x9b\xa8' + [Θ]=$'\xf0\x9d\x9b\xa9' + [Ι]=$'\xf0\x9d\x9b\xaa' + [Κ]=$'\xf0\x9d\x9b\xab' + [Λ]=$'\xf0\x9d\x9b\xac' + [Μ]=$'\xf0\x9d\x9b\xad' + [Ν]=$'\xf0\x9d\x9b\xae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̱]= +# [𝐌̱]= +# [𝐍̱]= +# [𝐎̱]= +# [𝐏̱]= +# [𝐐̱]= +# [𝐑̱]= +# [𝐒̱]= +# [𝐓̱]= +# [𝐔̱]= +# [𝐕̱]= +# [𝐖̱]= +# [𝐗̱]= +# [𝐘̱]= +# [𝐙̱]= +# [𝐚̱]= +# [𝐛̱]= +# [𝐜̱]= +# [𝐝̱]= +# [𝐞̱]= +# [𝐟̱]= +# [𝐠̱]= +# [𝐡̱]= +# [𝐢̱]= +# [𝐣̱]= +# [𝐤̱]= +# [𝐥̱]= +# [𝐦̱]= +# [𝐧̱]= +# [𝐨̱]= +# [𝐩̱]= +# [𝐪̱]= +# [𝐫̱]= +# [𝐬̱]= +# [𝐭̱]= +# [𝐮̱]= +# [𝐯̱]= +# [𝐰̱]= +# [𝐱̱]= +# [𝐲̱]= +# [𝐳]= +) + +# case $0 in embolden) italicise) script) fracture) double-strike) sans-serif) monospace) stretch) loop) mathise) + +while IFS= read -r line +do for i in $(seq 0 $((${#line}-1))) + do + c1=${line:$i:1} + # if [[ ${bold[$c1]} ]] + if [[ $c1 =~ [0-9a-zA-Zα-ωΑ-Ω𝐴̱-𝑍̱𝑎̱-𝑧] ]] + then replacement+=${bold[$c1]} + else replacement+=$'\u0331'$c1 + fi + done + echo "$replacement" +done diff --git a/bin/giteval b/bin/giteval new file mode 100755 index 0000000..48d35a8 --- /dev/null +++ b/bin/giteval @@ -0,0 +1,15 @@ +#!/bin/bash + +b=$(git branch --show-current 2> /dev/null) && { + case $(env - git status --no-ahead-behind | tail -n1) in + 'nothing to commit'*) + printf '\[\e[32m\][%s]\[\e[0m\]' "$b" + ;; 'no changes added to commit'*) + printf '\[\e[33m\][%s]\[\e[0m\]' "$b" + ;; 'nothing added to commit'*) + printf '\[\e[36m\][%s]\[\e[0m\]' "$b" + ;; *) + printf '\[\e[31m\][%s]\[\e[0m\]' "$b" + esac +} +echo diff --git a/bin/italicise b/bin/italicise new file mode 100755 index 0000000..d9fcb57 --- /dev/null +++ b/bin/italicise @@ -0,0 +1,269 @@ +#!/bin/bash + + +# For bold and italic we can use the Mathematical font variant mappings, +# although those are only defined for Latin and Greek. +# Latin letter small capital a: UTF-8: e1 b4 80 UTF-16BE: 1d00 Decimal: ᴀ Octal: \016400 +# Latin bold capital: u1d400 - u1d419 +# Latin bold small: u1d41a - u1d433 +# Latin italic capital: u1d434 - u1d44d +# Latin italic small: u1d44e - u1d467 +# Latin bold italic capital: u1d468 - u1d481 +# Latin bold italic small: u1d482 - u1d49b +# (Script capital, script small, bold script capital, bold script small) +# (Fraktur capital, fraktur small) +# (Double-struck capital, double-struck small) +# (some Hebrew symbol variants) +# (Bold fraktur capital, bold fraktur small) +# (Sans-serif capital, sans-serif small) +# (Sans-serif bold capital, sans-serif bold small) +# (Sans-serif italic capital, sans-serif italic small) +# (Sans-serif bold italic capital, sans-serif bold italic small) +# (Monospace capital, monospace small) +# Greek bold capital: u1d6a8 - u1d6c0 +# Greek bold small: u1d6c2 - u1d6da +# Greek italic capital: u1d6e2 - u1d6fa +# Greek italic small: u1dcfc - u1d714 +# Greek bold italic capital: u1d71c - u1d734 +# Greek bold italic small: u1d736 - u1d74e +# (Greek sans-serif bold capital: u1d756 - u1d76e) +# (Greek sans-serif bold small: u1d770 - u1d788) +# (Greek sans-serif bold italic capital: u1d790 - u1d7a8) +# (Greek sans-serif bold italic small: u1d7aa - u1d7c2) +# bold digits: u1d7ce - u1d7d7 +# (double-struck digits) +# (sans-serif digits) +# (sans-serif bold digits) +# (monospace digits) +# (Arabic mathematical) +# (Arabic stretched) +# (Arabic looped) +# (Arabic double-struck) +# +# It turns out there are no Unicode control codes for marking text +# bold or italic. There are for subscript and superscript, +# and ASCII has similar codes which nobody ever uses. + +declare -A bold=( + [A]=$'\xf0\x9d\x90\x80' + [B]=$'\xf0\x9d\x90\x81' + [C]=$'\xf0\x9d\x90\x82' + [D]=$'\xf0\x9d\x90\x83' + [E]=$'\xf0\x9d\x90\x84' + [F]=$'\xf0\x9d\x90\x85' + [G]=$'\xf0\x9d\x90\x86' + [H]=$'\xf0\x9d\x90\x87' + [I]=$'\xf0\x9d\x90\x88' + [J]=$'\xf0\x9d\x90\x89' + [K]=$'\xf0\x9d\x90\x8a' + [L]=$'\xf0\x9d\x90\x8b' + [M]=$'\xf0\x9d\x90\x8c' + [N]=$'\xf0\x9d\x90\x8d' + [O]=$'\xf0\x9d\x90\x8e' + [P]=$'\xf0\x9d\x90\x8f' + [Q]=$'\xf0\x9d\x90\x90' + [R]=$'\xf0\x9d\x90\x91' + [S]=$'\xf0\x9d\x90\x92' + [T]=$'\xf0\x9d\x90\x93' + [U]=$'\xf0\x9d\x90\x94' + [V]=$'\xf0\x9d\x90\x95' + [W]=$'\xf0\x9d\x90\x96' + [X]=$'\xf0\x9d\x90\x97' + [Y]=$'\xf0\x9d\x90\x98' + [Z]=$'\xf0\x9d\x90\x99' + [a]=$'\xf0\x9d\x90\x9a' + [b]=$'\xf0\x9d\x90\x9b' + [c]=$'\xf0\x9d\x90\x9c' + [d]=$'\xf0\x9d\x90\x9d' + [e]=$'\xf0\x9d\x90\x9e' + [f]=$'\xf0\x9d\x90\x9f' + [g]=$'\xf0\x9d\x90\xa0' + [h]=$'\xf0\x9d\x90\xa1' + [i]=$'\xf0\x9d\x90\xa2' + [j]=$'\xf0\x9d\x90\xa3' + [k]=$'\xf0\x9d\x90\xa4' + [l]=$'\xf0\x9d\x90\xa5' + [m]=$'\xf0\x9d\x90\xa6' + [n]=$'\xf0\x9d\x90\xa7' + [o]=$'\xf0\x9d\x90\xa8' + [p]=$'\xf0\x9d\x90\xa9' + [q]=$'\xf0\x9d\x90\xaa' + [r]=$'\xf0\x9d\x90\xab' + [s]=$'\xf0\x9d\x90\xac' + [t]=$'\xf0\x9d\x90\xad' + [u]=$'\xf0\x9d\x90\xae' + [v]=$'\xf0\x9d\x90\xaf' + [w]=$'\xf0\x9d\x90\xb0' + [x]=$'\xf0\x9d\x90\xb1' + [y]=$'\xf0\x9d\x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x9d\x9b\x91' + [ρ]=$'\xf0\x9d\x9b\x92' + [ς]=$'\xf0\x9d\x9b\x93' + [σ]=$'\xf0\x9d\x9b\x94' + [τ]=$'\xf0\x9d\x9b\x95' + [υ]=$'\xf0\x9d\x9b\x96' + [φ]=$'\xf0\x9d\x9b\x97' + [χ]=$'\xf0\x9d\x9b\x98' + [ψ]=$'\xf0\x9d\x9b\x99' + [ω]=$'\xf0\x9d\x9b\x9a' +) + +declare -A italic=( + [A]=$'\xf0\x9d\x90\xb4' + [B]=$'\xf0\x9d\x90\xb5' + [C]=$'\xf0\x9d\x90\xb6' + [D]=$'\xf0\x9d\x90\xb7' + [E]=$'\xf0\x9d\x90\xb8' + [F]=$'\xf0\x9d\x90\xb9' + [G]=$'\xf0\x9d\x90\xba' + [H]=$'\xf0\x9d\x90\xbb' + [I]=$'\xf0\x9d\x90\xbc' + [J]=$'\xf0\x9d\x90\xbd' + [K]=$'\xf0\x9d\x90\xbe' + [L]=$'\xf0\x9d\x90\xbf' + [M]=$'\xf0\x9d\x91\x80' + [N]=$'\xf0\x9d\x91\x81' + [O]=$'\xf0\x9d\x91\x82' + [P]=$'\xf0\x9d\x91\x83' + [Q]=$'\xf0\x9d\x91\x84' + [R]=$'\xf0\x9d\x91\x85' + [S]=$'\xf0\x9d\x91\x86' + [T]=$'\xf0\x9d\x91\x87' + [U]=$'\xf0\x9d\x91\x88' + [V]=$'\xf0\x9d\x91\x89' + [W]=$'\xf0\x9d\x91\x8a' + [X]=$'\xf0\x9d\x91\x8b' + [Y]=$'\xf0\x9d\x91\x8c' + [Z]=$'\xf0\x9d\x91\x8d' + [a]=$'\xf0\x9d\x91\x8e' + [b]=$'\xf0\x9d\x91\x8f' + [c]=$'\xf0\x9d\x91\x90' + [d]=$'\xf0\x9d\x91\x91' + [e]=$'\xf0\x9d\x91\x92' + [f]=$'\xf0\x9d\x91\x93' + [g]=$'\xf0\x9d\x91\x94' + [h]=$'\xf0\x9d\x98\xa9' # Sans-serif, because f0 9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'\xf0\x9d\x9b\xba' + [α]=$'\xf0\x9d\x9b\xbc' + [β]=$'\xf0\x9d\x9b\xbd' + [γ]=$'\xf0\x9d\x9b\xbe' + [δ]=$'\xf0\x9d\x9b\xbf' + [ε]=$'\xf0\x9d\x9c\x80' + [ζ]=$'\xf0\x9d\x9c\x81' + [η]=$'\xf0\x9d\x9c\x82' + [θ]=$'\xf0\x9d\x9c\x83' + [ι]=$'\xf0\x9d\x9c\x84' + [κ]=$'\xf0\x9d\x9c\x85' + [λ]=$'\xf0\x9d\x9c\x86' + [μ]=$'\xf0\x9d\x9c\x87' + [ν]=$'\xf0\x9d\x9c\x88' + [ξ]=$'\xf0\x9d\x9c\x89' + [ο]=$'\xf0\x9d\x9c\x8a' + [π]=$'\xf0\x9d\x9c\x8b' + [ρ]=$'\xf0\x9d\x9c\x8c' + [ς]=$'\xf0\x9d\x9c\x8d' + [σ]=$'\xf0\x9d\x9c\x8e' + [τ]=$'\xf0\x9d\x9c\x8f' + [υ]=$'\xf0\x9d\x9c\x90' + [φ]=$'\xf0\x9d\x9c\x91' + [χ]=$'\xf0\x9d\x9c\x92' + [ψ]=$'\xf0\x9d\x9c\x93' + [ω]=$'\xf0\x9d\x9c\x94' +) + +# TODO: bold italics. + +while IFS= read -r line +do + replacement="" + for i in $(seq 0 "$((${#line}-1))") + do + c1=${line:$i:1} + if [[ $c1 =~ [a-zA-Zα-ωΑ-Ω] ]] + then replacement+=${italic[$c1]} + else replacement+=$'\u0331'$c1 + fi + done + echo "$replacement" +done diff --git a/bin/map b/bin/map new file mode 100755 index 0000000..ec514ad --- /dev/null +++ b/bin/map @@ -0,0 +1,11 @@ +#!/bin/bash + +fn=$1 +if [[ "$fn" = *\$1* ]] +then f(){ eval "$fn";} +else f(){ eval "$fn" "$1";} +fi +shift +for x in "$@" +do f "$x" +done diff --git a/bin/map-db b/bin/map-db new file mode 100755 index 0000000..feb528c --- /dev/null +++ b/bin/map-db @@ -0,0 +1,60 @@ +#!/bin/bash + +query(){ +# psql-gridware -A -F$'\t' -t -P pager=off -c "$@" +# psql-gridware -A -F$'\t' -P pager=off -P title=off -c "$@" + psql-gridware -A -F$'\t' -P pager=off -c "$@" +} + +exec {in}<&0 + +pforkey(){ + echo '>]' + open_table=0 + data=forkey +} +forkey(){ + # ${constraint name} FOREIGN KEY (${Column}) REFERENCES ${table}(${Column}) + read -ra line <<<"$Column" + this_column=${line[3]%)} + this_column=${this_column#(} + other_table=${line[5]%%(*} + other_column=${line[5]##*\(} + other_column=${other_column%)} + printf '%s:%s_out -> %s:%s_in\n' "$table" "$this_column" "$other_table" "$other_column" +} + +record(){ + if [[ $Nullable = 'not null' ]] + then + echo "$Column$Type" + else + echo "$Column$Type" + fi +} + +echo 'strict digraph db {' +echo 'node[shape=plain]' +query '\d' -t | cut -f 2,3 | grep table\$ | cut -f1 | while read -r table +do + printf '\e[1m%s\e[0m\n' "$table" >&2 + data=record + open_table=1 + echo + echo "$table [label=<" + echo '
' + while IFS=$'\t' read -r Column Type Collation Nullable Default + do + case $Column in + Foreign-key\ constraints:) + echo >&2 'foreign keys' + data=pforkey + ;; *:) + echo >&2 '… skipping '"$Column" + data=: + esac + $data + done < <(query '\d '"$table" <&${in} | tail -n+3 | tr -d $'\r') + [[ $open_table = 1 ]] && echo '
\\N
>]' +done +echo '}' diff --git a/bin/pf b/bin/pf new file mode 100755 index 0000000..0358689 --- /dev/null +++ b/bin/pf @@ -0,0 +1,38 @@ +#!/bin/bash + +set -ue + +get_parent () { + ps hoppid p$1 +} + +get_children () { + ps hopid --ppid "$1" +} + +get_ancestors () { + case $1 in + 0|1|'') : + ;; *) get_ancestors $(get_parent $1) + esac + echo "$1" +} + +get_descendents () { + for c in $(get_children "$1") + do echo "$c" + get_descendents "$c" + done +} + +declare -i p +for p in "$@" +do + [[ $p -ne 0 ]] && { + get_ancestors "$p" + get_descendents "$p" + } | { + readarray -t pids + ps -Hf "${pids[@]}" | sed "/^[^ ]* *$p /s/.*/&/" + } +done diff --git a/bin/pivot b/bin/pivot new file mode 100755 index 0000000..3c750f2 --- /dev/null +++ b/bin/pivot @@ -0,0 +1,11 @@ +#!/usr/bin/awk -f + +{ + split ($0, _columns, "\t") + for (i=0;i&2 <<-HERE + usage: $0 radix decimal + HERE + exit +fi + +declare -i radix=$1 +declare -i decimal=$2 + +[[ radix -gt 0 ]] || exit 1 + +if [[ $decimal -lt 0 ]] +then + printf -- - + decimal=-$decimal +fi + +if [[ $radix -eq 12 ]] +then digits=({0..9} ↊ ↋) +else digits=({0..9} {a..z}) +fi +number='' + +while [[ $decimal -gt 0 ]] +do + digit=$((decimal%radix)) + number=${digits[$digit]}$number +# decimal=$((decimal-(digit*radix))) + decimal=$((decimal/radix)) +done +echo "$number" diff --git a/bin/reduce b/bin/reduce new file mode 100755 index 0000000..b9b69fe --- /dev/null +++ b/bin/reduce @@ -0,0 +1,9 @@ +#!/bin/bash + +fn=$1 +f() { eval "$fn" "$@"; } +a=$2 +b=$3 +shift 3 +[[ -z "$b" ]] && exec echo "$a" +exec "$0" "$fn" "$(f "$a" "$b")" "${@@Q}" diff --git a/bin/spt b/bin/spt new file mode 100755 index 0000000..e237d93 --- /dev/null +++ b/bin/spt @@ -0,0 +1,55 @@ +#!/bin/bash + +### +# Single pass tabulate. +# +# Turn grid-aligned tables into tab-separated values +# using the first line as a template. +# Pre-existing tabs are preserved, +# which is probably not good. +## +# TODO: +# - Optionally require more than one space for column separation. + +shopt -s extglob + +spitline(){ + declare -i prevtab=0 + for tabstop in ${tabstops[@]} + do + # Strip trailing spaces. + field=${line:$prevtab:$((tabstop-prevtab))} + field=${field%%*( )} + printf '%s\t' "$field" + prevtab=$tabstop + done + printf '%s\n' "${line:$prevtab}" +} + +## +# First line: +## +# The tab stops are where stretches of empty space end. +IFS=$'\n' +read -r firstline +declare -i skip=1 +for ((i=0;i<${#firstline};i++)) +do + case ${firstline:$i:1} in + \ ) + skip=0 + ;; *) + [[ $skip -eq 0 ]] && tabstops+=($i) + skip=1 + esac +done +#echo >&2 ${tabstops[@]} +line=$firstline +spitline + +## +# All other lines: +declare -i prevtab +while read -r line +do spitline +done diff --git a/bin/strjoin b/bin/strjoin new file mode 100755 index 0000000..83b2a9c --- /dev/null +++ b/bin/strjoin @@ -0,0 +1,6 @@ +#!/bin/sh +sep=$1 +shift +printf '%s' "$1" +shift +printf "$sep"'%s' "$@" diff --git a/bin/sum-down b/bin/sum-down new file mode 100644 index 0000000..49717ea --- /dev/null +++ b/bin/sum-down @@ -0,0 +1,14 @@ +#!/usr/bin/awk -E + +{ split($0, _columns, "\t") + for(i in _columns){ + columns[i] += _columns[i] + } +} +END { + output=columns[0] + for(i in columns){ + output = output "\t" columns[i] + } + print output +} diff --git a/bin/sum-up b/bin/sum-up new file mode 100755 index 0000000..1d035d7 --- /dev/null +++ b/bin/sum-up @@ -0,0 +1,4 @@ +#!/bin/bash + +#sed 's/\t/ + /g'| bc -q +sed 's/\t/ + /g'| python3 -qqIi 2> /dev/null diff --git a/bin/xmlbrowser b/bin/xmlbrowser new file mode 100755 index 0000000..731b466 --- /dev/null +++ b/bin/xmlbrowser @@ -0,0 +1,39 @@ +#!/usr/bin/python3 + +import sys +import xml.etree.ElementTree as ET + +from qtpy import QtGui, QtWidgets, QtCore +from qtpy.QtWidgets import QApplication, QTreeWidget, QTreeWidgetItem, QLabel + +def _make_item(element) -> QTreeWidgetItem: + r = QTreeWidgetItem([element.tag, None, element.text]) + r.addChildren([QTreeWidgetItem([None, name, value]) for name, value in element.attrib.items()]) + r.addChildren([_make_item(child) for child in element]) + return r + +def main(): + app = QApplication(sys.argv) + # TODO: Check for suitable arguments first. + # Parameter may be a Qt option. + if len(sys.argv) == 1: + print("Usage:", sys.argv[0], "[file …]", file=sys.stderr) + return + + items = [] + for arg in sys.argv[1:]: + with open(arg) as xmlfile: + xmltree = ET.parse(xmlfile) + fileItem = QTreeWidgetItem([arg]) + items.append(fileItem) + fileItem.addChildren([_make_item(xmltree.getroot())]) + + tree = QTreeWidget() + tree.setColumnCount(2) + tree.setHeaderLabels(["Element", "attribute", "text"]) + tree.insertTopLevelItems(0, items) + tree.show() + sys.exit(app.exec_()) # Main loop. + +if __name__ == '__main__': + main() diff --git a/bin/yamlbrowser b/bin/yamlbrowser new file mode 100755 index 0000000..92068b4 --- /dev/null +++ b/bin/yamlbrowser @@ -0,0 +1,58 @@ +#!/usr/bin/env python3 + +import sys +import yaml +from qtpy import QtGui, QtWidgets, QtCore +from qtpy.QtWidgets import QApplication, QTreeWidget, QTreeWidgetItem, QLabel + +def _make_children (parent:QTreeWidgetItem, d) -> QTreeWidgetItem: + """ + If the item is a container item, i.e. list or dict, + its contents are added as children to the parent. + + If the item is not a container item, + it becomes the value to its parent. + """ + def transform_l (p:QTreeWidgetItem, d:list) -> QTreeWidgetItem: + p.addChildren (_make_children (QTreeWidgetItem (), x) for x in d) + return p + def transform_d (p:QTreeWidgetItem, d:dict) -> QTreeWidgetItem: + p.addChildren (_make_children (QTreeWidgetItem ([key]), value) for key, value in d.items ()) + return p + return { + list: lambda p, d : transform_l (p, d) + , dict: lambda p, d : transform_d (p, d) + , str: lambda p, d : QTreeWidgetItem ([p.text (0), d]) + , int: lambda p, d : QTreeWidgetItem ([p.text (0), str(d)]) + , float: lambda p, d : QTreeWidgetItem ([p.text (0), str(d)]) + , bool: lambda p, d : QTreeWidgetItem ([p.text (0), str(d)]) + , type(None): lambda p, d : QTreeWidgetItem ([p.text (0), str(d)]) + }[type (d)] (parent, d) + +def main (): + app = QApplication (sys.argv) + # TODO: Check for suitable arguments first. + # Parameter may be a Qt option. + if len (sys.argv) == 1: + print ("Usage:", sys.argv[0], "[file …]", file=sys.stderr) + return + try: + items = [] + for arg in sys.argv[1:]: + with open (arg) as file: + data = list (yaml.safe_load_all (file)) + items.append (_make_children (QTreeWidgetItem ([arg]), data[0] if len (data) == 1 else data)) + + tree = QTreeWidget () + tree.setColumnCount (2) + tree.setHeaderLabels (["Key", "Value"]) + tree.insertTopLevelItems(0, items) + tree.show () + except Exception as x: + print (x, file=sys.stderr) + label = QtWidgets.QLabel (str(x)) + label.show () # Opens window. + sys.exit (app.exec_()) # Main loop. Display the label. + +if __name__=='__main__': + main () diff --git a/capitalise b/capitalise deleted file mode 100755 index 479c55d..0000000 --- a/capitalise +++ /dev/null @@ -1,137 +0,0 @@ -#!/bin/bash - - -# Latin letter small capital a: UTF-8: e1 b4 80 UTF-16BE: 1d00 -# .0 .1 .2 .3 .4 .5 .6 .7 .8 .9 .A .B .C .D .E .F -# 1D0. ᴀ ᴁ ᴂ ᴃ ᴄ ᴅ ᴆ ᴇ ᴈ ᴉ ᴊ ᴋ ᴌ ᴍ ᴎ ᴏ -# 1D1. ᴐ ᴑ ᴒ ᴓ ᴔ ᴕ ᴖ ᴗ ᴘ ᴙ ᴚ ᴛ ᴜ ᴝ ᴞ ᴟ -# 1D2. ᴠ ᴡ ᴢ ᴣ ᴤ ᴥ ᴦ ᴧ ᴨ ᴩ ᴪ ᴫ ᴬ ᴭ ᴮ ᴯ -# 1D3. ᴰ ᴱ ᴲ ᴳ ᴴ ᴵ ᴶ ᴷ ᴸ ᴹ ᴺ ᴻ ᴼ ᴽ ᴾ ᴿ -# 1D4. ᵀ ᵁ ᵂ ᵃ ᵄ ᵅ ᵆ ᵇ ᵈ ᵉ ᵊ ᵋ ᵌ ᵍ ᵎ ᵏ -# 1D5. ᵐ ᵑ ᵒ ᵓ ᵔ ᵕ ᵖ ᵗ ᵘ ᵙ ᵚ ᵛ ᵜ ᵝ ᵞ ᵟ -# 1D6. ᵠ ᵡ ᵢ ᵣ ᵤ ᵥ ᵦ ᵧ ᵨ ᵩ ᵪ ᵫ ᵬ ᵭ ᵮ ᵯ -# 1D7. ᵰ ᵱ ᵲ ᵳ ᵴ ᵵ ᵶ ᵷ ᵸ ᵹ ᵺ ᵻ ᵼ ᵽ ᵾ ᵿ -# 1D8. ᶀ ᶁ ᶂ ᶃ ᶄ ᶅ ᶆ ᶇ ᶈ ᶉ ᶊ ᶋ ᶌ ᶍ ᶎ ᶏ -# 1D9. ᶐ ᶑ ᶒ ᶓ ᶔ ᶕ ᶖ ᶗ ᶘ ᶙ ᶚ ᶛ ᶜ ᶝ ᶞ ᶟ -# 1DA. ᶠ ᶡ ᶢ ᶣ ᶤ ᶥ ᶦ ᶧ ᶨ ᶩ ᶪ ᶫ ᶬ ᶭ ᶮ ᶯ -# 1DB. ᶰ ᶱ ᶲ ᶳ ᶴ ᶵ ᶶ ᶷ ᶸ ᶹ ᶺ ᶻ ᶼ ᶽ ᶾ ᶿ -# TODO: Greek letter small capital -declare -A smallcaps=( - [a]=$'\xe1\xb4\x80' - [æ]=$'\xe1\xb4\x81' - [b]=$'\xca\x99' - [c]=$'\xe1\xb4\x84' - [d]=$'\xe1\xb4\x85' - [e]=$'\xe1\xb4\x87' - [f]=$'\xea\x9c\xb0' - [g]=$'\xc9\xa2' - [h]=$'\xca\x9c' - [i]=$'\xc9\xaa' - [j]=$'\xe1\xb4\x8a' - [k]=$'\xe1\xb4\x8b' - [l]=$'\xca\x9f' - [m]=$'\xe1\xb4\x8d' - [n]=$'\xc9\xb4' - [o]=$'\xe1\xb4\x8f' - [œ]=$'\xc9\xb6' - [p]=$'\xe1\xb4\x98' - [q]=$'\xea\x9e\xaf' - [r]=$'\xca\x80' - [s]=$'\xea\x9c\xb1' - [t]=$'\xe1\xb4\x9b' - [u]=$'\xe1\xb4\x9c' - [v]=$'\xe1\xb4\xa0' - [w]=$'\xe1\xb4\xa1' - [x]=x # Missing - [y]=$'\xca\x8f' - [z]=$'\xe1\xb4\xa2' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -# []=$'\x1d\x' -) - -while IFS= read -r line -do - replacement="" - for i in $(seq 0 "$((${#line}-1))") - do - c1=${line:$i:1} - # if [[ $c1 =~ [a-zA-Zα-ωΑ-Ω] ]] - if [[ $c1 =~ [a-zæœ] ]] - then replacement+=${smallcaps[$c1]} - else replacement+=$c1 - fi - done - echo "$replacement" -done diff --git a/clone b/clone deleted file mode 100755 index cfad1af..0000000 --- a/clone +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -set -eu - -args=() -for url in "$@" -do - case $url in - https://*|git://*) - dir=${url#*//} - dir=${dir%/*} - ;; git@*) - dir=${url#git@} - dir=${dir/://} - dir=${dir%/*} - ;; *) - args+=("$url") - continue - esac - mkdir -vp ~/src/"$dir" - cd ~/src/"$dir" - git clone --verbose --progress "${args[@]}" "$url" - args=() -done diff --git a/colorlist b/colorlist deleted file mode 100755 index 49b8442..0000000 --- a/colorlist +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/python3 - -import tkinter -from tkinter.constants import * - -window = tkinter.Tk () -window.wm_title ('X11 Colours') - -canvas = tkinter.Canvas (window) -frame = tkinter.Frame (canvas) -scrollbar = tkinter.Scrollbar (window, command=canvas.yview) -canvas.configure (yscrollcommand=scrollbar.set) - -scrollbar.pack(fill=Y, expand=1, side=RIGHT) -canvas.pack (fill=BOTH, expand=1, side=LEFT) -canvas.create_window ((0,0), window=frame, anchor=NW) -frame.bind ("", lambda e: canvas.configure (scrollregion=canvas.bbox ('all'))) - -with open ("/etc/X11/rgb.txt") as txt: - colours = txt.readlines () - -for r,g,b,name in ((int(l[0]),int(l[1]),int(l[2]),l[3]) for l in (colour.rstrip ().split (maxsplit=3) for colour in colours[1:])): - # Each colour band should be weighted: Half red is not as bright as half green. - tkinter.Label (frame, text=f'{name} ({r+b+g})', bg=f'#{r:02x}{g:02x}{b:02x}',fg='black' if r+g+b > 381 else 'white').pack (fill=X, expand=1) - -window.mainloop () diff --git a/countdown b/countdown deleted file mode 100755 index 59daf56..0000000 --- a/countdown +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -declare -i t=$1 - -while [ $((t--)) -ne 0 ]; do - if [ $t -gt 5400 ]; then - h=$((t/3600)) - m=$(((t-(h*3600))/60)) - if [ $m -lt 10 ]; then m=0$m; fi - s=$((t%60)) - if [ $s -lt 10 ]; then s=0$s; fi - echo -en "\r$h:$m:$s " - elif [ $t -gt 90 ]; then - m=$((t/60)) - s=$((t%60)) - if [ $s -lt 10 ]; then s=0$s; fi - echo -en "\r$m:$s " - else - echo -en "\r$t " - fi - sleep 1 -done -echo -en "\r" diff --git a/countdown2 b/countdown2 deleted file mode 100755 index 615f6eb..0000000 --- a/countdown2 +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash - -if [ -z "$1" ]; then echo "usage $0 date"; exit 1; fi - -declare -ir t=`date +%s -d "$1"`; - -declare -i d=t-`date +%s`; -while [ $d -gt 0 ]; do - #yyyy-mm-ddThh:mm:ss - #ww-dd hh:mm:ss - if [ $d -gt 5400 ]; then - h=$((d/3600)) - m=$(((d-(h*3600))/60)) - if [ $m -lt 10 ]; then m=0$m; fi - s=$((d%60)) - if [ $s -lt 10 ]; then s=0$s; fi - echo -en "\r$h:$m:$s " - elif [ $d -gt 90 ]; then - m=$((d/60)) - s=$((d%60)) - if [ $s -lt 10 ]; then s=0$s; fi - echo -en "\r$m:$s " - else - echo -en "\r$d " - fi - #echo -en "\r$d\t"; - sleep 1; - d=t-`date +%s`; -done -echo -en "\r" diff --git a/ean13 b/ean13 deleted file mode 100755 index 6fd125a..0000000 --- a/ean13 +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -while [[ $1 ]] -do -[[ ${#1} -eq 13 ]] || [[ ${#1} -eq 12 ]] || { - printf >&2 'length is %d, should be 13\n' ${#1} - exit 1 -} -declare -i checksum=0 -declare -i factor=1 -for i in {0..11} -do - v=${1:i:1} - checksum=$((checksum+factor*v)) - factor=$((factor^2)) -#printf >&2 'v: %s : cs=%d f=%d\n' "$v" $checksum $factor -done -if [[ ${#1} -eq 12 ]] -then echo "$1"$((10-checksum%10)) -else [[ $((10-checksum%10)) -eq ${1:12} ]] || exit -fi -shift -done diff --git a/embolden b/embolden deleted file mode 100755 index 75df549..0000000 --- a/embolden +++ /dev/null @@ -1,390 +0,0 @@ -#!/bin/bash - -# For bold and italic we can use the Mathematical font variant mappings, -# although those are only defined for Latin and Greek. -# Latin bold capital: u1d400 - u1d419 -# Latin bold small: u1d41a - u1d433 -# Latin italic capital: u1d434 - u1d44d -# Latin italic small: u1d44e - u1d467 -# Latin bold italic capital: u1d468 - u1d481 -# Latin bold italic small: u1d482 - u1d49b -# (Script capital, script small, bold script capital, bold script small) -# (Fraktur capital, fraktur small) -# (Double-struck capital, double-struck small) -# (some Hebrew symbol variants) -# (Bold fraktur capital, bold fraktur small) -# (Sans-serif capital, sans-serif small) -# (Sans-serif bold capital, sans-serif bold small) -# (Sans-serif italic capital, sans-serif italic small) -# (Sans-serif bold italic capital, sans-serif bold italic small) -# (Monospace capital, monospace small) -# Greek bold capital: u1d6a8 - u1d6c0 -# Greek bold small: u1d6c2 - u1d6da -# Greek italic capital: u1d6e2 - u1d6fa -# Greek italic small: u1dcfc - u1d714 -# Greek bold italic capital: u1d71c - u1d734 -# Greek bold italic small: u1d736 - u1d74e -# (Greek sans-serif bold capital: u1d756 - u1d76e) -# (Greek sans-serif bold small: u1d770 - u1d788) -# (Greek sans-serif bold italic capital: u1d790 - u1d7a8) -# (Greek sans-serif bold italic small: u1d7aa - u1d7c2) -# bold digits: u1d7ce - u1d7d7 -# (double-struck digits) -# (sans-serif digits) -# (sans-serif bold digits) -# (monospace digits) -# (Arabic mathematical) -# (Arabic stretched) -# (Arabic looped) -# (Arabic double-struck) -# -# It turns out there are no Unicode control codes for marking text -# bold or italic. There are for subscript and superscript, -# and ASCII has similar codes which nobody ever uses. - -declare -A bold=( - [0]=$'\xf0\x9d\x9f\x8e' - [1]=$'\xf0\x9d\x9f\x8f' - [2]=$'\xf0\x9d\x9f\x90' - [3]=$'\xf0\x9d\x9f\x91' - [4]=$'\xf0\x9d\x9f\x92' - [5]=$'\xf0\x9d\x9f\x93' - [6]=$'\xf0\x9d\x9f\x94' - [7]=$'\xf0\x9d\x9f\x95' - [8]=$'\xf0\x9d\x9f\x96' - [9]=$'\xf0\x9d\x9f\x97' - [A]=$'\xf0\x9d\x90\x80' - [B]=$'\xf0\x9d\x90\x81' - [C]=$'\xf0\x9d\x90\x82' - [D]=$'\xf0\x9d\x90\x83' - [E]=$'\xf0\x9d\x90\x84' - [F]=$'\xf0\x9d\x90\x85' - [G]=$'\xf0\x9d\x90\x86' - [H]=$'\xf0\x9d\x90\x87' - [I]=$'\xf0\x9d\x90\x88' - [J]=$'\xf0\x9d\x90\x89' - [K]=$'\xf0\x9d\x90\x8a' - [L]=$'\xf0\x9d\x90\x8b' - [M]=$'\xf0\x9d\x90\x8c' - [N]=$'\xf0\x9d\x90\x8d' - [O]=$'\xf0\x9d\x90\x8e' - [P]=$'\xf0\x9d\x90\x8f' - [Q]=$'\xf0\x9d\x90\x90' - [R]=$'\xf0\x9d\x90\x91' - [S]=$'\xf0\x9d\x90\x92' - [T]=$'\xf0\x9d\x90\x93' - [U]=$'\xf0\x9d\x90\x94' - [V]=$'\xf0\x9d\x90\x95' - [W]=$'\xf0\x9d\x90\x96' - [X]=$'\xf0\x9d\x90\x97' - [Y]=$'\xf0\x9d\x90\x98' - [Z]=$'\xf0\x9d\x90\x99' - [a]=$'\xf0\x9d\x90\x9a' - [b]=$'\xf0\x9d\x90\x9b' - [c]=$'\xf0\x9d\x90\x9c' - [d]=$'\xf0\x9d\x90\x9d' - [e]=$'\xf0\x9d\x90\x9e' - [f]=$'\xf0\x9d\x90\x9f' - [g]=$'\xf0\x9d\x90\xa0' - [h]=$'\xf0\x9d\x90\xa1' - [i]=$'\xf0\x9d\x90\xa2' - [j]=$'\xf0\x9d\x90\xa3' - [k]=$'\xf0\x9d\x90\xa4' - [l]=$'\xf0\x9d\x90\xa5' - [m]=$'\xf0\x9d\x90\xa6' - [n]=$'\xf0\x9d\x90\xa7' - [o]=$'\xf0\x9d\x90\xa8' - [p]=$'\xf0\x9d\x90\xa9' - [q]=$'\xf0\x9d\x90\xaa' - [r]=$'\xf0\x9d\x90\xab' - [s]=$'\xf0\x9d\x90\xac' - [t]=$'\xf0\x9d\x90\xad' - [u]=$'\xf0\x9d\x90\xae' - [v]=$'\xf0\x9d\x90\xaf' - [w]=$'\xf0\x9d\x90\xb0' - [x]=$'\xf0\x9d\x90\xb1' - [y]=$'\xf0\x9d\x90\xb2' - [z]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' - [ρ]=$'\xf0\x9d\x9b\x92' - [ς]=$'\xf0\x9d\x9b\x93' - [σ]=$'\xf0\x9d\x9b\x94' - [τ]=$'\xf0\x9d\x9b\x95' - [υ]=$'\xf0\x9d\x9b\x96' - [φ]=$'\xf0\x9d\x9b\x97' - [χ]=$'\xf0\x9d\x9b\x98' - [ψ]=$'\xf0\x9d\x9b\x99' - [ω]=$'\xf0\x9d\x9b\x9a' -# [𝐴̱]= -# [𝐵̱]= -# [𝐶̱]= -# [𝐷̱]= -# [𝐸̱]= -# [𝐹̱]= -# [𝐺̱]= -# [𝐻̱]= -# [𝐼̱]= -# [𝐽̱]= -# [𝐾̱]= -# [𝐿̱]= -# [𝑀̱]= -# [𝑁̱]= -# [𝑂̱]= -# [𝑃̱]= -# [𝑄̱]= -# [𝑅̱]= -# [𝑆̱]= -# [𝑇̱]= -# [𝑈̱]= -# [𝑉̱]= -# [𝑊̱]= -# [𝑋̱]= -# [𝑌̱]= -# [𝑍̱]= -# [𝑎̱]= -# [𝑏̱]= -# [𝑐̱]= -# [𝑑̱]= -# [𝑒̱]= -# [𝑓̱]= -# [𝑔̱]= -# [𝘩̱]= -# [𝑖̱]= -# [𝑗̱]= -# [𝑘̱]= -# [𝑙̱]= -# [𝑚̱]= -# [𝑛̱]= -# [𝑜̱]= -# [𝑝̱]= -# [𝑞̱]= -# [𝑟̱]= -# [𝑠̱]= -# [𝑡̱]= -# [𝑢̱]= -# [𝑣̱]= -# [𝑤̱]= -# [𝑥̱]= -# [𝑦̱]= -# [𝑧]= - [𝟢]=$'\xf0\x9d\x9f\xac' - [𝟣]=$'\xf0\x9d\x9f\xad' - [𝟤]=$'\xf0\x9d\x9f\xae' - [𝟥]=$'\xf0\x9d\x9f\xaf' - [𝟦]=$'\xf0\x9d\x9f\xb0' - [𝟧]=$'\xf0\x9d\x9f\xb1' - [𝟨]=$'\xf0\x9d\x9f\xb2' - [𝟩]=$'\xf0\x9d\x9f\xb3' - [𝟪]=$'\xf0\x9d\x9f\xb4' - [𝟫]=$'\xf0\x9d\x9f\xb5' -) - -declare -A italic=( - [A]=$'\xf0\x9d\x90\xb4' - [B]=$'\xf0\x9d\x90\xb5' - [C]=$'\xf0\x9d\x90\xb6' - [D]=$'\xf0\x9d\x90\xb7' - [E]=$'\xf0\x9d\x90\xb8' - [F]=$'\xf0\x9d\x90\xb9' - [G]=$'\xf0\x9d\x90\xba' - [H]=$'\xf0\x9d\x90\xbb' - [I]=$'\xf0\x9d\x90\xbc' - [J]=$'\xf0\x9d\x90\xbd' - [K]=$'\xf0\x9d\x90\xbe' - [L]=$'\xf0\x9d\x90\xbf' - [M]=$'\xf0\x9d\x91\x80' - [N]=$'\xf0\x9d\x91\x81' - [O]=$'\xf0\x9d\x91\x82' - [P]=$'\xf0\x9d\x91\x83' - [Q]=$'\xf0\x9d\x91\x84' - [R]=$'\xf0\x9d\x91\x85' - [S]=$'\xf0\x9d\x91\x86' - [T]=$'\xf0\x9d\x91\x87' - [U]=$'\xf0\x9d\x91\x88' - [V]=$'\xf0\x9d\x91\x89' - [W]=$'\xf0\x9d\x91\x8a' - [X]=$'\xf0\x9d\x91\x8b' - [Y]=$'\xf0\x9d\x91\x8c' - [Z]=$'\xf0\x9d\x91\x8d' - [a]=$'\xf0\x9d\x91\x8e' - [b]=$'\xf0\x9d\x91\x8f' - [c]=$'\xf0\x9d\x91\x90' - [d]=$'\xf0\x9d\x91\x91' - [e]=$'\xf0\x9d\x91\x92' - [f]=$'\xf0\x9d\x91\x93' - [g]=$'\xf0\x9d\x91\x94' - [h]=$'\xf0\x9d\x98\xa9' # Sans-serif, because f0 9d 91 95 is not assigned. - [i]=$'\xf0\x9d\x91\x96' - [j]=$'\xf0\x9d\x91\x97' - [k]=$'\xf0\x9d\x91\x98' - [l]=$'\xf0\x9d\x91\x99' - [m]=$'\xf0\x9d\x91\x9a' - [n]=$'\xf0\x9d\x91\x9b' - [o]=$'\xf0\x9d\x91\x9c' - [p]=$'\xf0\x9d\x91\x9d' - [q]=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f0\x9d\x9c\x83' - [ι]=$'\xf0\x9d\x9c\x84' - [κ]=$'\xf0\x9d\x9c\x85' - [λ]=$'\xf0\x9d\x9c\x86' - [μ]=$'\xf0\x9d\x9c\x87' - [ν]=$'\xf0\x9d\x9c\x88' - [ξ]=$'\xf0\x9d\x9c\x89' - [ο]=$'\xf0\x9d\x9c\x8a' - [π]=$'\xf0\x9d\x9c\x8b' - [ρ]=$'\xf0\x9d\x9c\x8c' - [ς]=$'\xf0\x9d\x9c\x8d' - [σ]=$'\xf0\x9d\x9c\x8e' - [τ]=$'\xf0\x9d\x9c\x8f' - [υ]=$'\xf0\x9d\x9c\x90' - [φ]=$'\xf0\x9d\x9c\x91' - [χ]=$'\xf0\x9d\x9c\x92' - [ψ]=$'\xf0\x9d\x9c\x93' - [ω]=$'\xf0\x9d\x9c\x94' -# [𝐀̱]= -# [𝐁̱]= -# [𝐂̱]= -# [𝐃̱]= -# [𝐄̱]= -# [𝐅̱]= -# [𝐆̱]= -# [𝐇̱]= -# [𝐈̱]= -# [𝐉̱]= -# [𝐊̱]= -# [𝐋̱]= -# [𝐌̱]= -# [𝐍̱]= -# [𝐎̱]= -# [𝐏̱]= -# [𝐐̱]= -# [𝐑̱]= -# [𝐒̱]= -# [𝐓̱]= -# [𝐔̱]= -# [𝐕̱]= -# [𝐖̱]= -# [𝐗̱]= -# [𝐘̱]= -# [𝐙̱]= -# [𝐚̱]= -# [𝐛̱]= -# [𝐜̱]= -# [𝐝̱]= -# [𝐞̱]= -# [𝐟̱]= -# [𝐠̱]= -# [𝐡̱]= -# [𝐢̱]= -# [𝐣̱]= -# [𝐤̱]= -# [𝐥̱]= -# [𝐦̱]= -# [𝐧̱]= -# [𝐨̱]= -# [𝐩̱]= -# [𝐪̱]= -# [𝐫̱]= -# [𝐬̱]= -# [𝐭̱]= -# [𝐮̱]= -# [𝐯̱]= -# [𝐰̱]= -# [𝐱̱]= -# [𝐲̱]= -# [𝐳]= -) - -# case $0 in embolden) italicise) script) fracture) double-strike) sans-serif) monospace) stretch) loop) mathise) - -while IFS= read -r line -do for i in $(seq 0 $((${#line}-1))) - do - c1=${line:$i:1} - # if [[ ${bold[$c1]} ]] - if [[ $c1 =~ [0-9a-zA-Zα-ωΑ-Ω𝐴̱-𝑍̱𝑎̱-𝑧] ]] - then replacement+=${bold[$c1]} - else replacement+=$'\u0331'$c1 - fi - done - echo "$replacement" -done diff --git a/giteval b/giteval deleted file mode 100755 index 48d35a8..0000000 --- a/giteval +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -b=$(git branch --show-current 2> /dev/null) && { - case $(env - git status --no-ahead-behind | tail -n1) in - 'nothing to commit'*) - printf '\[\e[32m\][%s]\[\e[0m\]' "$b" - ;; 'no changes added to commit'*) - printf '\[\e[33m\][%s]\[\e[0m\]' "$b" - ;; 'nothing added to commit'*) - printf '\[\e[36m\][%s]\[\e[0m\]' "$b" - ;; *) - printf '\[\e[31m\][%s]\[\e[0m\]' "$b" - esac -} -echo diff --git a/italicise b/italicise deleted file mode 100755 index d9fcb57..0000000 --- a/italicise +++ /dev/null @@ -1,269 +0,0 @@ -#!/bin/bash - - -# For bold and italic we can use the Mathematical font variant mappings, -# although those are only defined for Latin and Greek. -# Latin letter small capital a: UTF-8: e1 b4 80 UTF-16BE: 1d00 Decimal: ᴀ Octal: \016400 -# Latin bold capital: u1d400 - u1d419 -# Latin bold small: u1d41a - u1d433 -# Latin italic capital: u1d434 - u1d44d -# Latin italic small: u1d44e - u1d467 -# Latin bold italic capital: u1d468 - u1d481 -# Latin bold italic small: u1d482 - u1d49b -# (Script capital, script small, bold script capital, bold script small) -# (Fraktur capital, fraktur small) -# (Double-struck capital, double-struck small) -# (some Hebrew symbol variants) -# (Bold fraktur capital, bold fraktur small) -# (Sans-serif capital, sans-serif small) -# (Sans-serif bold capital, sans-serif bold small) -# (Sans-serif italic capital, sans-serif italic small) -# (Sans-serif bold italic capital, sans-serif bold italic small) -# (Monospace capital, monospace small) -# Greek bold capital: u1d6a8 - u1d6c0 -# Greek bold small: u1d6c2 - u1d6da -# Greek italic capital: u1d6e2 - u1d6fa -# Greek italic small: u1dcfc - u1d714 -# Greek bold italic capital: u1d71c - u1d734 -# Greek bold italic small: u1d736 - u1d74e -# (Greek sans-serif bold capital: u1d756 - u1d76e) -# (Greek sans-serif bold small: u1d770 - u1d788) -# (Greek sans-serif bold italic capital: u1d790 - u1d7a8) -# (Greek sans-serif bold italic small: u1d7aa - u1d7c2) -# bold digits: u1d7ce - u1d7d7 -# (double-struck digits) -# (sans-serif digits) -# (sans-serif bold digits) -# (monospace digits) -# (Arabic mathematical) -# (Arabic stretched) -# (Arabic looped) -# (Arabic double-struck) -# -# It turns out there are no Unicode control codes for marking text -# bold or italic. There are for subscript and superscript, -# and ASCII has similar codes which nobody ever uses. - -declare -A bold=( - [A]=$'\xf0\x9d\x90\x80' - [B]=$'\xf0\x9d\x90\x81' - [C]=$'\xf0\x9d\x90\x82' - [D]=$'\xf0\x9d\x90\x83' - [E]=$'\xf0\x9d\x90\x84' - [F]=$'\xf0\x9d\x90\x85' - [G]=$'\xf0\x9d\x90\x86' - [H]=$'\xf0\x9d\x90\x87' - [I]=$'\xf0\x9d\x90\x88' - [J]=$'\xf0\x9d\x90\x89' - [K]=$'\xf0\x9d\x90\x8a' - [L]=$'\xf0\x9d\x90\x8b' - [M]=$'\xf0\x9d\x90\x8c' - [N]=$'\xf0\x9d\x90\x8d' - [O]=$'\xf0\x9d\x90\x8e' - [P]=$'\xf0\x9d\x90\x8f' - [Q]=$'\xf0\x9d\x90\x90' - [R]=$'\xf0\x9d\x90\x91' - [S]=$'\xf0\x9d\x90\x92' - [T]=$'\xf0\x9d\x90\x93' - [U]=$'\xf0\x9d\x90\x94' - [V]=$'\xf0\x9d\x90\x95' - [W]=$'\xf0\x9d\x90\x96' - [X]=$'\xf0\x9d\x90\x97' - [Y]=$'\xf0\x9d\x90\x98' - [Z]=$'\xf0\x9d\x90\x99' - [a]=$'\xf0\x9d\x90\x9a' -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\x9a\xba' - [Τ]=$'\xf0\x9d\x9a\xbb' - [Υ]=$'\xf0\x9d\x9a\xbc' - [Φ]=$'\xf0\x9d\x9a\xbd' - [Χ]=$'\xf0\x9d\x9a\xbe' - [Ψ]=$'\xf0\x9d\x9a\xbf' - [Ω]=$'\xf0\x9d\x9b\x80' - [α]=$'\xf0\x9d\x9b\x82' - [β]=$'\xf0\x9d\x9b\x83' - [γ]=$'\xf0\x9d\x9b\x84' - [δ]=$'\xf0\x9d\x9b\x85' - [ε]=$'\xf0\x9d\x9b\x86' - [ζ]=$'\xf0\x9d\x9b\x87' - [η]=$'\xf0\x9d\x9b\x88' - [θ]=$'\xf0\x9d\x9b\x89' - [ι]=$'\xf0\x9d\x9b\x8a' - [κ]=$'\xf0\x9d\x9b\x8b' - [λ]=$'\xf0\x9d\x9b\x8c' - [μ]=$'\xf0\x9d\x9b\x8d' - [ν]=$'\xf0\x9d\x9b\x8e' - [ξ]=$'\xf0\x9d\x9b\x8f' - [ο]=$'\xf0\x9d\x9b\x90' - [π]=$'\xf0\x9d\x9b\x91' - [ρ]=$'\xf0\x9d\x9b\x92' - [ς]=$'\xf0\x9d\x9b\x93' - [σ]=$'\xf0\x9d\x9b\x94' - [τ]=$'\xf0\x9d\x9b\x95' - [υ]=$'\xf0\x9d\x9b\x96' - [φ]=$'\xf0\x9d\x9b\x97' - [χ]=$'\xf0\x9d\x9b\x98' - [ψ]=$'\xf0\x9d\x9b\x99' - [ω]=$'\xf0\x9d\x9b\x9a' -) - -declare -A italic=( - [A]=$'\xf0\x9d\x90\xb4' - [B]=$'\xf0\x9d\x90\xb5' - [C]=$'\xf0\x9d\x90\xb6' - [D]=$'\xf0\x9d\x90\xb7' - [E]=$'\xf0\x9d\x90\xb8' - [F]=$'\xf0\x9d\x90\xb9' - [G]=$'\xf0\x9d\x90\xba' - [H]=$'\xf0\x9d\x90\xbb' - [I]=$'\xf0\x9d\x90\xbc' - [J]=$'\xf0\x9d\x90\xbd' - [K]=$'\xf0\x9d\x90\xbe' - [L]=$'\xf0\x9d\x90\xbf' - [M]=$'\xf0\x9d\x91\x80' - [N]=$'\xf0\x9d\x91\x81' - [O]=$'\xf0\x9d\x91\x82' - [P]=$'\xf0\x9d\x91\x83' - [Q]=$'\xf0\x9d\x91\x84' - [R]=$'\xf0\x9d\x91\x85' - [S]=$'\xf0\x9d\x91\x86' - [T]=$'\xf0\x9d\x91\x87' - [U]=$'\xf0\x9d\x91\x88' - [V]=$'\xf0\x9d\x91\x89' - [W]=$'\xf0\x9d\x91\x8a' - [X]=$'\xf0\x9d\x91\x8b' - [Y]=$'\xf0\x9d\x91\x8c' - [Z]=$'\xf0\x9d\x91\x8d' - [a]=$'\xf0\x9d\x91\x8e' - [b]=$'\xf0\x9d\x91\x8f' - [c]=$'\xf0\x9d\x91\x90' - [d]=$'\xf0\x9d\x91\x91' - [e]=$'\xf0\x9d\x91\x92' - [f]=$'\xf0\x9d\x91\x93' - [g]=$'\xf0\x9d\x91\x94' - [h]=$'\xf0\x9d\x98\xa9' # Sans-serif, because f0 9d 91 95 is not assigned. - [i]=$'\xf0\x9d\x91\x96' - [j]=$'\xf0\x9d\x91\x97' - [k]=$'\xf0\x9d\x91\x98' - [l]=$'\xf0\x9d\x91\x99' - [m]=$'\xf0\x9d\x91\x9a' - [n]=$'\xf0\x9d\x91\x9b' - [o]=$'\xf0\x9d\x91\x9c' - [p]=$'\xf0\x9d\x91\x9d' - [q]=$'\xf0\x9d\x91\x9e' - [r]=$'\xf0\x9d\x91\x9f' - [s]=$'\xf0\x9d\x91\xa0' - [t]=$'\xf0\x9d\x91\xa1' - [u]=$'\xf0\x9d\x91\xa2' - [v]=$'\xf0\x9d\x91\xa3' - [w]=$'\xf0\x9d\x91\xa4' - [x]=$'\xf0\x9d\x91\xa5' - [y]=$'\xf0\x9d\x91\xa6' - [z]=$'\xf0\x9d\x91\xa7' - [Α]=$'\xf0\x9d\x9b\xa2' - [Β]=$'\xf0\x9d\x9b\xa3' - [Γ]=$'\x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τ]=$'\xf0\x9d\x9c\x8f' - [υ]=$'\xf0\x9d\x9c\x90' - [φ]=$'\xf0\x9d\x9c\x91' - [χ]=$'\xf0\x9d\x9c\x92' - [ψ]=$'\xf0\x9d\x9c\x93' - [ω]=$'\xf0\x9d\x9c\x94' -) - -# TODO: bold italics. - -while IFS= read -r line -do - replacement="" - for i in $(seq 0 "$((${#line}-1))") - do - c1=${line:$i:1} - if [[ $c1 =~ [a-zA-Zα-ωΑ-Ω] ]] - then replacement+=${italic[$c1]} - else replacement+=$'\u0331'$c1 - fi - done - echo "$replacement" -done diff --git a/man/man1/all.1 b/man/man1/all.1 new file mode 100644 index 0000000..28f9597 --- /dev/null +++ b/man/man1/all.1 @@ -0,0 +1,39 @@ +.TH all 1 2022-05-27 utils + +.SH NAME +all \- logical and operator + +.SH SYNOPSIS +.B all +.RI [ arg\ ... ] + +.SH DESCRIPTION +.B all +evaluates each parameter according to the +.BR bash (1) +built-in +.B test +until the first the evaluates to false. +Returns true if all parameters evaluate to true, or no paramters are passed. +Note, however, that the shell may omit parameters +that would evaluate to false. + +Admittedly, this is not as useful as it could be. +As +.B all +does not run any commands, it cannot be used for lazy evaluation. + +.SH EXIT STATUS +.TP +.B 0 +No parameter evaluates to false. +.TP +.B 1 +At least one parameter evaluates to false. + +.SH EXAMPLES +.B all +"$a" "$b" "$c" + +.SH SEE ALSO +.BR any (1),\ xargs (1),\ map (1),\ fmap (1) diff --git a/man/man1/any.1 b/man/man1/any.1 new file mode 100644 index 0000000..71b93e6 --- /dev/null +++ b/man/man1/any.1 @@ -0,0 +1,41 @@ +.TH any 1 2022-05-27 utils + +.SH NAME +any \- logical or operator + +.SH SYNOPSIS +.B or +.RI [ arg\ ... ] + +.SH DESCRIPTION +.B any +evaluates each parameter according to the +.BR bash (1) +built-in +.B test +until the first the evaluates to true. +Returns false if all parameters evaluate to false. +If no parameters are passed, returns true. + +The shell may omit parameters +that would evaluate to false. + +Admittedly, this is not as useful as it could be. +As +.B or +does not run any commands, it cannot be used for lazy evaluation. + +.SH EXIT STATUS +.TP +.B 0 +Not all parameters evaluate to false. +.TP +.B 1 +All parameters evaluate to false. + +.SH EXAMPLES +.B or +"$a" "$b" "$c" + +.SH SEE ALSO +.BR all (1),\ xargs (1),\ map (1),\ fmap (1) diff --git a/man/man1/capitalise.1 b/man/man1/capitalise.1 new file mode 100644 index 0000000..f16398d --- /dev/null +++ b/man/man1/capitalise.1 @@ -0,0 +1,21 @@ +.TH capitalise 1 2023-05-06 utils + +.SH NAME +capitalise \- format lower case input as small caps + +.SH SYNOPSIS +.B capitalise + +.SH DESCRIPTION +.B capitalise +reads the standard input and transforms each letter +that has a corresponding +.BR unicode (7) +small capital glyph. +This should be the case for the extended Latin and Greek alphabets. + +.SH EXAMPLES +.BR echo\ this\ text\ |\ capitalise + +.SH SEE ALSO +.BR italicise (1),\ embolden (1) diff --git a/man/man1/clone.1 b/man/man1/clone.1 new file mode 100644 index 0000000..5801940 --- /dev/null +++ b/man/man1/clone.1 @@ -0,0 +1,44 @@ +.TH clone 1 2022-06-03 utils + +.SH NAME +clone \- clone a git repository + +.SH SYNOPSIS +.B clone +.RI [ url | arg\ ... ] + +.SH DESCRIPTION +.B clone +is a wrapper around +.BR git\-clone (1) +that, instead of cloning to the current directory, +creates the cloned repositories into the +.IR $HOME / src +directory, +prefixing the host name and directory of each origin. + +This is similar to the way the go language handles remote dependencies. + +It makes it easy to keep sources organised and consistent, +as long as you don't need to keep track of merge request across different remote repositories, which may well be the case. +But as +.BR git (1) +only deems one remote to be the origin, +that would be reflected in the src directory tree. +(Until you change the origin or move the work tree.) + +For convenience, the options +.I \-\-verbose +and +.I \-\-progress +are passed by default. +Any parameter that does not start with +"http" or "git@" is passed to +.BR git\-clone (1) +as a further parameter. + +.SH EXAMPLES +.B clone https://git.tree-board.net/utils + +.SH SEE ALSO +.BR git (1),\ git-clone (1) diff --git a/man/man1/colourlist.1 b/man/man1/colourlist.1 new file mode 100644 index 0000000..ef3f8c6 --- /dev/null +++ b/man/man1/colourlist.1 @@ -0,0 +1,29 @@ +.TH colourlist 1 2020-09-27 utils + +.SH NAME +colourlist \- show named X11 colours + +.SH SYNOPSIS +.B colourlist + +.SH DESCRIPTION +.B colourlist +opens a window showing all the colours +that are named in the +.I /etc/X11/rgb.txt +file. + +It is implemented as a +.BR python (1) +script using the tkinter module +that is part of the standard distribution. + +.SH FILES +.TP +.I /etc/X11/rgb.txt + +.SH EXAMPLES +.B colourlist + +.SH SEE ALSO +.BR Xorg (1) diff --git a/man/man1/countdown.1 b/man/man1/countdown.1 new file mode 100644 index 0000000..4db0867 --- /dev/null +++ b/man/man1/countdown.1 @@ -0,0 +1,25 @@ +.TH countdown 1 2022-05-27 utils + +.SH NAME +countdown \- count down a number of seconds + +.SH SYNOPSIS +.B countdown +.I seconds + +.SH DESCRIPTION +.B countdown +does what it says on the tin: +It counts down the seconds, similar to +.BR sleep (1), +but it also prints the time remaining. + +It is not as precise as +.BR sleep (1): +For long periods, it may take longer than specified. + +.SH EXAMPLES +.BR countdown \ 86400 + +.SH SEE ALSO +.BR sleep (1),\ countdown2 (1) diff --git a/man/man1/countdown2.1 b/man/man1/countdown2.1 new file mode 100644 index 0000000..d56afd1 --- /dev/null +++ b/man/man1/countdown2.1 @@ -0,0 +1,26 @@ +.TH countdown2 1 2022-05-27 utils + +.SH NAME +countdown2 \- count down to a specified date + +.SH SYNOPSIS +.B countdown2 +.I date + +.SH DESCRIPTION +.B countdown2 +keeps running until the specified date +while printing the remaining time every second. + +The date can be anything that is understood by +.BR date (1). + +It is not as precise as +.BR sleep (1): +For long periods, it may take longer than specified. + +.SH EXAMPLES +.BR countdown2 \ tomorrow + +.SH SEE ALSO +.BR sleep (1),\ countdown (1),\ date (1) diff --git a/man/man1/ean13.1 b/man/man1/ean13.1 new file mode 100644 index 0000000..f6137c6 --- /dev/null +++ b/man/man1/ean13.1 @@ -0,0 +1,35 @@ +.TH ean13 1 2024-03-15 utils + +.SH NAME +ean13 \- check or compute european article numbers + +.SH SYNOPSIS +.B ean13 +.RI [ arg\ ... ] + +.SH DESCRIPTION +.B ean13 +checks for each argument if it is a valid EAN13 number, +that is a European Article Number that has 13 digits; +or computes the checksum digit if the argument has only 12 digits. + +.SH EXIT STATUS +.TP +.B 0 +If the number is valid or the checksum is computed. + +.TP +.B 1 +If the number is not valid. + +.SH EXAMPLES +.HP +Compute the checksum number: + +.BR ean13 \ 012345678901 + +.HP +Check if the number is a valid EAN13: + +.BR ean13 \ 0123456789012 + diff --git a/man/man1/embolden.1 b/man/man1/embolden.1 new file mode 100644 index 0000000..cacb436 --- /dev/null +++ b/man/man1/embolden.1 @@ -0,0 +1,21 @@ +.TH embolden 1 2021-09-05 utils + +.SH NAME +embolden \- format lower case input as small caps + +.SH SYNOPSIS +.B embolden + +.SH DESCRIPTION +.B embolden +reads the standard input and transforms each letter +that has a corresponding bold +.BR unicode (7) +glyph. +This should be the case for the Latin and Greek alphabets. + +.SH EXAMPLES +.BR echo\ this\ text\ |\ embolden + +.SH SEE ALSO +.BR italicise (1),\ capitalise (1) diff --git a/man/man1/giteval.1 b/man/man1/giteval.1 new file mode 100644 index 0000000..6813432 --- /dev/null +++ b/man/man1/giteval.1 @@ -0,0 +1,31 @@ +.TH giteval 1 2023-02-11 utils + +.SH NAME +giteval \- print name and state of current git branch + +.SH SYNOPSIS +.B giteval + +.SH DESCRIPTION +.B giteval +is intended to be used for the shell prompt, +to display the name of the current branch, +colour-coded for the current state of the branch. + +It can be used as a command of its own, +but it is not as useful that way, +because its output is intended to be interpreted +by the shell's prompt formatter. + +.SH EXAMPLES +For +.BR bash (1): +.RS +.EX +PROMPT_COMMAND='git_branch=$(giteval)' +PS1='\eu@\eh:\ew${git_branch@P}$' +.EE +.RE + +.SH SEE ALSO +.BR git (1),\ git-branch (1),\ git-status (1),\ bash (1) diff --git a/man/man1/italicise.1 b/man/man1/italicise.1 new file mode 100644 index 0000000..36af112 --- /dev/null +++ b/man/man1/italicise.1 @@ -0,0 +1,21 @@ +.TH italicise 1 2021-07-16 utils + +.SH NAME +italicise \- format input as italic + +.SH SYNOPSIS +.B italicise + +.SH DESCRIPTION +.B italicise +reads the standard input and transforms each letter +that has a corresponding +.BR unicode (7) +italic glyph. +This should be the case for the extended Latin and Greek alphabets. + +.SH EXAMPLES +.BR echo\ this\ text\ |\ italicise + +.SH SEE ALSO +.BR capitalise (1),\ embolden (1) diff --git a/man/man1/map-db.1 b/man/man1/map-db.1 new file mode 100644 index 0000000..3dcfd6a --- /dev/null +++ b/man/man1/map-db.1 @@ -0,0 +1,18 @@ +.TH map-db 1 2023-04-19 utils + +.SH NAME +map-db \- create a graph of a postgres database + +.SH SYNOPSIS +.B map-db + +.SH DESCRIPTION +.B map-db +is basically a less complete version of postgres-autodoc. +It only outputs graphviz code. + +.SH EXAMPLES +.B map-db + +.SH SEE ALSO +.BR psql (1),\ dot (1) diff --git a/man/man1/map.1 b/man/man1/map.1 new file mode 100644 index 0000000..1d7a5f5 --- /dev/null +++ b/man/man1/map.1 @@ -0,0 +1,34 @@ +.TH map 1 2023-05-13 utils + +.SH NAME +map \- apply a command to multiple arguments + +.SH SYNOPSIS +.B map +.IR command \ [ arg \ ... ] + +.SH DESCRIPTION +.B map +applies the first parameter to each other argument in turn. + +The first parameter is evaluated and may contain +.I $1 +anywhere, which will be replaced with the other arguments +one after another. +If it doesn't contain it, it will be supplied with the argument as its last, and possibly only, parameter. + +Unlike +.BR xargs (1),\ map +reads the parameters from the command line +rather than from stdin. + +.SH EXAMPLES +.B map +echo +.I 1 2 3 + +.BR map \ 'mv\ "$1"\ dir/' +.I arg1 arg2 arg3 + +.SH SEE ALSO +.BR xargs (1),\ reduce (1),\ fmap (1),\ mapl (1) diff --git a/man/man1/pf.1 b/man/man1/pf.1 new file mode 100644 index 0000000..ca9f839 --- /dev/null +++ b/man/man1/pf.1 @@ -0,0 +1,23 @@ +.TH pf 1 2023-05-13 utils + +.SH NAME +pf \- print process family + +.SH SYNOPSIS +.B pf +.I pid + +.SH DESCRIPTION +.B pf +prints the ancestor processes of the given process up to the init daemon (or whatever is pid 1 inside a docker container), as well as all its descendents, that is, its child processes and their child processes and so on. + +This gives an overview of where that process is coming from, or if it had been disowned, as well as any other processes whose signals it is directly or indirectly waiting for. + +It can be useful if an application has become unresponsive or just won't quit. Or just informative about how an application is built and what it is doing. + +.SH EXAMPLES +.B pf +.I $$ + +.SH SEE ALSO +.BR ps (1),\ top (1) diff --git a/man/man1/pivot.1 b/man/man1/pivot.1 new file mode 100644 index 0000000..c235559 --- /dev/null +++ b/man/man1/pivot.1 @@ -0,0 +1,21 @@ +.TH pf 1 2023-05-13 utils + +.SH NAME +pivot \- flip a table + +.SH SYNOPSIS +.B pivot +.RI [ file\ ... ] + +.SH DESCRIPTION +.B pivot +reads tab-separated values from the provided files +or, if none are provided, from stdin, +and rearranges them so that the rows become the columns and the columns become the rows. + +.SH EXAMPLES +.B pivot +.I table.tsv + +.SH SEE ALSO +.BR cut (1),\ sum_up (1),\ awk (1) diff --git a/man/man1/radix.1 b/man/man1/radix.1 new file mode 100644 index 0000000..43d70d4 --- /dev/null +++ b/man/man1/radix.1 @@ -0,0 +1,31 @@ +.TH pf 1 2023-05-13 utils + +.SH NAME +radix \- compute the digits of a number in a different base + +.SH SYNOPSIS +.B radix +.I base decimal + +.SH DESCRIPTION +.B radix +is an easy and convenient way to convert decimal numbers +into many other bases, like octal, dozenal, or hexadecimal. + +It is implemented in +.BR bc (1), +which puts a system dependent limit on the bases. +It also only accepts integer bases. +.B radix +itself has a limit of base 36, using Latin letters for digits greater than or equal to ten. + +For base 12 it uses the glyphs suggested by the British Dozenal Society which are acutally part of +.BR unicode (7). +(The American Dozenal Society suggests using homoglyphs of X and E for ten and eleven, respectively, instead.) + +.SH EXAMPLES +.B radix +.I 12 144 + +.SH SEE ALSO +.BR bc (1) diff --git a/man/man1/reduce.1 b/man/man1/reduce.1 new file mode 100644 index 0000000..8ca9358 --- /dev/null +++ b/man/man1/reduce.1 @@ -0,0 +1,28 @@ +.TH reduce 1 2023-05-13 utils + +.SH NAME +reduce \- apply a command to multiple arguments + +.SH SYNOPSIS +.B reduce +.IR command\ accumulator \ [ arg \ ... ] + +.SH DESCRIPTION +.B reduce +applies the first parameter to all other arguments in turn. + +The first parameter is taken to be a command +that accepts two parameters, +which will be the accumulator +and all other arguments +one after another, respectively. +With each argument, the accumulator will be replaced with the output of the evaluation of the first parameter. + +Admittedly, this is not as useful as it could be. + +.SH EXAMPLES +.B reduce +.I 'echo -n' 0 1 2 3 + +.SH SEE ALSO +.BR map (1),\ xargs (1) diff --git a/man/man1/spt.1 b/man/man1/spt.1 new file mode 100644 index 0000000..ba1d8d5 --- /dev/null +++ b/man/man1/spt.1 @@ -0,0 +1,41 @@ +.TH spt 1 2022-05-27 utils + +.SH NAME +spt \- single pass tabulate + +.SH SYNOPSIS +.B spt + +.SH DESCRIPTION +.B spt +reads a grid-aligned table from stdin +and outputs the same data on stdout +as tab-separated values. + +Only the first line is used to guess where in the grid +are the column separators. +Any sequence of more than one blank character +is taken to separate columns, so if in the first line +two colum values happen to be separated by a single space, +.B spt +will guess wrong. + +.RB ( vd (1) +uses the first 1000 lines, which is a lot safer, +but with grid separated values there can be no guarantee.) + +In addition, if the input data contains tabs already, +those are not escaped, but preserved. +If that is a problem, you'll need to escape them beforehand, for example using +.BR sed (1) +like so: +.RS +.BI sed \ 's:\et:\e\et:g' +.RE + +.SH EXAMPLES +.B spt +.RI <\ grid-table\ >\ table.tsv + +.SH SEE ALSO +.BR col (1),\ vd (1) diff --git a/man/man1/strjoin.1 b/man/man1/strjoin.1 new file mode 100644 index 0000000..dd32f46 --- /dev/null +++ b/man/man1/strjoin.1 @@ -0,0 +1,40 @@ +.TH strjoin 1 2023-07-03 utils + +.SH NAME +strjoin \- join words with a word + +.SH SYNOPSIS +.B strjoin +.IR separator \ [ word\ ... ] + +.SH DESCRIPTION +.B strjoin +is the command line equivalent of +.BR python (1)'s +.B str.join(...) +and java (1)'s +.BR Stream.collect(Collectors.joining(...)) . +It is practically identical to +.B IFS=,;echo "$*" +in +.BR bash (1), +without having to set and reset the +.I IFS +variable. + +The first parameter is the separator +that goes between the words. +All other parameters are the words. +(They don't have to be single words, but they are treated as such.) + +This is useful for constructing paths, +like for example +.BR java (1) +classpaths for +.BR jar (1) +manifest files, +but also tab-separated value records, +and tons of other things. + +.SH EXAMPLES +.B strjoin , foo bar baz diff --git a/man/man1/sum-down.1 b/man/man1/sum-down.1 new file mode 100644 index 0000000..b9c6771 --- /dev/null +++ b/man/man1/sum-down.1 @@ -0,0 +1,25 @@ +.TH sum-down 1 2022-01-12 utils + +.SH NAME +sum-down \- add up columns in a table + +.SH SYNOPSIS +.B sum-down +.RI [ file\ ... ] + +.SH DESCRIPTION +.B sum-down +reads a table from the specified files or, +if none are specified, stdin, +and outputs the sum of +each column. + +It is implemented using +.BR awk (1). + +.SH EXAMPLES +.B sum-down +.RI < \ table.tsv + +.SH SEE ALSO +.BR sum-up (1) diff --git a/man/man1/sum-up.1 b/man/man1/sum-up.1 new file mode 100644 index 0000000..ad6350b --- /dev/null +++ b/man/man1/sum-up.1 @@ -0,0 +1,25 @@ +.TH sum-up 1 2022-05-27 utils + +.SH NAME +sum-up \- add up rows in a table + +.SH SYNOPSIS +.B sum-up + +.SH DESCRIPTION +.B sum-up +reads a table from stdin and outputs the sum of +the values from each column per row. + +It used to be implemented using +.BR bc (1), +but now uses +.BR python (1), +which has the advantage that it also concatenates strings. + +.SH EXAMPLES +.B sum-up +.RI < \ table.tsv + +.SH SEE ALSO +.BR sum-down (1) diff --git a/man/man1/xmlbrowser.1 b/man/man1/xmlbrowser.1 new file mode 100644 index 0000000..ced266b --- /dev/null +++ b/man/man1/xmlbrowser.1 @@ -0,0 +1,35 @@ +.TH xmlbrowser 1 2022-11-03 utils + +.SH NAME +xmlbrowser \- graphical browser for xml databases + +.SH SYNOPSIS +.B xmlbrowser +.RI [ file\ ... ] + +.SH DESCRIPTION +.B xmlbrowser +parses the specified XML files +and builds a tree +with the elements and their +attributes and values. + +The tree is displayed in a window for easy browsing. + +It is implemented as a +.BR python (1) +script using qtpy. + +Not implemented are a search function, +and a way to edit the values. +You can use +.BR grep (1) +or +.BR sed (1) +for that, I think. + +.SH EXAMPLES +.B xmlbrowser data.xml + +.SH SEE ALSO +.BR yamlbrowser (1) diff --git a/man/man1/yamlbrowser.1 b/man/man1/yamlbrowser.1 new file mode 100644 index 0000000..ebd0a7a --- /dev/null +++ b/man/man1/yamlbrowser.1 @@ -0,0 +1,44 @@ +.TH yamlbrowser 1 2022-11-20 utils + +.SH NAME +xmlbrowser \- graphical browser for yaml files + +.SH SYNOPSIS +.B yamlbrowser +.RI [ file\ ... ] + +.SH DESCRIPTION +.B yamlbrowser +parses the specified YAML files +and builds a tree +from the objects, +even if the file contains a list. + +The tree is displayed in a window for easy browsing. + +In theory, YAML should be a strict superset of JSON, +which should make it possible to also browse JSON files +with +.BR yamlbrowser . +In practice, there is a difference between theory and practice. +In particular, JSON treats all whitespace outside of keys and string values as equivalent, inclusing tabs, but YAML strictly doesn't allow tabs for indentation, so properly formatted JSON can not be read using +.BR yamlbrowser . +It needs to be edited first. +Fortunately, this can be as simple as +.B tr +.IR \et\ \e\ , +unless the keys or values themselves contain tabs. + +.B yamlbrowser +is implemented as a +.BR python (1) +script using qtpy. + +Not implemented are a search function, +and a way to edit the values. + +.SH EXAMPLES +.B yamlbrowser data.yaml + +.SH SEE ALSO +.BR jq (1),\ xmlbrowser (1) diff --git a/map b/map deleted file mode 100755 index ec514ad..0000000 --- a/map +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -fn=$1 -if [[ "$fn" = *\$1* ]] -then f(){ eval "$fn";} -else f(){ eval "$fn" "$1";} -fi -shift -for x in "$@" -do f "$x" -done diff --git a/map-db b/map-db deleted file mode 100755 index feb528c..0000000 --- a/map-db +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/bash - -query(){ -# psql-gridware -A -F$'\t' -t -P pager=off -c "$@" -# psql-gridware -A -F$'\t' -P pager=off -P title=off -c "$@" - psql-gridware -A -F$'\t' -P pager=off -c "$@" -} - -exec {in}<&0 - -pforkey(){ - echo '>]' - open_table=0 - data=forkey -} -forkey(){ - # ${constraint name} FOREIGN KEY (${Column}) REFERENCES ${table}(${Column}) - read -ra line <<<"$Column" - this_column=${line[3]%)} - this_column=${this_column#(} - other_table=${line[5]%%(*} - other_column=${line[5]##*\(} - other_column=${other_column%)} - printf '%s:%s_out -> %s:%s_in\n' "$table" "$this_column" "$other_table" "$other_column" -} - -record(){ - if [[ $Nullable = 'not null' ]] - then - echo "$Column$Type" - else - echo "$Column$Type" - fi -} - -echo 'strict digraph db {' -echo 'node[shape=plain]' -query '\d' -t | cut -f 2,3 | grep table\$ | cut -f1 | while read -r table -do - printf '\e[1m%s\e[0m\n' "$table" >&2 - data=record - open_table=1 - echo - echo "$table [label=<" - echo '
' - while IFS=$'\t' read -r Column Type Collation Nullable Default - do - case $Column in - Foreign-key\ constraints:) - echo >&2 'foreign keys' - data=pforkey - ;; *:) - echo >&2 '… skipping '"$Column" - data=: - esac - $data - done < <(query '\d '"$table" <&${in} | tail -n+3 | tr -d $'\r') - [[ $open_table = 1 ]] && echo '
\\N
>]' -done -echo '}' diff --git a/pf b/pf deleted file mode 100755 index 0358689..0000000 --- a/pf +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash - -set -ue - -get_parent () { - ps hoppid p$1 -} - -get_children () { - ps hopid --ppid "$1" -} - -get_ancestors () { - case $1 in - 0|1|'') : - ;; *) get_ancestors $(get_parent $1) - esac - echo "$1" -} - -get_descendents () { - for c in $(get_children "$1") - do echo "$c" - get_descendents "$c" - done -} - -declare -i p -for p in "$@" -do - [[ $p -ne 0 ]] && { - get_ancestors "$p" - get_descendents "$p" - } | { - readarray -t pids - ps -Hf "${pids[@]}" | sed "/^[^ ]* *$p /s/.*/&/" - } -done diff --git a/pivot b/pivot deleted file mode 100755 index 3c750f2..0000000 --- a/pivot +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/awk -f - -{ - split ($0, _columns, "\t") - for (i=0;i&2 ${tabstops[@]} -line=$firstline -spitline - -## -# All other lines: -declare -i prevtab -while read -r line -do spitline -done diff --git a/strjoin b/strjoin deleted file mode 100755 index 83b2a9c..0000000 --- a/strjoin +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -sep=$1 -shift -printf '%s' "$1" -shift -printf "$sep"'%s' "$@" diff --git a/sum_up b/sum_up deleted file mode 100755 index 1d035d7..0000000 --- a/sum_up +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -#sed 's/\t/ + /g'| bc -q -sed 's/\t/ + /g'| python3 -qqIi 2> /dev/null diff --git a/xmlbrowser b/xmlbrowser deleted file mode 100755 index 731b466..0000000 --- a/xmlbrowser +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/python3 - -import sys -import xml.etree.ElementTree as ET - -from qtpy import QtGui, QtWidgets, QtCore -from qtpy.QtWidgets import QApplication, QTreeWidget, QTreeWidgetItem, QLabel - -def _make_item(element) -> QTreeWidgetItem: - r = QTreeWidgetItem([element.tag, None, element.text]) - r.addChildren([QTreeWidgetItem([None, name, value]) for name, value in element.attrib.items()]) - r.addChildren([_make_item(child) for child in element]) - return r - -def main(): - app = QApplication(sys.argv) - # TODO: Check for suitable arguments first. - # Parameter may be a Qt option. - if len(sys.argv) == 1: - print("Usage:", sys.argv[0], "[file …]", file=sys.stderr) - return - - items = [] - for arg in sys.argv[1:]: - with open(arg) as xmlfile: - xmltree = ET.parse(xmlfile) - fileItem = QTreeWidgetItem([arg]) - items.append(fileItem) - fileItem.addChildren([_make_item(xmltree.getroot())]) - - tree = QTreeWidget() - tree.setColumnCount(2) - tree.setHeaderLabels(["Element", "attribute", "text"]) - tree.insertTopLevelItems(0, items) - tree.show() - sys.exit(app.exec_()) # Main loop. - -if __name__ == '__main__': - main() diff --git a/yamlbrowser b/yamlbrowser deleted file mode 100755 index 92068b4..0000000 --- a/yamlbrowser +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env python3 - -import sys -import yaml -from qtpy import QtGui, QtWidgets, QtCore -from qtpy.QtWidgets import QApplication, QTreeWidget, QTreeWidgetItem, QLabel - -def _make_children (parent:QTreeWidgetItem, d) -> QTreeWidgetItem: - """ - If the item is a container item, i.e. list or dict, - its contents are added as children to the parent. - - If the item is not a container item, - it becomes the value to its parent. - """ - def transform_l (p:QTreeWidgetItem, d:list) -> QTreeWidgetItem: - p.addChildren (_make_children (QTreeWidgetItem (), x) for x in d) - return p - def transform_d (p:QTreeWidgetItem, d:dict) -> QTreeWidgetItem: - p.addChildren (_make_children (QTreeWidgetItem ([key]), value) for key, value in d.items ()) - return p - return { - list: lambda p, d : transform_l (p, d) - , dict: lambda p, d : transform_d (p, d) - , str: lambda p, d : QTreeWidgetItem ([p.text (0), d]) - , int: lambda p, d : QTreeWidgetItem ([p.text (0), str(d)]) - , float: lambda p, d : QTreeWidgetItem ([p.text (0), str(d)]) - , bool: lambda p, d : QTreeWidgetItem ([p.text (0), str(d)]) - , type(None): lambda p, d : QTreeWidgetItem ([p.text (0), str(d)]) - }[type (d)] (parent, d) - -def main (): - app = QApplication (sys.argv) - # TODO: Check for suitable arguments first. - # Parameter may be a Qt option. - if len (sys.argv) == 1: - print ("Usage:", sys.argv[0], "[file …]", file=sys.stderr) - return - try: - items = [] - for arg in sys.argv[1:]: - with open (arg) as file: - data = list (yaml.safe_load_all (file)) - items.append (_make_children (QTreeWidgetItem ([arg]), data[0] if len (data) == 1 else data)) - - tree = QTreeWidget () - tree.setColumnCount (2) - tree.setHeaderLabels (["Key", "Value"]) - tree.insertTopLevelItems(0, items) - tree.show () - except Exception as x: - print (x, file=sys.stderr) - label = QtWidgets.QLabel (str(x)) - label.show () # Opens window. - sys.exit (app.exec_()) # Main loop. Display the label. - -if __name__=='__main__': - main () -- cgit v1.2.3