Skip to content

Instantly share code, notes, and snippets.

mayo /
Last active December 28, 2023 00:25
OpenPGP Claim

Ariadne OpenGPG Claim: openpgp4fpr:50fec3a364b59bee734d0e9b56a3789ced4d2dd7

mayo /
Last active March 10, 2023 07:44
Populate variable names from secret store, and easily clean them up.
# Loads and unloads secrets from pass into shell environment variables.
# Usage:
# # Load secrets:
# $ source
# # Unload secrets
# $ source unload
mayo /
Created March 11, 2015 07:19
Convert Simplenote Export JSON file into multiple Markdown files

SimpleNote to Markdown

This script converts JSON file from Simplenote Export web service into individual Markdown files.

It's nothing fancy, first argument is the JSON file, second argument is directory to write the notes to. The note files are named by using the first 60 characters (or a little more, up to a full word) of the first line of the note, stripped of any characters outside of letters, simple dash, underscore, brackets, space, single quote, and plug and equal signs.

Tags are stored on the bottom of the note on a line starting with "TAGS:", and the SimpleNote note ID/key as a "KEY:" line.

mayo /
Last active May 29, 2021 19:02
Import instagram data into a static site (Jekyll, Hugo, Hana, Metalsmith, etc)
import codecs
from datetime import datetime
import json
import os
import posixpath
import re
import shutil
import sys
# This script will import your instagram photos to your static site. It should work for most, assuming you customize the POST_TEMPLATE to match what your site uses.
mayo / input_volume.osa
Last active September 23, 2020 20:37
AppleScript to toggle the input device (microphone) volume between 0 (muted) and set volume
on run
set vol_level to (input volume of (get volume settings))
if (vol_level < 1) then
set volume input volume ReadVolumeLevel()
set volume input volume 0
return vol_level
end if
mayo /
Last active February 16, 2019 06:21
Generate Beancount ledger from Banktivityfor iOS
from datetime import date
import sqlite3
EPOCH_OFFSET = 978278400
conn = sqlite3.connect('banktivity.sql')
conn.row_factory = sqlite3.Row
first_date = None
accounts = set([])
mayo /
Created January 17, 2019 00:24
Process rST (restructured text) strings using Sphinx
# This is particularly useful when your doc strings are written in rST as part of
# a bigger project, but are also needed to be displayed elsewhere, for when when
# generating code.
This is intended to have similar interface to doctools.core (specifically
publish_string level of methods), but still could use more cleanup. Plaintext
output is assumed. Changing this would require tinkering with the Sphinx writers.
mayo /
Last active September 26, 2017 23:09 — forked from mayo/
Playground gist for

Playground gist for

mayo /
Last active July 16, 2016 04:32 — forked from mbostock/weekday.js

A basic example of using mbostock's weekday.js gist to to plot only weekdays using a linear scale. The resulting charts will not show gaps where weekends would be.

mayo / demo.ipnb
Last active October 29, 2015 23:16
Jupyter demo
"cells": [
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
"outputs": [