Skip to content

Instantly share code, notes, and snippets.

@scpike
Created December 8, 2014 20:06
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 scpike/a72a748126cbb4359c03 to your computer and use it in GitHub Desktop.
Save scpike/a72a748126cbb4359c03 to your computer and use it in GitHub Desktop.
Namecheap hosts file => Route 53
File.readlines(ARGV[0]).each do |l|
l.chomp!
xs = l.split("\t")
"@ MX ALT1.ASPMX.L.GOOGLE.COM. 20 1800"
if xs.count == 5
owner, rtype, tdata, pref, ttl = xs
pref = nil if pref.strip == "0"
next if rtype.strip == 'URL'
puts [owner, ttl, "IN", rtype, pref, tdata].compact.join("\t")
# example.com. IN MX 10 mail.example.com. ; mail.example.com is the mailserver for example.com
else
puts l unless l.to_s.strip == ''
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment