# HG changeset patch # User Steve Losh # Date 1580077964 18000 # Node ID d9ee2c4aa85b8666c69cfd74bdeddff15daaddac # Parent 09b49bc1fd0286b70aaf6b3c919bdec09a7f52c3 More shell scripts, etc diff -r 09b49bc1fd02 -r d9ee2c4aa85b bin/freqs --- a/bin/freqs Thu Jan 23 23:36:10 2020 -0500 +++ b/bin/freqs Sun Jan 26 17:32:44 2020 -0500 @@ -2,4 +2,30 @@ set -euo pipefail +function usage { + echo "freqs - display frequencies of the unique lines of stdin + +USAGE: $0 [OPTIONS] + +Options: + -h, --help display this help text and exit +" +} + +function die { + echo "$0: $1" >&2; + exit 1 +} + +OPTS=$(getopt --options h --long help --name "$0" -- "$@") +eval set -- "$OPTS" + +while test "$#" -gt 0; do + case "$1" in + -h | --help ) usage; exit 0;; + -- ) shift; if test "$#" -ne 0; then die "unrecognized arguments: $*"; fi ;; + * ) die "unrecognized arguments: $*" ;; + esac +done + awk '{ c[$0]++ } END { for (l in c) print c[l], l }' diff -r 09b49bc1fd02 -r d9ee2c4aa85b bin/hist --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/hist Sun Jan 26 17:32:44 2020 -0500 @@ -0,0 +1,58 @@ +#!/usr/bin/env bash + +set -euo pipefail + +function usage { + echo "hist - display a histogram of stdin, bucketed by unique lines + +USAGE: $0 [OPTIONS] + +Options: + -h, --help display this help text and exit + -w N, --width N how wide the histograms should be +" +} + +function die { + echo "$0: $1" >&2; + exit 1 +} + +OPTS=$(getopt --options hw: --long help,width: --name "$0" -- "$@") +eval set -- "$OPTS" + +WIDTH=40 + +while test "$#" -gt 0; do + case "$1" in + -h | --help ) usage; exit 0;; + -w | --width ) WIDTH=$2; shift 2 ;; + -- ) shift; if test "$#" -ne 0; then die "unrecognized arguments: $*"; fi ;; + * ) die "unrecognized arguments: $*" ;; + esac +done + +props | awk -v width="$WIDTH" ' +{ + n = $1 + $1 = "" + key = substr($0, 1) + vals[key] = n + + if (n > max) max = n +} + +END { + x = 1 / max + for (key in vals) { + val = vals[key] + bars = int(val * x * width) + pads = width - bars + + printf "%s ", val + for(i=0; i&2 + exit 1 +} + OPTS=$(getopt --options hd:pP --long help,decimals:,percent,no-percent -n "$0" -- "$@") eval set -- "$OPTS" DECIMALS='5' MUL='1.0' -while true; do - case "$1" in - -h | --help ) - echo "USAGE: $0 [-h|--help] [-n N | --decimals N] [--percent | --no-percent]" - exit 0 ;; - -d | --decimals ) DECIMALS="$2"; shift 2 ;; - -p | --percent ) MUL='100.0'; shift ;; - -P | --no-percent ) MUL='1.0'; shift ;; - -- ) shift; break ;; - * ) break ;; - esac +while test "$#" -gt 0; do + case "$1" in + -h | --help ) usage; exit 0 ;; + -d | --decimals ) DECIMALS="$2"; shift 2 ;; + -p | --percent ) MUL='100.0'; shift ;; + -P | --no-percent ) MUL='1.0'; shift ;; + -- ) shift; if test "$#" -ne 0; then die "unrecognized arguments: $*"; fi ;; + * ) die "unrecognized arguments: $*" ;; + esac done awk ' diff -r 09b49bc1fd02 -r d9ee2c4aa85b ctags --- a/ctags Thu Jan 23 23:36:10 2020 -0500 +++ b/ctags Sun Jan 26 17:32:44 2020 -0500 @@ -47,3 +47,9 @@ --regex-clojure=/\([ \t]*defstruct[ \t]+([-[:alnum:]*+!_:\/.?]+)/\1/s,struct/ --regex-clojure=/\([ \t]*intern[ \t]+([-[:alnum:]*+!_:\/.?]+)/\1/v,intern/ --regex-clojure=/\([ \t]*ns[ \t]+([-[:alnum:]*+!_:\/.?]+)/\1/n,namespace/ + +--langdef=R +--langmap=r:.R.r +--regex-R=/^[ \t]*"?([.A-Za-z][.A-Za-z0-9_]*)"?[ \t]*(<-|=)[ \t]function/\1/f,Functions/ +--regex-R=/^"?([.A-Za-z][.A-Za-z0-9_]*)"?[ \t]*(<-|=)[ \t][^f][^u][^n][^c][^t][^i][^o][^n]/\1/g,GlobalVars/ +--regex-R=/[ \t]"?([.A-Za-z][.A-Za-z0-9_]*)"?[ \t]*(<-|=)[ \t][^f][^u][^n][^c][^t][^i][^o][^n]/\1/v,FunctionVariables/ diff -r 09b49bc1fd02 -r d9ee2c4aa85b stumpwmrc --- a/stumpwmrc Thu Jan 23 23:36:10 2020 -0500 +++ b/stumpwmrc Sun Jan 26 17:32:44 2020 -0500 @@ -17,6 +17,7 @@ *new-frame-action* :empty *window-format* "(%n%m%20t)" *window-name-source* :title + *maximum-completions* 20 *shell-program* "/home/sjl/src/dotfiles/bin/bash-dammit") diff -r 09b49bc1fd02 -r d9ee2c4aa85b vim/custom-dictionary.utf-8.add --- a/vim/custom-dictionary.utf-8.add Thu Jan 23 23:36:10 2020 -0500 +++ b/vim/custom-dictionary.utf-8.add Sun Jan 26 17:32:44 2020 -0500 @@ -298,3 +298,4 @@ coenzyme Phosphorylation iterate's +memoization