+# make vim work with my light colortheme terminal.
+vim() {
+ if [[ -e ~/.vimrc ]]; then
+ command vim "$@"
+ else
+ command vim -c ':colorscheme peachpuff' "$@"
+ fi
+}
+
+# ls count. usage: pass a directory, get the number of files.
+# https://unix.stackexchange.com/questions/90106/whats-the-most-resource-efficient-way-to-count-how-many-files-are-in-a-director
+lsc() {
+ # shellcheck disable=SC2790 disable=SC2012 # intentional
+ ls -Uq "$@"|wc -l
+}
+
+# run then notify. close notification after the next prompt.
+rn() {
+ "$@"
+ dunstify -u critical -h string:x-dunst-stack-tag:profanity "$*"
+ _psrun=(dunstctl close-all)
+}
+n() {
+ dunstify -u critical -h string:x-dunst-stack-tag:profanity n
+ _psrun=(dunstctl close-all)
+}
+
+catnew() {
+ local dir file _
+ dir="$1"
+ # shellcheck disable=SC2030
+ inotifywait -m "$dir" -e create -e moved_to | while read -r _ _ file; do
+ hr
+ cat "$dir/$file"
+ done
+}
+# cat mail
+cm() {
+ catnew /m/md/$1/new
+}
+
+
+fsf-sv-header() {
+ local f
+ local -a f_maybe
+ if ! type -p sponge &>/dev/null; then
+ echo "$0: error: missing dependency: sudo apt install moreutils" >&2
+ return 1
+ fi
+
+ for f; do
+ echo "adding header to $f"
+ if [[ -s $f ]]; then
+ f_maybe=("$f")
+ else
+ f_maybe=()
+ fi
+ cat - "${f_maybe[@]}" <<EOF | sponge "$f"
+The following is the GNU All-permissive License as recommended in
+<https://www.gnu.org/licenses/license-recommendations.en.html>
+
+Copyright (C) $(date +%Y) Free Software Foundation <sysadmin@fsf.org>
+
+Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved. This file is offered as-is,
+without any warranty.
+
+Contributions are welcome. See <https://savannah.gnu.org/maintenance/fsf/>.
+
+EOF
+ done
+}
+
+# note, there is also the tool gron which is meant for this, but
+# this is good enough to not bother installing another tool
+jq-lines() {
+ # https://stackoverflow.com/questions/59700329/how-to-print-path-and-key-values-of-json-file-using-jq
+ jq --stream -r 'select(.[1]|scalars!=null) | "\(.[0]|join(".")): \(.[1]|tojson)"' "$@"
+}
+
+tsr() { # ts run
+ "$@" |& ts || return $?
+}
+
+