run with nix-build random-name.nix
then run result/bin/random-name
Created
April 9, 2019 06:22
-
-
Save edude03/78cac288cee221ba5cae23d6fcd09162 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with import <nixpkgs>{}; | |
let | |
aspell = aspellWithDicts (d: [d.en]); | |
wordlist = runCommand "mkWordList" {} '' | |
mkdir $out | |
${aspell}/bin/aspell -d en dump master | ${aspell}/bin/aspell -l en expand > $out/dict | |
''; | |
in writeScriptBin "random-name" '' | |
#!${bash}/bin/bash | |
WORD_ONE=$(${coreutils}/bin/shuf -n1 ${wordlist}/dict) | |
WORD_TWO=$(${coreutils}/bin/shuf -n1 ${wordlist}/dict) | |
COMBINED=''${WORD_ONE//[^[:alnum:]]/}-''${WORD_TWO//[^[:alnum:]]/} | |
echo ''${COMBINED,,} | |
''; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment