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
# uses google's map geocoding api to find neighborhood names of a list of addresses | |
import json, requests, urllib | |
addrs = [] # put your own addresses here | |
result = {} | |
for addr in addrs: | |
params = {'address': addr, 'key': api_key} | |
encoded_req = 'https://maps.googleapis.com/maps/api/geocode/json?%s' % urllib.urlencode(params) |
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
#!/bin/sh | |
# Geolocate nginx site visitors with geoiplookup. | |
# Output format = <IP> <Date> <Request> <City of IP> | |
NGINX_LOG_FILE=/my/log/file/here | |
cat $NGINX_LOG_FILE | awk '{print $1, $4, $5, $6, $7}' | | |
while read p ; do | |
set -- $p | |
echo "$p ["`geoiplookup -f /usr/share/GeoIP/GeoLiteCity.dat "$1" | awk '{print $6, $7, $8, $9, $10, $11}'`"]"; |
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
var page = require('webpage').create(); | |
// Listener to display console msgs from within page.evaluate() | |
page.onConsoleMessage = function(msg) { | |
console.log(msg); | |
}; | |
// Open HN | |
page.open('https://news.ycombinator.com/item?id=7162197', function(status) { | |
if (status === 'success') { |
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
/* | |
* http://www.reddit.com/r/dailyprogrammer/comments/1heozl/070113_challenge_131_easy_who_tests_the_test | |
*/ | |
import java.util.*; // '*' cus i was lazy and doing this in a rush | |
import java.io.*; //ditto | |
public class Challenge131 { | |
public static void main (String args[]) { | |
//args[0] = input file name | |
try { |