Last active
December 20, 2015 21:59
-
-
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]`
This file contains 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
gem "net/dns" | |
gem "colored" |
This file contains 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 "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