Skip to content

Instantly share code, notes, and snippets.

$ echo '{"a":{"b":"quoted \" } {{{"}}{"c":{"d":2}}{"e":{"f":3}}' | go run firstobject.go
{"a":{"b":"quoted \" } {{{"}}
default 20:39:37.686798-0400 Finder bundle 0x4ff8 is launch-disabled and needs to be set trusted
default 20:39:37.688071-0400 lsd *** Registration warnings for <private>:
default 20:39:37.688087-0400 lsd Missing iTunes metadata
error 20:39:37.693434-0400 lsd LSStringLocalizer development region English not found in localizations available for bundle <private>
default 20:39:37.694953-0400 lsd Non-fatal error enumerating at <private>, continuing: Error Domain=NSCocoaErrorDomain Code=260 "The file “PlugIns” couldn’t be opened because there is no such file." UserInfo={NSURL=PlugIns/ -- file:///Applications/Firefox.app/Contents/, NSFilePath=/Applications/Firefox.app/Contents/PlugIns, NSUnderlyingError=0x1267223d0 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}
default 20:39:37.695065-0400 lsd - 45683955: Checking whether application is managed at file:///Applications/Firefox.app//org.mozilla.firefox
default 20:39:37.695185-0400 lsd (null):5:4:1:0:_LSServerRegisterItemInfo begin
default 20
@llimllib
llimllib / allowed_answers.txt
Created March 16, 2022 18:54
legal wordle words
cigar
rebut
sissy
humph
awake
blush
focal
evade
naval
serve
@llimllib
llimllib / amenu.py
Created December 28, 2021 17:17
The simplest menu implementation I could come up with in rich
from rich.console import Console
from rich.style import Style
from rich.table import Table
from getchar import getchar
SELECTED = Style(bgcolor="white")
def print_table(console, table, rows=[], selected=0):
for i, row in enumerate(rows):
#!/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)
#!/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() {

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
$ 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