Skip to content

Instantly share code, notes, and snippets.

public class Bullseye {
public static Food createBullseye() {
Kitchen kitchen = Kitchen.getInstance();
Pantry pantry = kitchen.getPantry();
Stove stove = kitchen.getStove();
Pan pan = kitchen.getFryingPan();
Butter butter = kitchen.getRefridgerator().find(Butter.class);
Carton<Egg> eggs = kitchen.getRefridgerator().findCartonOf(Egg.class);
@gmalmquist
gmalmquist / git-posterity
Created August 22, 2016 20:14
Quick utility to create a backup of a branch.
#!/usr/bin/env python2.7
from __future__ import print_function, with_statement
import os
import sys
from subprocess import Popen, PIPE
def call(cmd_str, *more):
args = cmd_str.split(' ')
if more:
@gmalmquist
gmalmquist / vector.py
Last active January 30, 2021 13:49
Simple python 3D vector class with operator overloading. Mostly for doing quick cli vector math.
class Vector(object):
@classmethod
def Lerp(cls, a, b, s):
return (1.0-s)*a + s*b
@classmethod
def Cross(cls, a, b):
return a^b
@gmalmquist
gmalmquist / pam.py
Last active August 11, 2023 13:14
Command-line stream editing using python.
#!/usr/bin/env python
# coding=utf-8
from __future__ import print_function
from collections import defaultdict
import datetime
import io
import json
import locale
import os
@gmalmquist
gmalmquist / maze.py
Created April 16, 2015 01:22
Simple ASCII-art maze generator with python, using basic un-optimized Prim's implementation.
#!/usr/bin/env python
from __future__ import print_function
import random
import sys
EMPTY = ' '
WALL = '#'
AGENT = 'o'