Created
July 5, 2012 21:51
-
-
Save dyoder/3056720 to your computer and use it in GitHub Desktop.
Two syllable word-based name generotor
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
$available = File.open("available-domains.txt","r") do |file| | |
file.read.split | |
end | |
$unavailable = File.open("unavailable-domains.txt","r") do |file| | |
file.read.split | |
end | |
def available?(domain) | |
$available.include?(domain) or | |
(not $unavailable.include?(domain) and check?(domain)) | |
end | |
def check?(domain) | |
if (`whois #{domain}` =~ /^No match/) | |
$available << domain | |
true | |
else | |
$unavailable << domain | |
false | |
end | |
end | |
WORDS = %w( fire free base mesh phase mix mod stack in warp quark live air wave fly flight flash burst lab node blue coast surf drive book game hive lake mark pure quick real stream up down view shark on rise ride zen ).sort | |
$threads = [] | |
WORDS.each do |first| | |
WORDS.each do |second| | |
$threads << Thread.new do | |
domain = "#{first}#{second}.com" | |
if available?(domain) | |
puts domain | |
end | |
end | |
end | |
end | |
sleep 1 while $threads.any? do |thread| | |
thread.alive? | |
end | |
File.open("available-domains.txt","w+") do |file| | |
file.puts $available | |
end | |
File.open("unavailable-domains.txt","w+") do |file| | |
file.puts $unavailable | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment