Skip to content

Instantly share code, notes, and snippets.

friendset = set()
for line in open('input/soc-LiveJournal1Adj.txt'):
try:
user, friends = line.strip().split('\t')
except ValueError:
continue
for friend in friends.split(','):
friendset.add((user, friend))
@paulgb
paulgb / dinesafe_geocode.py
Last active July 23, 2018 20:03
Basic geocoding demonstration using Toronto Dinesafe data
'''
Geocode Toronto Dinesafe data.
Uses MapQuest's Nominatim mirror.
'''
import dbm
import urllib2
import csv
@paulgb
paulgb / fib_miles_km.ipynb
Created May 3, 2014 18:48
Fibonacci sequence approximates km/mile conversion
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@paulgb
paulgb / .bash_profile
Created May 7, 2014 19:32
Bash function for managing remote screen sessions
# replace all instances of "servername" with the remote host name
# `servername` lists available screen sessions
# `servername <session>` connects to a given session
function servername {
if [ -n "$1" ]; then
ssh -t servername "screen -DR $1";
else
echo "Usage: servername [environment]";
echo "Open sessions:"
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@paulgb
paulgb / index.html
Last active December 31, 2016 18:59
Hot Air Rises
<html>
<head>
<script src="https://d3js.org/d3.v4.min.js"></script>
</head>
<body>
<script src="script.js"></script>
</body>
</html>
<html>
<head>
<script src="https://d3js.org/d3.v4.min.js"></script>
</head>
<body>
<script src="script.js"></script>
</body>
</html>
As someone who has lived and worked in a number of diverse cities, I've had the pleasure of working with and getting to know many immigrants. Some of them are affected by the president's extreme, arbitrary, and racially motivated ban.
Uber is in a unique position. Not only a are you a leader in technology, your CEO, Travis Kalanick, has the ear of the president. Unfortunately, so far his soft wait-and-see stance only serves to enable the president's actions. I strongly believe that by refusing to take a strong stance on the Muslim ban, Uber is planting its flag firmly on the wrong side of history.
I urge you to pass this message up the chain: the tech world is watching. I can't speak for the entirety of an industry, but I know quite a few talented software developers. If there's one thing we have in common, it's that we are an idealistic bunch who build the world they want to live in. In today's market, we developers have a privileged position of being choosy about our employers. If Uber wants to maintain i
As someone who has lived and worked in a number of diverse cities, I've had the pleasure of working with and getting to know many immigrants. Some of them are affected by the president's extreme, arbitrary, and racially motivated ban.
Uber is in a unique position. Not only a are you a leader in technology, your CEO, Travis Kalanick, has the ear of the president. Unfortunately, so far his soft wait-and-see stance only serves to enable the president's actions. I strongly believe that by refusing to take a strong stance on the Muslim ban, Uber is planting its flag firmly on the wrong side of history.
I urge you to pass this message up the chain: the tech world is watching. I can't speak for the entirety of an industry, but I know quite a few talented software developers. If there's one thing we have in common, it's that we are an idealistic bunch who build the world they want to live in. In today's market, we developers have a privileged position of being choosy about our employers. If Uber wants to maintain i
state ev_r ev_d votes_r votes_d total_vote electoral_votes population
AL 9 0 941173 692611 1666272 9 4447100
AK 3 0 167398 79004 285560 3 626932
AZ 8 0 781652 685341 1532016 8 5130632
AR 6 0 472940 422768 921781 6 2673400
CA 0 54 4567429 5861203 10965856 54 33871648
CO 8 0 883748 738227 1741368 8 4301261
CT 0 8 561094 816015 1459525 8 3405565
DE 0 3 137288 180068 327622 3 783600
DC 0 2 18073 171923 201894 3 572059