Skip to content

Instantly share code, notes, and snippets.

@benbalter
Last active December 20, 2015 21:59
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 benbalter/6202058 to your computer and use it in GitHub Desktop.
Save benbalter/6202058 to your computer and use it in GitHub Desktop.
Detects if a given page is running on GitHub Pages. Usage: `./pages? [hostname]`
gem "net/dns"
gem "colored"
#!/usr/bin/env ruby
require "rubygems"
require "net/dns"
require "colored"
# fail?
if ARGV.length == 0
puts "Whoops. Usage: /pages? [hostname]".yellow
exit 1
end
# roll the dice...
Resolver(ARGV[0]) { |packet|
if "204.232.175.78" == packet.each_address {|ip| break ip.to_s }
puts "Yep. That's a GitHub pages site! :)".green
else
puts "Nope. Saldy, not yet on GitHub Pages. :(".red
end
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment