Skip to content

Instantly share code, notes, and snippets.

View chrislkeller's full-sized avatar

Chris Keller chrislkeller

View GitHub Profile
[{"transcript":"two minutes and I don't know if doctors Graces back yet doesn't sound like it. Oh there he is awesome. Okay two minutes and then I'll start letting the reporters in and we'll have a bit of a delay um as they file in. I'm gonna let the reporters in now. Good afternoon and welcome to today's press conference. Thank you for joining us. My name is jodi Mcginnis Porter and I'll be moderated. Today's Covid 19 day 715 Press update. The press conference will last for about 45 minutes which includes a short presentation from doctors Grace and Q. And A. From our media partners. When we get to the Q. And a portion. If the reporter would please raise your hand if you'd like to ask a question and keep it raised We will lower it for you will go through one round of questions and if we have time we'll go to round two I'll turn it over now to dr Grace to go through his presentation. Good afternoon everybody. It's good to be back. Let me just changed my view. Perfect. And up I want to start today by introducin
@chrislkeller
chrislkeller / compassbearing.py
Created August 31, 2021 21:34
Thanks Ryan Murphy for the addition to the toolkit
# LICENSE: public domain
def calculate_initial_compass_bearing(pointA, pointB):
"""
Calculates the bearing between two points.
The formulae used is the following:
θ = atan2(sin(Δlong).cos(lat2),
cos(lat1).sin(lat2) − sin(lat1).cos(lat2).cos(Δlong))
import smtplib
from email.message import EmailMessage
import csv
import logging
logger = logging.getLogger("root")
logging.basicConfig(
format="\033[1;36m%(levelname)s: %(filename)s (def %(funcName)s %(lineno)s): \033[1;37m %(message)s",
level=logging.DEBUG
)
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import urllib.request
import json
import datetime
timestamp = datetime.datetime.now().strftime("%Y-%m-%d-%H%M%S")
file_output = '{0}-daily-data.json'.format(timestamp)
[{
"name": "Bernalillo",
"endDate": "2020-09-01",
"positivityRate": 2.1,
"casesPer100k": 4.8
}, {
"name": "Catron",
"endDate": "2020-09-01",
"positivityRate": 0,
"casesPer100k": 0
@chrislkeller
chrislkeller / README.md
Last active October 23, 2020 02:45
U.S. Supreme Court nominations over the years.

On Oct. 6, 2018, the U.S Senate on Saturday approved Brett Kavanaugh's nomination to the Supreme Court with a 50-48-1 vote, the narrowest margin for a confirmation vote in more than 130 years.

Kavanaugh's vote of 50-48-1 was 51.02%. Sen. Steve Daines (R-Mont.) was attending his daughter's wedding Saturday, and with Kavanaugh having enough other votes to win confirmation, Daines did not return to Washington for the vote. Sen. Lisa Murkowski (R-Alaska), who had planned to vote against Kavanaugh, instead voted “present” as a courtesy to Daines.

Kavanaugh Vote

This dataset was used as the basis for this piece in the L.A. Times:

I put this dataset together from a variety of sources, including:

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@chrislkeller
chrislkeller / state_voter_reg_totals.csv
Last active September 17, 2019 18:02
Attempt to compile California Statement of Registration as submitted to the secretary of state since October 2001.
We can make this file beautiful and searchable if this error is corrected: It looks like row 9 should actually have 19 columns, instead of 5. in line 8.
report_date,report_type,County,Eligible,Total Registered,Republican,Democratic,No Party Preference,American Independent,Americans Elect,Declined to State,Green,Libertarian,Miscellaneous,Natural Law,Other,Peace and Freedom,Reform,Unknown
2001-10-02,154 day,Alameda,944546.0,668305.0,133404.0,377745.0,,10902.0,,115770.0,14219.0,3458.0,8819.0,2325.0,,,1663.0,
2001-10-02,154 day,Alpine,939.0,777.0,312.0,271.0,,25.0,,146.0,5.0,7.0,4.0,1.0,,,6.0,
2001-10-02,154 day,Amador,24118.0,18615.0,8355.0,7352.0,,515.0,,1761.0,131.0,132.0,244.0,14.0,,,111.0,
2001-10-02,154 day,Butte,150308.0,112001.0,47518.0,41041.0,,3116.0,,15714.0,2217.0,802.0,1211.0,74.0,,,308.0,
2001-10-02,154 day,Calaveras,31480.0,24816.0,11029.0,9277.0,,646.0,,2960.0,239.0,375.0,120.0,43.0,,,127.0,
2001-10-02,154 day,Colusa,10756.0,7509.0,3347.0,3044.0,,200.0,,813.0,17.0,37.0,31.0,2.0,,,18.0,
2001-10-02,154 day,Contra Costa,651279.0,476935.0,154532.0,235612.0,,8349.0,,51760.0,4148.0,2282.0,17391.0,1064.0,,,1797.0,
2001-10-02,154 day,Del Norte,16754.0,126

NOTE: I'll work at fleshing this out a bit better

GOAL: Retrieve, catalog and display a daily record of voter registration figures in Orange County because a spokesperson for the registrar's office said they are unable to provide the figures.

TO PULL THIS OFF:

  • Determine when the figures are updated each day
    • HOW: Phone conversation with registrar, reporter
  • Navigate to the O.C. URL that contains the daily figures
  • Create a scheduler
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.