Skip to content

Instantly share code, notes, and snippets.

package main
import "fmt"
type Trie struct {
Children map[rune]*Trie
End bool
}
func NewTrie() *Trie {
// inspired by https://blog.merovius.de/2017/06/18/how-not-to-use-an-http-router.html
package main
import (
"fmt"
"net/http"
"path"
"strconv"
"strings"
)
CREATE TABLE aaa (x INT, y INT);
/*
CREATE TABLE
*/
INSERT INTO aaa VALUES (1,1), (2,2), (3,3);
/*
INSERT 0 3
*/
SELECT * FROM aaa;
from collections import deque
from threading import RLock
import time
class LeakyBucket(object):
def __init__(self, times, seconds, it=None):
self.times = times
self.seconds = seconds

Redbike

A simple, flexible scheduler for pools of distributed workers.

Redbike is a helpful building block with intentionally limited features. It's easy to schedule and distribute work however you like.

Redbike is available from the Python Package Index:

@lukearno
lukearno / signature_change.py
Created May 12, 2012 22:08
An example that I think might show an opportunity to enhance Python Flexmock.
from flexmock import flexmock
# foo() is the code under test
# other.bar() is a dependency we are mocking
def foo(other):
other.bar(1, 2)
class OldVersionOfDep():
def bar(self, x, y):
@lukearno
lukearno / baker.clj
Created February 12, 2012 21:13
Playing with Clojure's Java interop a little bit
;;;;;;; - baker.clj - ;;;;;;;;
;
; By Luke Arno <luke.arno@gmail.com>
; Proof of concept for "baking" badge data into a PNG,
; a la Mozilla Open Badges.
(ns baker
"Bake badge data into PNGs."
(:import (java.io File)
(com.sun.imageio.plugins.png PNGMetadata)