# CLI Various CLI commands, all in the same repo ## websearch Inspired by jarun/ddgr, but way less fleshed out. Its advantage is it runs in about 0.6 seconds on a raspberry pi 4 versus about 1.5 seconds for ddgr on the same machine. It also prints results in ascending order, which is helpful on small screens that can only view a few results at a time. There are rust and go implementations. They behave the same and execute in the same amount of time. ## dt Simple utility to print the bare minimum of current time you are both likely to * a) care about * b) not know HHMM DOW DOM ## randpw Print out a random password ```bash randpw # print 20 char password randpw 40 # print 40 char password randpw basic 40 # print 40 char, [A-Za-z0-9] password randpw shell 40 # print 40 char, [A-Za-z0-9~@%*-_:,.] password ``` ## gitstats.sh In descending order and on a single line, print how many git commits there were in total and by year. Fails if not a repo. ```bash gitstats.sh # get stats in current dir gitstats.sh <path/to/repo> # get stats in <path/to/repo> ``` ## jsoncred Utility to import a file into json (with a password), write it as encrypted to a location, export it, or read a path from an existing chunk ``` \\USAGE: \\jsoncred # prints this usage \\jsoncred -h # prints this usage \\jsoncred <file> <command> <path> # basic format of command \\<command> is one of {i[mport], e[xport], p[rint]} \\jsoncred <file> # print whole file to stdout \\jsoncred <file> print # print top level keys \\jsoncred <file> print <a.b.c> # print path a.b.c of <file> to stdout \\jsoncred <file> import <path> # import <file> to <path on disk> \\jsoncred <file> import # import <file> to <file.enc> \\jsoncred <file> export <path> # export <file> to <path on disk> (- for stdout) \\jsoncred <file> export # export <file> to stdout (e.g. print it) \\ \\jsoncred will read password from env var JSONCRED_PASSWORD \\or prompt for one if none is available (not yet hidden). \\ \\set JSONCRED_DEBUG=true env var for verbose output ``` Note that it is fairly simple to also define shell aliases to get the shell to read (and clear) password. There are advantages to using the wrapping script: * Password is hidden from terminal display * You only need to enter password once for multiple reads/writes ```bash wp() { unset JSONCRED_PASSWORD } pw() { if [ "$JSONCRED_PASSWORD" = "" ]; then echo 'Password:' read -s password export JSONCRED_PASSWORD="$password" jc $@ fi } ``` ## c8r Command line calculator. Uses reverse polish notation.