Skip to content

Instantly share code, notes, and snippets.

View oldest.py
#!/usr/bin/env python
import re
import requests
import sys
import time
if len(sys.argv) < 2:
print("usage: python oldest.py <username>")
sys.exit(1)
View install.sh
#!/usr/bin/env bash
# many settings from https://raw.githubusercontent.com/mathiasbynens/dotfiles/master/.macos
# many settings from https://raw.githubusercontent.com/thoughtbot/laptop/master/mac
# instructions on finding the default you've changed: https://pawelgrzybek.com/change-macos-user-preferences-via-command-line/
# previous install notes at:
# https://gist.github.com/llimllib/ee591266e05bd880629a4e7511a61bb3
# https://gist.github.com/llimllib/e864a92da94ceb1ef0da2e06fd1f8d70
# https://gist.github.com/llimllib/aa4420cac617774ee2a54d8603d862e4
fancy_echo() {
View jq.md

llimllib's five minute guide to jq

Let's say somebody just asked us to make a frontend for the CFPB's complaint search API, but we've never used it. The first thing we do is just call it, and see a giant blob:

$ curl "https://www.consumerfinance.gov/data-research/consumer-complaints/search/api/v1/geo/states?search_term=test"
{"_scroll_id":"cXVlcnlUaGVuRmV0Y2g7NTs3Mjg1ODU6ZzRIUGF4VEZScjY5Ym1fNG1HRWc3Zzs3Mjg1ODY6ZzRIUGF4VEZScjY5Ym1fNG1HRWc3Zzs2MDg4OTM6RU85cXdTM2tRa2FEbjhUVkdZamwwdzs2MDg4OTI6RU85cXdTM2tRa2FEbjhUVkdZamwwdzs2MDU2NTU6NlFSZXU3eTdTWkNhMkNsQm1mclNFUTswOw==","took":11,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":1871,"max_score":0.0,"hits":[]},"aggregations":{"product":{"doc_count":1871,"product":{"doc_count_error_upper_bound":0,"sum_other_doc_count":614,"buckets":[{"key":"Credit reporting, credit repair services, or other personal consumer reports","doc_count":373,"product":{"doc_count_error_upper_bound":0,"sum_other_doc_count":0,"buckets":[{"key":"Credit r
View HMDA API request
$ curl -v 'https://ffiec.cfpb.gov/v2/data-browser-api/view/csv?states=ME&years=2018&actions_taken=1,3'
* Trying 3.221.239.145...
* TCP_NODELAY set
* Connected to ffiec.cfpb.gov (3.221.239.145) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /etc/ssl/cert.pem
CApath: none
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
@llimllib
llimllib / Makefile
Last active Apr 23, 2021
The simplest possible use of esbuild to import a package and run a function in the browser
View Makefile
build:
./node_modules/.bin/esbuild index.js --bundle --outfile=out.js
View argggg pandas.md

This is the story of how it took me about 3 hours to pull a key from a census data index into its own column.

The censusdata library returns dataframes that have an index object:

In [1]: import censusdata

In [2]: df = censusdata.download('acs5', 2015, censusdata.censusgeo([('state', '23'), ('county', '005'), ('block group', '*')]), [('C02003_001E')]).head()

In [3]: df
View main.go
package main
import (
"fmt"
"html/template"
"log"
"net/http"
"os"
)
View main.go
package main
// An extremely simple web application skeleton
import (
"fmt"
"log"
"net/http"
"os"
)
@llimllib
llimllib / hamming.md
Created Dec 28, 2020
One Man's View of Computer Science
View hamming.md

Richard W. Hamming

January 1969

One Man's View of Computer Science

Abstract

A number of observations and comments are directed toward suggesting that more than the usual engineering flavor be given to computer science. The engineering

View notebook
#!/usr/bin/env bash
# assume that if an `nb` dir (presumably a virtualenv) exists, then we don't
# need to do any of the time-consuming stuff
if [ ! -d nb ]; then
python -mvenv nb
# # ipykernel is required for bash_kernel \
nb/bin/pip install \
bash_kernel \
ipykernel \