From b38b774896b0ded5abb45bcd75e4443203b76d47 Mon Sep 17 00:00:00 2001 From: la-ninpre Date: Thu, 10 Dec 2020 00:35:37 +0300 Subject: add small random string generator and also change font in alacritty to jetbrains mono idk why, but just want to try it out --- .local/bin/rand | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 .local/bin/rand (limited to '.local') diff --git a/.local/bin/rand b/.local/bin/rand new file mode 100755 index 0000000..795885b --- /dev/null +++ b/.local/bin/rand @@ -0,0 +1,18 @@ +#!/bin/sh + +# rand (inspired by https://rgz.ee/random.html) +# +# generate random string from charset as first argument and length as second +# +# example: +# $ rand '1-9a-f' 10 +# > 329402aa42 +# +# defaults: +# charset -- all printable characters and space +# length -- 25 + +[ -z $1 ] && charset=' -~' || charset=$1 +[ -z $2 ] && length=25 || length=$2 + +tr -cd "$charset" < /dev/urandom | fold -w "$length" | head -n 1 -- cgit v1.2.3