Skip to content

Instantly share code, notes, and snippets.

@davehughes
davehughes / README.md
Last active February 18, 2019 05:44
CLI helper for multifactor authentication

What's the point?

Stop fumbling for your phone every time you need to log in to a site with multi-factor authentication. Just run mfa token <profile> | pbcopy and paste the verification code.

(You do need to be able to grab the TOTP key for the site you're logging into, which is usually available somewhere near the QR code when setting up MFA).

Setup:

  • Install oathtool for your platform.
@davehughes
davehughes / boggle.py
Created May 20, 2016 20:46
Trie-based Boggle solver - potential interview exercise?
from __future__ import print_function
import random
import string
import sys
def generate_board(width=10, height=10):
return {
'width': width,
@davehughes
davehughes / mitmstart.py
Last active March 29, 2016 17:30
mitmproxy scripting quickstart
'''
See http://docs.mitmproxy.org/en/stable/scripting/inlinescripts.html for
further documentation.
Sample workflow:
# In one shell:
> mitmdump --port 8888 -w mitm.out
# In another:
@davehughes
davehughes / README
Last active February 21, 2016 18:36
"Easy Reading Format" bookmarklet
Adjusts formatting of full-width pages to make them easier to read. As an example, try it on https://isocpp.org/files/papers/p0225r0.html.
@davehughes
davehughes / .pgpass
Last active December 6, 2022 10:38
psql connection aliasing/management
# alias:northwind
db1.example.com:5432:northwind:postgres:hunter2
# alias:mainframe
db1.example.com:5432:mainframe:dave:password123
db1.example.com:5432:unaliased:postgres:
@davehughes
davehughes / rc300_backup.py
Created October 25, 2015 21:04 — forked from anonymous/rc300_backup.py
Basic script to upload a backup from the Boss RC-300 loop station to S3.
import datetime
import os
import StringIO
import tarfile
import boto
MOUNT_LOCATION = '/Volumes/BOSS_RC-300'
UPLOAD_REGION = '<your-region-here>'
import itertools
DIMENSIONS = {
'city': [
'sf', 'nyc', 'la', 'chicago',
],
'color': [
'red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet',
],
@davehughes
davehughes / keybase.md
Last active March 3, 2017 00:49
keybase.md

Keybase proof

I hereby claim:

  • I am davehughes on github.
  • I am davehughes (https://keybase.io/davehughes) on keybase.
  • I have a public key whose fingerprint is ACA8 38CA 6494 27D9 0859 0D74 ABAE 7E21 DF42 3F9B

To claim this, I am signing this object:

@davehughes
davehughes / .nesh-preload.js
Last active August 29, 2015 14:06
Nesh shell initialization
// Exports to Nesh shell
// + Add a shell alias 'alias nesh="nesh --eval {this file}"' to automatically
// trick out your shell with these natural code enhancements.
__ = _ = require('lodash');
config = require('./common').config();
db = require('./models');
Q = require('q');
mongo = require('monk')(config.db.mongo.url);
@davehughes
davehughes / detect-duplicate-south-migrations.sh
Created June 2, 2014 23:49
Detect duplicate indices in South migrations between two git commits
RETURN_CODE=0
MIGS_PATH="thefundersclub/migrations"