Skip to content

Instantly share code, notes, and snippets.

View Terrance's full-sized avatar
🚒
​The world is quiet here

Terrance Terrance

🚒
​The world is quiet here
View GitHub Profile
@Terrance
Terrance / hh3.py
Created May 21, 2021 15:01
Script to produce tables of data from a BT Home Hub 3 router.
#!/usr/bin/env python3
from base64 import b64encode
from collections import namedtuple
from datetime import timedelta
from hashlib import md5
import re
from bs4 import BeautifulSoup
from requests import Session

Keybase proof

I hereby claim:

  • I am Terrance on github.
  • I am terrance (https://keybase.io/terrance) on keybase.
  • I have a public key whose fingerprint is A78E 9C1E 9514 4560 7BF0 77C8 645A 86C9 6168 F957

To claim this, I am signing this object:

@Terrance
Terrance / monzo-oauth.html
Last active June 26, 2018 12:59
Alternative single-HTML-file Monzo login page, a drop-in replacement for https://auth.monzo.com.
<!DOCTYPE html>
<html>
<head>
<title>Monzo account access</title>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.1/css/bulma.min.css"
integrity="sha256-zIG416V1ynj3Wgju/scU80KAEWOsO5rRLfVyRDuOv7Q="
crossorigin="anonymous">
<style>
@Terrance
Terrance / SlackRTM.py
Last active June 20, 2018 18:44
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
Terrance / Hangoutsbot@.service
Created November 9, 2016 09:05
A systemd unit for running multiple Hangoutsbot instances.
[Unit]
Description=Hangoutsbot: %i
After=network.target
[Service]
Type=simple
User=hangoutsbot
Group=hangoutsbot
ExecStart=/opt/hangoutsbot/venv/bin/python /opt/hangoutsbot/hangupsbot/hangupsbot.py \
--log /var/hangoutsbot/%i/hangupsbot.log \
@Terrance
Terrance / WebJoinHangouts.py
Last active October 30, 2016 13:06
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
Terrance / DataUsage.py
Last active June 7, 2021 05:29
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
Terrance / CygwinSetup.py
Created June 8, 2016 18:55
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
try:
import urllib.request as urllib
except ImportError:
import urllib
@Terrance
Terrance / AjaxQueue.js
Created April 10, 2016 14:37
Limit concurrent jQuery ajax requests to at most 3 at a time, and queue the rest.
var ajaxReqs = 0;
var ajaxQueue = [];
var ajaxActive = 0;
var ajaxMaxConc = 3;
function addAjax(obj) {
ajaxReqs++;
var oldSuccess = obj.success;
var oldError = obj.error;
var callback = function() {
ajaxReqs--;
@Terrance
Terrance / SMModMgr.lua
Last active February 26, 2016 21:16
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.
function val2key(vals)
keys = {}
for i, key in ipairs(vals) do keys[key] = true end
return keys
end
local modmgr = {}
modmgr.__index = modmgr
setmetatable(modmgr, {