From 63d9a99f70c6b6d428536dcfb647edf896a5b528 Mon Sep 17 00:00:00 2001 From: Alex Karle Date: Thu, 13 Feb 2020 00:17:23 -0500 Subject: [PATCH] bin: add hooman and vip, two QoL scripts * vip -- just a more erganomic way of typing "vim `which PROG`" * hooman -- human size fields, without remembering numfmt! du | hooman 1 Obviously, du has -h, but this is good for when tools dump raw bytes to file and you need to parse it! looking at you git-filter-branch :) --- bin/hooman | 22 ++++++++++++++++++++++ bin/vip | 18 ++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100755 bin/hooman create mode 100755 bin/vip diff --git a/bin/hooman b/bin/hooman new file mode 100755 index 0000000..0f2fadb --- /dev/null +++ b/bin/hooman @@ -0,0 +1,22 @@ +#!/bin/sh +# hooman -- print fields in human-readable sizes +die() { + echo "$1" 2>&1 + exit 1 +} + +usage() { + die "usage: hooman [-h N] FIELD [FIELD2 FIELD3 ...]" +} + +[ -z "$1" ] && usage + +case "$1" in + -h) + [ -z "$2" ] && usage + header="--header=$2" + shift 2 + ;; +esac + +numfmt $header --field="$*" --to=iec-i --suffix=B --padding=7 --round=nearest diff --git a/bin/vip b/bin/vip new file mode 100755 index 0000000..588c230 --- /dev/null +++ b/bin/vip @@ -0,0 +1,18 @@ +#!/bin/sh +# vip -- vi on the $PATH + +die() { + echo "$1" 1>&2; + exit 1 +} + +if [ -z "$1" ]; then + die "usage: vip progname" +fi + +bin=`which $1` +if [ -z $bin ]; then + die "$1 not on PATH" +fi + +exec $EDITOR $bin -- libgit2 0.28.4