Skip to content

Instantly share code, notes, and snippets.

@grosser
Created July 4, 2012 04:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grosser/3045364 to your computer and use it in GitHub Desktop.
Save grosser/3045364 to your computer and use it in GitHub Desktop.
`rm accounts/*`
ips = File.readlines('ips.txt')
accounts = File.readlines('accounts.txt')
mapping = {}
accounts.each_with_index.map do |subdomain, i|
ip = ips[i % ips.size].strip
mapping[ip] ||= []
mapping[ip] << subdomain.strip
end
mapping.each do |ip, accounts|
File.open("accounts/#{ip}.txt",'w'){|f| f.write accounts * "\n" }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment