Skip to content

Instantly share code, notes, and snippets.

@ashaw
Forked from thejefflarson/geoproxying.rb
Created December 1, 2010 21:55
Show Gist options
  • Save ashaw/724303 to your computer and use it in GitHub Desktop.
Save ashaw/724303 to your computer and use it in GitHub Desktop.
module Graticule #:nodoc:
module Geocoder #:nodoc:
class Google
def initialize(key)
@key = key
@proxies = ["http://127.0.0.1:8080", "http://127.0.0.1:8081", "http://127.0.0.1:8082"]
@url = URI.parse @proxies[rand(@proxies.length)] + '/maps/geo'
end
end
end
end
task :proxies => :environment do
todo = []
#todo << "killall ssh"
todo << "ssh -f domain1 -L 8080:maps.google.com:80 -N"
todo << "ssh -f domain2 -L 8081:maps.google.com:80 -N"
todo << "ssh -f domain3 -L 8082:maps.google.com:80 -N"
`#{todo.join("&&")}`
end
geocoder = Graticule.service(:google).new ""
ll = geocoder.locate full_address
ll.coordinates
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment