Skip to content

Instantly share code, notes, and snippets.

@dmotylev
Last active August 14, 2017 19:31
Show Gist options
  • Save dmotylev/fe0ddbe1b4643d7af13d38ae9f56d516 to your computer and use it in GitHub Desktop.
Save dmotylev/fe0ddbe1b4643d7af13d38ae9f56d516 to your computer and use it in GitHub Desktop.
A random Heroku-like hostname generator (bash)
#!/usr/bin/env bash
# original gist (javascript) https://gist.github.com/afriggeri/1266756
readonly ADJECTIVES=("autumn" "hidden" "bitter" "misty" "silent" "empty" \
"dry" "dark" "summer" "icy" "delicate" "quiet" "white" "cool" "spring" \
"winter" "patient" "twilight" "dawn" "crimson" "wispy" "weathered" "blue" \
"billowing" "broken" "cold" "damp" "falling" "frosty" "green" "long" "late" \
"lingering" "bold" "little" "morning" "muddy" "old" "red" "rough" "still" \
"small" "sparkling" "throbbing" "shy" "wandering" "withered" "wild" "black" \
"young" "holy" "solitary" "fragrant" "aged" "snowy" "proud" "floral" \
"restless" "divine" "polished" "ancient" "purple" "lively" "nameless")
readonly NOUNS=("waterfall" "river" "breeze" "moon" "rain" "wind" "sea" \
"morning" "snow" "lake" "sunset" "pine" "shadow" "leaf" "dawn" "glitter" \
"forest" "hill" "cloud" "meadow" "sun" "glade" "bird" "brook" "butterfly" \
"bush" "dew" "dust" "field" "fire" "flower" "firefly" "feather" "grass" \
"haze" "mountain" "night" "pond" "darkness" "snowflake" "silence" "sound" \
"sky" "shape" "surf" "thunder" "violet" "water" "wildflower" "wave" "water" \
"resonance" "sun" "wood" "dream" "cherry" "tree" "fog" "frost" "voice" \
"paper" "frog" "smoke" "star")
function rnd() { echo $(($(od -An -N2 -i /dev/random) % ${1:-1})); }
echo ${ADJECTIVES[$(rnd ${#ADJECTIVES[*]})]}-${NOUNS[$(rnd ${#NOUNS[*]})]}-$(rnd 9999)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment