aboutsummaryrefslogtreecommitdiff
path: root/templates/.bin/randword
diff options
context:
space:
mode:
authorBen Burwell <ben@benburwell.com>2019-08-13 14:40:54 -0400
committerBen Burwell <ben@benburwell.com>2019-08-13 14:40:54 -0400
commitc09d91fe95fca4367f47c06fc808cd02a1a8e6a5 (patch)
tree6c5c8dee0c219ab701dc1ff4c39e905dbac08e70 /templates/.bin/randword
add bins
Diffstat (limited to 'templates/.bin/randword')
-rwxr-xr-xtemplates/.bin/randword6
1 files changed, 6 insertions, 0 deletions
diff --git a/templates/.bin/randword b/templates/.bin/randword
new file mode 100755
index 0000000..3bf5bd8
--- /dev/null
+++ b/templates/.bin/randword
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+wf=/usr/share/dict/words
+total_words=`wc -l $wf | tr -d ' ' | cut -d'/' -f1`
+ln=`python3 -c "import secrets; print(secrets.randbelow($total_words))"`
+tail -n $ln $wf | head -n 1