Skip to content

Instantly share code, notes, and snippets.


Terrance Terrance

Block or report user

Report or block Terrance

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
Terrance / monzo-oauth.html
Last active Jun 26, 2018
Alternative single-HTML-file Monzo login page, a drop-in replacement for
View monzo-oauth.html
<!DOCTYPE html>
<title>Monzo account access</title>
Terrance /
Last active Jun 20, 2018
A minimal asyncio client for the Slack real-time messaging (RTM) APIs.
import aiohttp
import asyncio
import logging
class SlackAPIError(Exception): pass
class Slack(object):
Terrance / Hangoutsbot@.service
Created Nov 9, 2016
A systemd unit for running multiple Hangoutsbot instances.
View Hangoutsbot@.service
Description=Hangoutsbot: %i
ExecStart=/opt/hangoutsbot/venv/bin/python /opt/hangoutsbot/hangupsbot/ \
--log /var/hangoutsbot/%i/hangupsbot.log \
Terrance /
Last active Oct 30, 2016
Proof-of-concept web-based joining of Hangouts conversations, using Flask and hangups. Warning: in its current state, allows any user to be invited to any conversation available to the hangups user.
import asyncio
import os
import shlex
from threading import Thread
import time
from emoji import emojize
from flask import Flask, redirect, render_template, request, session, url_for
import hangups
from hangups import hangouts_pb2
Terrance /
Last active May 19, 2017
Methods for parsing free mobile data usage on Three UK and FreedomPop UK. No guarantees that these will work with paid data plans.
from collections import namedtuple
from datetime import datetime, date, timedelta
import re
import requests
from bs4 import BeautifulSoup
Row = namedtuple("Row", ["number", "network", "total", "left", "reset"])
Terrance /
Created Jun 8, 2016
A wrapper script for Cygwin's setup.exe, with argparse-based command line handling.
#!/usr/bin/env python
from argparse import ArgumentParser
from itertools import chain
import os
import subprocess
import urllib.request as urllib
except ImportError:
import urllib
Terrance / AjaxQueue.js
Created Apr 10, 2016
Limit concurrent jQuery ajax requests to at most 3 at a time, and queue the rest.
View AjaxQueue.js
var ajaxReqs = 0;
var ajaxQueue = [];
var ajaxActive = 0;
var ajaxMaxConc = 3;
function addAjax(obj) {
var oldSuccess = obj.success;
var oldError = obj.error;
var callback = function() {
Terrance / SMModMgr.lua
Last active Feb 26, 2016
A Lua library that simplifies scripting custom mods within a song. SM allows stepped songs (in addition to themes) to make use of additional logic programmed in Lua -- the API provides full access to notes, mods and timing.
View SMModMgr.lua
function val2key(vals)
keys = {}
for i, key in ipairs(vals) do keys[key] = true end
return keys
local modmgr = {}
modmgr.__index = modmgr
setmetatable(modmgr, {
Terrance /
Created Feb 12, 2016
A script for processing data from Ingress attack notification emails.


  • phpQuery
  • Medoo

NB: db.php is just a wrapper for Medoo that reads $dbPath and returns a corresponding Medoo instance.

Database schema

Terrance /
Created Nov 18, 2015
An Anki plugin to preview cards in the browser. Old and probably broken; uploaded here for completeness.
# Card Viewer 1.3: a small plugin to show cards without reviewing.
# This plugin will export cards to HTML, and open them in your browser.
# Select a card, then go to Edit > View Card, select View from the toolbar, or press Ctrl+Return.
from aqt.browser import BrowserToolbar
from aqt import mw
from aqt.qt import *
from aqt.utils import shortcut, showInfo
from anki.find import fieldNames
You can’t perform that action at this time.