dotfiles

$HOME is where the <3 is
git clone git://git.alexkarle.com/dotfiles.git
Log | Files | Refs | Submodules | README

commit 63d9a99f70c6b6d428536dcfb647edf896a5b528 (patch)
parent 2059d2eb50d9f03b9c479055231c1ef8b81d1ef6
Author: Alex Karle <alex@karle.co>
Date:   Thu, 13 Feb 2020 00:17:23 -0500

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 :)

Diffstat:
Abin/hooman | 22++++++++++++++++++++++
Abin/vip | 18++++++++++++++++++
2 files changed, 40 insertions(+), 0 deletions(-)

diff --git a/bin/hooman 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 @@ -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