f92e74e96687

Merge.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Sun, 26 Jan 2020 17:32:54 -0500
parents d9ee2c4aa85b (diff) 93820aa446f2 (current diff)
children 94cdb40fffab d3f648295e4f
branches/tags (none)
files

Changes

--- a/bin/freqs	Fri Jan 24 12:34:37 2020 -0500
+++ b/bin/freqs	Sun Jan 26 17:32:54 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 }'
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/hist	Sun Jan 26 17:32:54 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<bars; i++) printf "█"
+        for(i=0; i<pads; i++) printf " "
+        print key
+    }
+}
+'
--- a/bin/props	Fri Jan 24 12:34:37 2020 -0500
+++ b/bin/props	Sun Jan 26 17:32:54 2020 -0500
@@ -2,23 +2,39 @@
 
 set -euo pipefail
 
+function usage {
+    echo "props - display proportions of stdin, bucketed by unique lines
+
+USAGE: $0 [OPTIONS]
+
+Options:
+  -h, --help          display this help text and exit
+  -p, --percent       display proportions as percentages
+  -P, --no-percent    display proportions as values from 0 to 1 (default)
+  -d N, --decimals N  how many decimal places to display in the result
+"
+}
+
+function die {
+    echo "$0: $1" >&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 '
--- a/ctags	Fri Jan 24 12:34:37 2020 -0500
+++ b/ctags	Sun Jan 26 17:32:54 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/
--- a/stumpwmrc	Fri Jan 24 12:34:37 2020 -0500
+++ b/stumpwmrc	Sun Jan 26 17:32:54 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")
 
 
--- a/vim/custom-dictionary.utf-8.add	Fri Jan 24 12:34:37 2020 -0500
+++ b/vim/custom-dictionary.utf-8.add	Sun Jan 26 17:32:54 2020 -0500
@@ -298,3 +298,4 @@
 coenzyme
 Phosphorylation
 iterate's
+memoization