Last active
December 18, 2015 13:39
-
-
Save harlantwood/5791655 to your computer and use it in GitHub Desktop.
Random subdomain segment generation
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
#!/usr/bin/env ruby | |
require 'securerandom' | |
MAX_SUBDOMAIN_SEGMENT_SIZE = 63 | |
key = SecureRandom.base64 MAX_SUBDOMAIN_SEGMENT_SIZE*2 | |
key.gsub!(/\W/, '').downcase! | |
key = key[0...MAX_SUBDOMAIN_SEGMENT_SIZE] | |
puts key |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment