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 / 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 / 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}
@myersjustinc
myersjustinc / commands.txt
Created August 8, 2021 18:08
YouTube-to-GIF cheat sheet
$ export VIDEO_ID='e1zvhJRIM7M'
$ export VIDEO_URL="https://www.youtube.com/watch?v=${VIDEO_ID}"
$ export CLIP_START='4.85'
$ export CLIP_LENGTH='5.33
$ export OUTPUT_NAME='kiki'
$ youtube-dl -F "${VIDEO_URL}"
# Find the 240p video-only MP4. Note the format number at the beginning of
# that line, which we'll refer to below as `${FORMAT}`.
@myersjustinc
myersjustinc / rename_twemoji.py
Created July 11, 2021 05:11
Rename Twemoji files to be human-readable
#!/usr/bin/env python
from operator import itemgetter
import os
import shutil
import sys
import requests
EMOJI_DATA_URL = (
@myersjustinc
myersjustinc / backup.sh
Created March 31, 2019 06:24
Duplicity backup script
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
BASE_DIR='[REDACTED]'
mkdir -p "${BASE_DIR}"
STATUS_FILE="${BASE_DIR}/duplicity.running"
function finish {
rm "${STATUS_FILE}"