Skip to content

Instantly share code, notes, and snippets.

@jamescgibson
jamescgibson / geocode_ips.rb
Created April 25, 2017 20:46
geocode_ip_csv
# Take a .csv file with IP addresses in a single column, and create a new file with the ip addresses
# and their associated ZIP codes
# Requires: Ruby, geocoder (gem install geocoder once ruby is installed
# Requies: File with ip addresses called ips.csv
require 'geocoder'
require 'csv'
ips = CSV.read("ips.csv").flatten