Skip to content

Instantly share code, notes, and snippets.

mayo / input_volume.osa
Last active Sep 23, 2020
AppleScript to toggle the input device (microphone) volume between 0 (muted) and set volume
View input_volume.osa
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
View bumpme
Sat Jul 6 23:19:38 UTC 2019
mayo /
Last active Feb 16, 2019
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 Jan 17, 2019
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 May 29, 2021
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 / demo.ipnb
Last active Oct 29, 2015
Jupyter demo
View demo.ipnb
"cells": [
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
"outputs": [
View gist:44fcdc948d96ec9f9c7a
### Keybase proof
I hereby claim:
* I am mayo on github.
* I am mayo ( on keybase.
* I have a public key whose fingerprint is 50FE C3A3 64B5 9BEE 734D 0E9B 56A3 789C ED4D 2DD7
To claim this, I am signing this object:
mayo /
Created Mar 11, 2015
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 / Import.lua
Created Oct 25, 2014
This patch should not be required to import your Aperture library into Lightroom, and I don’t recommend using it. I wrote it when I was having problems with the import, but have since found the source of the problems fixable within the Aperture library. Please see my updated blog post at This g…
View Import.lua
--- Import.lua.orig 2014-10-25 10:13:07.000000000 -0700
+++ Import.lua 2014-10-25 10:41:34.000000000 -0700
@@ -154,15 +154,15 @@
local kwdInf, outputPath, err = Utils.getKeywordInfo( aperturePkg, workDir )
- if props.importOnlyUsedKeywords then
+ if props.importOnlyUsedKeywords and kwdInf then
for i, root in ipairs( kwdInf.keywords ) do
dropUnusedKeywords( root, kwdInf.keywords, i, kwdInf.usedKeywords )
mayo /
Last active Sep 26, 2017 — forked from mayo/
Playground gist for

Playground gist for