Skip to content

Instantly share code, notes, and snippets.

@ShooShoSha
Created June 1, 2020 19:20
Show Gist options
  • Save ShooShoSha/24669c3ac571096f75abd761a0481bd9 to your computer and use it in GitHub Desktop.
Save ShooShoSha/24669c3ac571096f75abd761a0481bd9 to your computer and use it in GitHub Desktop.
Shell script gets random mnemonic word
#!/bin/sh
# Gets a random mnemonic word from a gist.
# See https://gist.github.com/bwbaugh/bf78612ef58ad0402a05
URL='https://gist.githubusercontent.com/bwbaugh/bf78612ef58ad0402a05/raw/0f8ea7a054ff5c9c4209414beadf7a3acdd03373/server-name-wordlist-mnemonic.txt'
NAME=`curl --silent --show-error "$URL" | tail --lines +4 | shuf | head --lines 1`
echo "$NAME"
return 0
@ShooShoSha
Copy link
Author

ShooShoSha commented Feb 19, 2024

In PowerShell, suppose the variable $URL is the same as URL above, then $Name should be equivalent to Name as:

$Name = Get-Random ((Invoke-WebRequest -URI $URL).Content.ReplaceLineEndings().Split([Environment]::NewLine) | Select -Skip 4)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment