Created
October 15, 2013 08:58
-
-
Save nogweii/6988737 to your computer and use it in GitHub Desktop.
Use Frosty Meadow to generate a 'random' name for the server, but first seed Ruby's random with the contents of machine-id. Assumes that /etc/machine-id is valid and exists, and that it contains only hexadecimal numbers. Modify the source to any other source of predictable, guessable machine information. Like the MAC address or similar.
This file contains hidden or 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
require 'frosty_meadow' | |
# Use [Frosty Meadow](https://github.com/andyhmltn/frosty-meadow) to generate a | |
# 'random' name for the server, but first seed Ruby's random with the contents | |
# of machine-id. | |
# | |
# Assumes that /etc/machine-id is valid and exists, and that it contains only | |
# hexadecimal numbers. Modify the source to any other source of predictable, | |
# guessable machine information. Like the MAC address or similar. | |
machine_id_seed = open("/etc/machine-id").read.to_i(16) | |
old_seed = srand(machine_id_seed) | |
puts FrostyMeadow.generate | |
srand(old_seed) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment