Skip to content

Instantly share code, notes, and snippets.

quad /
Created Oct 28, 2020
Block out my work calendar with my personal events
function hashify(hash, [key, value]) {
hash[key] = value;
return hash;
function eventId(event) {
if (event.isRecurringEvent()) {
return event.getId() + "-" + event.getStartTime().toISOString() + "-" + event.getEndTime();
def simplify_parens(expr):
Remove all unnecessary parenthesis for a simple algebra-like string. It maintains the brackets, so any operator can be swapped for any other and the resulting expression will have the same results before and after parenthesis reduction.
>>> simplify_parens('a')
>>> simplify_parens('a + b')
quad / Makefile
Last active Jan 22, 2019
Make macOS (OSX) Greyscale from the terminal (CLI)
View Makefile
tgray: tgray.c
clang -g -std=c11 -Wall -framework ApplicationServices $^ -o $@
quad / Makefile
Last active Aug 3, 2018
Find a cycle in a linked list, for all your tech interview problem needs.
View Makefile
CFLAGS=-Wall -Wextra -Werror -std=c99 -O
all: cycle
cycle: cycle.c
quad /
Created Apr 11, 2017
Keybase Proof

Keybase proof

I hereby claim:

  • I am quad on github.
  • I am quad ( on keybase.
  • I have a public key ASBxDFR1P5fGthosSBX-iUd18uAFSCpNZdqCY0yE0QaPvQo

To claim this, I am signing this object:

quad / zoe-text.html
Created Apr 3, 2017
An incomplete labour of impermanent love
View zoe-text.html
<meta charset="utf-8" />
body { background-color: white; margin: auto; text-align: center; }
p { writing-mode: vertical-rl; }
span { font-size: 3vh; }
#off { color: white };
quad /
Last active Jan 23, 2020
Convert USAA Bank Statements to Ledger Transactions
import datetime
import enum
import re
import sys
import types
from collections import namedtuple
from decimal import Decimal
from operator import attrgetter
quad /
Created Dec 14, 2016
Interview Cake Solutions
import typing
import unittest
class TreeNode:
def __init__(self, left=None, right=None):
self.left = left
self.right = right
def is_superbalanced(self):
quad / subtype_registration_example.rb
Created Mar 12, 2015
A rough sketch to how I'd register subtypes.
View subtype_registration_example.rb
class Thing <
@@things = {}
def self.parse description
type_name, color = description.split
@@things[type_name].new color
def self.type_code code
@@things[code] = self
quad / times.rb
Last active Aug 29, 2015
Because implementing cron is always a good idea.
View times.rb
require 'date'
require 'minitest/autorun'
class Time
def self.normalize time
dt = DateTime.parse(time).to_time.utc
Time.utc(, nil, nil, dt.hour, dt.min)
def inbetween start_time, end_time