Skip to content

Instantly share code, notes, and snippets.

View ceostroff's full-sized avatar

Caitlin Ostroff ceostroff

View GitHub Profile
from selenium import webdriver
from selenium.webdriver.support.ui import Select
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.keys import Keys
from selenium.common.exceptions import *
from selenium.common.exceptions import NoSuchElementException
from urllib.request import urlopen
from bs4 import BeautifulSoup
GSS_CD,GSS_NM,TotalCases
E09000002,Barking and Dagenham, 30
E09000003,Barnet, 81
E08000016,Barnsley, 7
E06000022,Bath and North East Somerset, 11
E06000055,Bedford, 4
E09000004,Bexley, 37
E08000025,Birmingham, 75
E06000008,Blackburn with Darwen, 1
E06000009,Blackpool, 5
const fs = require('fs');
const d3 = require('d3');
const puppeteer = require('puppeteer');
const cheerio = require('cheerio');
(async() => {
const browser = await puppeteer.launch({ headless: false, args: ['--no-sandbox', '--disable-dev-shm-usage', '--disable-setuid-sandbox', '--unlimited-storage', '--full-memory-crash-report']});
const page = await browser.newPage();
await page.goto('https://facebook.com/pages/Mar-a-Lago/107978239230954');
@ceostroff
ceostroff / python-fl-voterfile.py
Last active March 7, 2020 15:47
Merging of Florida voter files #NICAR2020. Examples in Python and R. Code will take some time to run on large datasets.
from pandas import DataFrame, read_csv
from pandas import datetime as dt
import pandas as pd
def mergeTxtFiles():
# Portion of the code that merges all of the text files into one master file
read_history_files = glob.glob("voterhistory/*.txt")
with open("voter_history.txt", "wb") as outfile:
for f in read_files:
with open(f, "rb") as infile:
@ceostroff
ceostroff / data.csv
Created June 26, 2018 13:41
d3heatmap
x y value
United States May 2017 162093893
United States June '17 40280000
United States July '17 274680433
United States Aug. '17 42964766
United States Sept. '17 452547073
United States Oct. '17 229713535
United States Nov. '17 129347282
United States Dec. '17 383173632
United States Jan. 2018 194305485
import json
import csv
import re
from pprint import pprint
from bs4 import BeautifulSoup
from itertools import zip_longest
def getLinks():
with open('icobench-ico-details (1).json') as f:
data = json.load(f)

Keybase proof

I hereby claim:

  • I am ceostroff on github.
  • I am ceostroff (https://keybase.io/ceostroff) on keybase.
  • I have a public key ASD40CzSoVgO2ZhBW9hI2XzVpb6qHbB3FtemiyXKBGw8Mwo

To claim this, I am signing this object:

@ceostroff
ceostroff / sample.R
Last active March 10, 2018 18:29
NICAR18 R code with more annotations (#because why not)
# Intro to R (pre-registered class)
# NICAR 2018
# Saturday, March 10
# Charles Minshew, IRE-NICAR (charles@ire.org)
# Olga Pierce, ProPublica (olga.pierce@propublica.org)
# Ryann Grochowski Jones, ProPublica (ryann.jones@propublica.org)
# set working directory
setwd("C:/Users/Administrator/Desktop/hands_on_classes/Intro_to_R_pre_registered_attendees_only_1098")
@ceostroff
ceostroff / .block
Last active December 14, 2017 19:45
Florida Population D3 Density
height: 1000
border: off
@ceostroff
ceostroff / .block
Last active December 14, 2017 16:05
Hello World D3 Interactive Mapping
border: no
height: 600