Skip to content

Instantly share code, notes, and snippets.

$ 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 March 20, 2022 20:08
The simplest possible use of esbuild to import a package and run a function in the browser
build:
./node_modules/.bin/esbuild index.js --bundle --outfile=out.js

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
package main
import (
"fmt"
"html/template"
"log"
"net/http"
"os"
)
package main
// An extremely simple web application skeleton
import (
"fmt"
"log"
"net/http"
"os"
)
@llimllib
llimllib / hamming.md
Created December 28, 2020 17:56
One Man's View of Computer Science

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

#!/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 \
@llimllib
llimllib / render_shapefile.bash
Last active November 18, 2020 19:22
Render a shapefile to a png and display it in your terminal, in one command
# make a temporary directory and push it on to the stack
tmp=$(mktemp -d); pushd $tmp && \
# get a US map at 20m resolution and unzip it
curl -s https://www2.census.gov/geo/tiger/GENZ2018/shp/cb_2018_us_region_20m.zip -o us.zip && \
unzip -q us.zip && \
# rasterize the map's only layer, using the `ALAND` feature. Restrict the
# bounding box (-te) to the continental US, because the map includes Alaska
# and Hawaii and Guam, and we're not going to bother with those here
# (sorry!). -ts sets the output size to 1200x800, then we give the input and
# output files.
import pyglet
class AWindow(pyglet.window.Window):
def __init__(self):
super(AWindow, self).__init__(100, 100)
self.batch = pyglet.graphics.Batch()
self.circle = pyglet.shapes.Circle(
import pyglet
class AWindow(pyglet.window.Window):
def __init__(self):
super(AWindow, self).__init__(100, 100)
self.batch = pyglet.graphics.Batch()
self.circle = pyglet.shapes.Circle(