Skip to content

Instantly share code, notes, and snippets.

@myersjustinc
myersjustinc / README.md
Created September 26, 2023 18:17
PGP word list

This is a copy of the [PGP "biometric" word list][], which actually comprises two lists, each with 256 entries each. (One contains only two-syllable words, and the other contains only three-syllable words.) The words were selected in 1995 to be as phonetically distinct from one another as feasible.

The Wikipedia entry describes the lists as being licensed under the [GNU Free Documentation License][], although I have no awareness of any publicly available primary sources stating this. The underlying source code for PGPfone, which was the motivation for the list, [is licensed MIT][].

@myersjustinc
myersjustinc / scaleBreaks.js
Last active July 26, 2023 20:25
Interpolate colors in LAB space
'use strict'
// DEPENDENCIES ---------------------------------------------------------------
import { argv, exit } from 'node:process'
import { rgb } from 'd3-color'
import { interpolateLab, piecewise } from 'd3-interpolate'
import { range } from 'd3-array'
@myersjustinc
myersjustinc / ffmpeg_helpers.bash
Last active April 17, 2023 01:27
Handy ffmpeg helpers
vid_get_scale() {
raw_path="$1"
long_dim="$2"
if [[ -z "${raw_path}" || -z "${long_dim}" ]]; then
echo "Usage: vid_get_scale RAW_PATH LONG_DIMENSION"
else
vid_meta="$( \
ffprobe \
-hide_banner \
-v quiet \
@myersjustinc
myersjustinc / README.md
Last active March 8, 2023 20:39
Remove Great Lakes and other water from Congressional districts shapefile

Remove Great Lakes and other water from Congressional districts shapefile

The problem

You want the most up-to-date shapefile of Congressional districts, but you don't want Michigan to be a giant blob.

(The Census Bureau offers some cartographic boundary shapefiles without this problem, but they aren't always the most current.)

@myersjustinc
myersjustinc / diff_kdbx.py
Created March 6, 2023 04:03
Diff two KeePassXC databases
#!/usr/bin/env python
from getpass import getpass
import sys
from pykeepass import PyKeePass
def main(db_1_path, db_2_path, key_file_path):
password = getpass()
db_1 = PyKeePass(db_1_path, password=password, keyfile=key_file_path)
@myersjustinc
myersjustinc / script.py
Last active February 16, 2023 22:07
Python script scaffold
#!/usr/bin/env python
import argparse
import logging
from pathlib import Path
# CONSTANTS -------------------------------------------------------------------
ROOT_DIR = Path(__file__).parent.resolve()
@myersjustinc
myersjustinc / README.md
Created November 12, 2012 19:30
AP results data retrieval and processing

We used these two scripts at the PBS NewsHour to update the live election-night results in our Vote 2012 Map Center with data from the Associated Press.

I've removed NewsHour-specific credentials, of course, as well as the part that uploaded JSON files to a PBS FTP server, so these haven't been tested in the form in which they're provided here--but retrieve_data.py downloaded the AP data files periodically from their FTP server to an internal HTTP server for our use, and update_json.py processed the files from that HTTP server into JSONP and pushed them to S3 for consumption by our users.

@myersjustinc
myersjustinc / nc.geojson
Created January 10, 2018 21:58
North Carolina's U.S. House districts for 115th Congress (extracted from TIGER/Line)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@myersjustinc
myersjustinc / addTimeZoneLabels-bookmarklet.js
Last active November 12, 2021 20:11
Bookmarklet to add time zone labels to Outlook 365's web-based calendar view
javascript:(function(){"use strict";const e='\n [role="main"] [aria-hidden="true"] > \n div > [aria-hidden="true"] time',t=`${e} abbr`;if(document.querySelectorAll(t).length)return;const r=new Date,n=document.querySelector('[role="main"]').getAttribute("aria-label"),o=parseInt(/\d{2}(?=:\d{2})/.exec(n)[0],10),a=[{formalName:%22America/Chicago%22,shortName:%22Central%22,abbr:%22CT%22},{formalName:%22America/New_York%22,shortName:%22Eastern%22,abbr:%22ET%22},{formalName:%22America/Los_Angeles%22,shortName:%22Pacific%22,abbr:%22PT%22}];a.forEach(function(e){const%20t=new%20Intl.DateTimeFormat(%22en-US%22,{timeZone:e.formalName,hour:%22numeric%22,minute:%22numeric%22,hour12:!1}).format(r),n=parseInt(/\d{2}(?=:\d{2})/.exec(t)[0],10);e.localHour=n,e.offsetFromOutlook=n-o}),document.querySelectorAll(e).forEach(function(e){if(null!=e.querySelector(%22abbr%22))return;const%20t=parseInt(e.textContent.trim(),10),r=document.createDocumentFragment();a.forEach(function(e,n){r.appendChild(function(e,t,r){const%20n=fun
@myersjustinc
myersjustinc / letter.tex
Last active September 28, 2021 20:54
LaTeX letter template
\documentclass[letterpaper]{article}
\usepackage[
% grid,gridBG,
% pscoord=false,
% texcoord=true,
% gridcolor=red!50,
% subgridcolor=black!25,
% gridunit=mm
]{eso-pic}