Skip to content

Instantly share code, notes, and snippets.

View higs4281's full-sized avatar

william higgins higs4281

  • Consumer Financial Protection Bureau
View GitHub Profile
@higs4281
higs4281 / dump_arrests.py
Created April 9, 2015 21:03
dump script
def dump_arrests(qset):
header = [
'name',
'dob',
'address',
'transient',
'sex',
'race',
'agency',
'booking_county',
@higs4281
higs4281 / hmda_chart_test.py
Created April 15, 2015 15:22
selenium test to check all possibilities in hmda explorer charts
"""
this tests a local instance of hmda explorer running at localhost:8000"
"""
import re
import datetime
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Chrome()
@higs4281
higs4281 / glacier.md
Last active August 29, 2015 14:25
Glacier arrangements

Glacier details

Flights ⏩

EM

CONFIRMATION #H4YWHZ

8/10
  • MSP -> FCA (Kalispell)
  • Delta 2393
  • 9:58p MSP -> 11:46p FCA
@higs4281
higs4281 / links.py
Last active August 3, 2018 08:36
Reg link insertion
@higs4281
higs4281 / current_age.py
Last active May 2, 2019 02:43
Current age
import datetime
from dateutil import parser
def current_age(birth_date):
"""Return current age for a string or datetime.date birth date."""
if isinstance(birth_date, datetime.date):
dob = birth_date
else:
@higs4281
higs4281 / misdirection.md
Created January 22, 2020 18:16
Full paths for Ask 404s
Original page Link on page 301 404
/about-us/newsroom/consumer-financial-protection-bureau-to-oversee-debt-collectors-2/ /askcfpb/search?selected_facets=category_exact:Debt%20Collection /askcfpb/search/?selected_facets=category_exact:Debt%20Collection /ask-cfpb/category-Debt Collection/
/about-us/blog/understanding-reverse-mortgages/ /askcfpb/search?selected_facets=category_exact:Mortgages&selected_facets=tag_exact:reverse%20mortgage /askcfpb/search/?selected_facets=category_exact:Mortgages&selected_facets=tag_exact:reverse%20mortgage /ask-cfpb/category-Mortgages/
/about-us/newsroom/consumer-financial-protection-bureau-report-finds-confusion-in-reverse-mortgage-market/ /askcfpb/search?selected_facets=category_exact:Mortgages&selected_facets=tag_exact:reverse%20mortgage /askcfpb/search/?selected_facets=category_exact:Mortgages&selected_facets=tag_exact:reverse%20mortgage /ask-cfpb/category-Mortgages/
/about-us/newsroom/consumer-financial-protecti
@higs4281
higs4281 / 2016_official_time.md
Last active February 19, 2020 04:37
Official time use, 2016

Federal official-time usage in 2016

A sampling of agencies.

Agency Hours per worker Total hours reported
Justice 10.60 366,417
National Labor Relations Board 8.08 7,585
Treasury 6.81 481,500
Office of Personnel Management 6.77 8,970
CFPB 6.03 6,662
@higs4281
higs4281 / fam_by_county.md
Last active May 31, 2021 23:56
Fam stats

Fam watch: COVID counts

May 31, 2021

Time-series charts

It has been more than a year since I started tracking cases and deaths in our respective counties on March 21, 2020.

Rochelle's Eagle County jumped way ahead of us all in March 2020, with an explosion of skier cases. Case and death counts per capita were among the most dramatic in the nation. Thankfully, Eagle County settled down, cases leveled off and deaths went practically flat. Now Rochelle's county is the lowest among all our counties for deaths per thousand.

Trading places

@higs4281
higs4281 / porch_video.md
Last active April 15, 2020 05:19
prine porches

John Prine kept a bungalow near the water in Gulfport, FL, a bohemian beach town next to St. Petersburg.
On Monday, when things didn't look good for Prine, the mayor of Gulfport asked people to come out on their porches at 6 p.m. and sing their favorite Prine song. The Tampa Bay Times, which is now printing papers only two days a week thanks to the pandemic, sent a photographer to shoot video of the porches.

https://www.tampabay.com/narratives/2020/04/07/in-gulfport-a-brief-but-loving-tribute-to-john-prine/

@higs4281
higs4281 / order_bh.md
Last active May 15, 2020 00:29
the order of `order_by`

I used a paying_for_college query of notifications as a test of where to use an order_by clause.

We have 193K notifications, unorderd by default. 179K of them have '1' in their oid field.

from paying_for_college.models import Notification

nosort = Notification.objects.filter(oid__contains='1')
first = Notification.objects.order_by('timestamp').filter(oid__contains='1')
last = Notification.objects.filter(oid__contains='1').order_by('timestamp')