Skip to content

Instantly share code, notes, and snippets.

@yusuke
Created May 9, 2012 02:58
Show Gist options
  • Save yusuke/2641452 to your computer and use it in GitHub Desktop.
Save yusuke/2641452 to your computer and use it in GitHub Desktop.
require "net/https"
require "uri"
urls = ["http://pastebin.com/raw.php?i=Kc9ng18h",
"http://pastebin.com/raw.php?i=vCMndK2L",
"http://pastebin.com/raw.php?i=JdQkuYwG",
"http://pastebin.com/raw.php?i=fw43srjY"]
def get(url)
parsed = URI.parse(url)
https = Net::HTTP.new(parsed.host, parsed.port)
https.use_ssl = parsed.scheme == "https"
https.start { |w| w.get(url).body }
end
lines = Hash.new
urls.each do |url|
get(url).split(/\r\n/).each do |line|
pair = line.split(/:/)
lines.store(pair[0], pair[1])
end
end
p lines[ARGV[0]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment