aboutsummaryrefslogtreecommitdiffstats
path: root/.local
diff options
context:
space:
mode:
authorla-ninpre <leobrekalini@gmail.com>2020-12-10 00:35:37 +0300
committerla-ninpre <leobrekalini@gmail.com>2020-12-10 00:35:37 +0300
commitb38b774896b0ded5abb45bcd75e4443203b76d47 (patch)
tree379ea5b99cdc3783049b1d74e8689d2aad83d22d /.local
parent107bde93c454ad1b67f04f926b6d052af6a9a7f0 (diff)
downloaddotfiles-b38b774896b0ded5abb45bcd75e4443203b76d47.tar.gz
dotfiles-b38b774896b0ded5abb45bcd75e4443203b76d47.zip
add small random string generator
and also change font in alacritty to jetbrains mono idk why, but just want to try it out
Diffstat (limited to '.local')
-rwxr-xr-x.local/bin/rand18
1 files changed, 18 insertions, 0 deletions
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