Skip to content

Instantly share code, notes, and snippets.

View dwillis's full-sized avatar

Derek Willis dwillis

View GitHub Profile
import csv
source = 'greene.txt'
offices = ['PRESIDENT AND VICE PRESIDENT', 'LIEUTENANT GOVERNOR FED-INTRA', 'GOVERNOR FED-INTRA', 'US Representative, District 34', 'SECRETARY OF STATE FED-INTRA', 'STATE TREASURER FED-INTRA',
'ATTORNEY GENERAL FED-INTRA', 'US REPRESENTATIVE - DISTRICT 7 FED-INTRA', 'STATE REPRESENTATIVE - 135 DST 135', 'COMMISSIONER - DISTRICT 2 DST 2', 'SHERIFF GREENE', 'ASSESSOR GREENE',
'TREASURER GREENE', 'PUBLIC ADMINISTRATOR GREENE', 'Constitutional Amendment No. 1 FED-INTRA', 'Constitutional Amendment No. 3 FED-INTRA', 'Supreme Court Judge - Patricia Breckenridge GREENE',
'Court of Appeals Judge, Southern District - Gary W.', '31st Judicial Circuit Div. No. 2 - Jones GREENE', '31st Judicial Circuit Div. No. 6 - Borthwick GREENE', 'Associate - 31st Circuit Div. No. 23 - Hosmer GREENE',
'Associate - 31st Circuit Div. No. 26 - Carrier GREENE', 'STATE REPRESENTATIVE - 134 DST 134', 'STATE REPRESENTATIVE - 132 DST 132', 'COMMISSIONER - DISTRICT 1 DST 1', 'STATE REPRESENTATIVE - 133 DST 133
county precinct office district party candidate votes election_day absentee absentee2
Greene 0001 1-ABC PRESIDENT AND VICE PRESIDENT REP DONALD J. TRUMP MICHAEL R. PENCE 444 444 0 0
Greene 0001 1-ABC PRESIDENT AND VICE PRESIDENT DEM JOSEPH R. BIDEN KAMALA D. HARRIS 672 672 0 0
Greene 0001 1-ABC PRESIDENT AND VICE PRESIDENT LIB JO JORGENSEN JEREMY (SPIKE) COHEN 21 21 0 0
Greene 0001 1-ABC PRESIDENT AND VICE PRESIDENT GRN HOWIE HAWKINS ANGELA NICOLE WALKER 4 4 0 0
Greene 0001 1-ABC PRESIDENT AND VICE PRESIDENT CST DON BLANKENSHIP WILLIAM MOHR 0 0 0 0
Greene 0001 1-ABC GOVERNOR FED-INTRA REP MIKE PARSON 458 458 0 0
Greene 0001 1-ABC GOVERNOR FED-INTRA DEM NICOLE GALLOWAY 671 671 0 0
Greene 0001 1-ABC GOVERNOR FED-INTRA LIB RIK COMBS 21 21 0 0
Greene 0001 1-ABC GOVERNOR FED-INTRA GRN JEROME HOWARD BAUER 4 4 0 0
var h2 = document.createElement('h2');
h2.className = "apple";
h2.innerHTML = "<span class=\"party-swatch-apple\"><img style:\"max-width: 40px;border-radius:10px;\" src="+object.twitter_profile_image_url+"></span><strong>"+object.candidate+"</strong>";
div.appendChild(h2);
var col = document.createElement('div');
col.className = "col_apple";
var figure1 = document.createElement('figure');
figure1.className = "apple_news";
var p_cash = document.createElement('p');
var img = document.createElement('image');
[{"candidate":"Donald J. Trump","twitter_profile_image_url":"http://pbs.twimg.com/profile_images/874276197357596672/kUuht00m_bigger.jpg","fec_committee_id":"C00580100","greater_cash":false,"less_cash":true,"cash_on_hand":"$93 million","cash_highest_for_filing_type":false,"previous_f3":true,"greater_receipts":false,"less_receipts":true,"receipts_total":"$6 million","receipts_highest_for_filing_type":false,"greater_disbursements":false,"less_disbursements":true,"total_disbursements":"$17 million","disbursements_highest_for_filing_type":false,"total_raised":"$150 million","total_spent":"$77 million"},{"candidate":"Mike Bloomberg","twitter_profile_image_url":"http://pbs.twimg.com/profile_images/615510114447953920/_1c4TTMM_bigger.jpg","fec_committee_id":"C00728154","greater_cash":true,"less_cash":false,"cash_on_hand":"$55 million","cash_highest_for_filing_type":true,"previous_f3":true,"greater_receipts":true,"less_receipts":false,"receipts_total":"$264 million","receipts_highest_for_filing_type":true,"greater_disb
@dwillis
dwillis / test.json
Last active December 10, 2019 17:41
[{"Candidate":"Donald J. Trump (R)","Total":"$97,779,039 ","Q3":"$40,958,013 "},
{"Candidate":"Bernie Sanders (D)","Total":"$74,373,436 ","Q3":"$28,025,463 "},
{"Candidate":"Elizabeth Warren (D)","Total":"$60,339,947 ","Q3":"$24,684,963 "},
{"Candidate":"Pete Buttigieg (D)","Total":"$51,549,046 ","Q3":"$19,241,475 "},
{"Candidate":"Tom Steyer (D)","Total":"$49,645,132 ","Q3":"$49,645,132 "},
{"Candidate":"Joe Biden (D)","Total":"$37,785,261 ","Q3":"$15,741,432 "},
{"Candidate":"John Delaney (D)","Total":"$21,052,449 ","Q3":"$868,452 "},
{"Candidate":"Cory Booker (D)","Total":"$18,494,485 ","Q3":"$6,023,097 "},
{"Candidate":"Amy Klobuchar (D)","Total":"$17,516,388 ","Q3":"$4,806,133 "},
{"Candidate":"Andrew Yang (D)","Total":"$14,537,531 ","Q3":"$9,922,626 "},
county precinct office district candidate party votes
Box Elder Beaver Dam/Collinston STRAIGHT PARTY Registered Voters NP 206
Box Elder Beaver Dam/Collinston STRAIGHT PARTY CONSTITUTION CON 0
Box Elder Beaver Dam/Collinston STRAIGHT PARTY CONSTITUTION CON 0
Box Elder Beaver Dam/Collinston STRAIGHT PARTY CONSTITUTION CON 0
Box Elder Beaver Dam/Collinston STRAIGHT PARTY LIBERTARIAN LIB 0
Box Elder Beaver Dam/Collinston STRAIGHT PARTY LIBERTARIAN LIB 0
Box Elder Beaver Dam/Collinston STRAIGHT PARTY LIBERTARIAN LIB 0
Box Elder Beaver Dam/Collinston STRAIGHT PARTY DEMOCRATIC DEM 4
Box Elder Beaver Dam/Collinston STRAIGHT PARTY DEMOCRATIC DEM 0

Keybase proof

I hereby claim:

  • I am dwillis on github.
  • I am derekwillis (https://keybase.io/derekwillis) on keybase.
  • I have a public key ASCwJoqh6bQaTjUMGKNdE19-YYSV3xlsRFaI8gt9uZTL7Qo

To claim this, I am signing this object:

@dwillis
dwillis / VotesWithOffsetFlake.py
Created March 7, 2018 20:30 — forked from robodellaz/VotesWithOffsetFlake.py
Congress API Jeff Flake
import json
import csv
import requests
headers = {'X-API-Key': 'DzoRodfNtDdLcIOVzLWcaApiRvDTzXR48CPPyc93'}
offset=0
for item in range(0, 1520):
url='https://api.propublica.org/congress/v2/members/F000444/votes.json?offset={0}'.format(offset)
Updating from bulk: https://www.gpo.gov/fdsys/bulkdata/BILLSTATUS/115/s/BILLSTATUS-115s1570.xml
/web/app/models/house_vote.rb:339: warning: key :description is duplicated and overwritten on line 344
** [Bugsnag] No API key configured, couldn't notify
rake aborted!
Elasticsearch::Transport::Transport::Errors::NotFound: [404] {"error":"RemoteTransportException[[Rawhide Kid][inet[/x.x.x.x:y]][indices:data/write/update]]; nested: DocumentMissingException[[congress-bills-2016][4] [bill][253115]: document missing]; ","status":404}
/web/vendor/bundle/ruby/2.3.0/gems/elasticsearch-transport-1.1.2/lib/elasticsearch/transport/transport/base.rb:201:in `__raise_transport_error'
/web/vendor/bundle/ruby/2.3.0/gems/elasticsearch-transport-1.1.2/lib/elasticsearch/transport/transport/base.rb:312:in `perform_request'
/web/vendor/bundle/ruby/2.3.0/gems/elasticsearch-transport-1.1.2/lib/elasticsearch/transport/transport/http/faraday.rb:20:in `perform_request'
/web/vendor/bundle/ruby/2.3.0/gems/elasticsearch-transport-1.1.2/lib/e