Skip to content

Instantly share code, notes, and snippets.

View stuartlynn's full-sized avatar

Stuart Lynn stuartlynn

  • Two Sigma
  • Brooklyn
View GitHub Profile
@stuartlynn
stuartlynn / index.md
Created March 7, 2017 15:09
FOSS4G Workshop - CARTOFRAMES
@stuartlynn
stuartlynn / PageFreeze.py
Last active February 28, 2017 00:53
PageFreeze class
import requests
import json
import pandas as pd
class PageFreezer:
state_lookup = { -1: "Removal", 0: "Change", 1: "Addition" }
def __init__(self,url_1, url_2, api_key = None):
self.api_key = api_key
import pandas as pd
from urllib import urlencode
from IPython.display import IFrame
from urllib import urlencode
from collections import OrderedDict
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import urllib2
import requests
@stuartlynn
stuartlynn / index.md
Created December 12, 2016 15:49
CartoPythonLib

Functions we would want

c = new Carto('username', 'key')
df = c.getTable('tablename') # returns pandas data frame  (or cartoDataFrame)
df.apply(lamba x: x+1)
df.sync() # does a diff on the origional data frame and does insets / deletes / updates to make in sync 

OR

create table result as (
with one as (
SELECT nyc_pluto_15v1_resonly.the_geom,
white_noth,
asian_noth,
black_noth,
hl,
lt_12_race.cartodb_id,
resarea,
@stuartlynn
stuartlynn / change_check.py
Created August 15, 2016 14:17
Did this site change?
from pync import Notifier
import requests
import time
oldPage=None
while True:
html = requests.get('https://www.polymer-project.org/summit').text
#html = requests.get('http://www.bbc.com/news').text
if oldPage:
if html != oldPage:
@stuartlynn
stuartlynn / index.html
Created July 28, 2016 18:08
Hierarchical Bayes talk
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="chrome=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
@stuartlynn
stuartlynn / index.md
Created July 14, 2016 14:46
Thinking Spatially: How location intelligence can enhance your data and let you uncover new insights.

Talk Type

Learning Lab - 60 minute hands on skillshare or small group discussion (technical or other) Fireside chat - 45 minute talk with time for questions and answers

Session title

Thinking Spatially: How location intelligence can enhance your data and let you uncover new insights.

Describe what your session or activity will allow people to make, learn or do in 150 words or less

@stuartlynn
stuartlynn / index.md
Last active July 14, 2016 14:33
The Open Segments project: Taking back how we define our communities

Talk Type

Learning Lab - 60 minute hands on skillshare or small group discussion (technical or other) Fireside chat - 45 minute talk with time for questions and answers

Session title

The Open Segments project: Taking back how we define our communities

Describe what your session or activity will allow people to make, learn or do in 150 words or less