Skip to content

Instantly share code, notes, and snippets.

View mcdickenson's full-sized avatar

Matt Dickenson mcdickenson

View GitHub Profile
@mcdickenson
mcdickenson / get_replies.py
Created March 2, 2019 14:59
Extract replies to a tweet into a CSV
import csv
import tweepy
# get credentials at developer.twitter.com
auth = tweepy.OAuthHandler('API Key', 'API Secret')
auth.set_access_token('Access Token', 'Access Token Secret')
api = tweepy.API(auth)
# update these for whatever tweet you want to process replies to
@mcdickenson
mcdickenson / obama-nh.txt
Created August 26, 2018 16:04
Barack Obama's 2008 New Hampshire Primary Speech (plain text)
I want to congratulate Senator Clinton on a hard-fought victory here in
New Hampshire.
A few weeks ago, no one imagined that we'd have accomplished what we did
here tonight. For most of this campaign, we were far behind, and we
always knew our climb would be steep. But in record numbers, you came
out and spoke up for change. And with your voices and your votes, you
made it clear that at this moment - in this election - there is
something happening in America.
@mcdickenson
mcdickenson / bondi.jpg
Last active August 17, 2018 15:49
Image Histogram Matching with Polynomials
bondi.jpg
@mcdickenson
mcdickenson / city_codes.csv
Last active October 10, 2023 19:53
Census GEOID codes for major US cities
city state state_code county_code place_code
New York NY 36 000 51000
Los Angeles CA 06 000 44000
Chicago IL 17 000 14000
Houston TX 48 000 35000
Philadelphia PA 42 000 60000
Phoenix AZ 04 000 55000
San Antonio TX 48 000 65000
San Diego CA 06 000 66000
Dallas TX 48 000 19000
@mcdickenson
mcdickenson / compute_function_length_hist.py
Created September 11, 2017 21:06
Compute histogram of method line count
import ast
import os
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from collections import defaultdict
def walk_dir(dirname, ext):
@mcdickenson
mcdickenson / blur_faces.py
Created July 21, 2017 17:52
Blur faces in imagery with Google Cloud Vision
import cv2
import io
import json
import numpy as np
import os
from google.cloud import vision
from PIL import Image, ImageDraw
from StringIO import StringIO
require 'json'
require 'openssl'
require 'sinatra'
SIFT_WEBHOOK_SECRET_KEY = "#####"
post '/webhook' do
# Let's check whether this webhook actually came from Sift Science!
# First let's grab the signature from the postback's headers
postback_signature = request.env['X-Sift-Science-Signature']