This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import operator | |
import curator | |
import elasticsearch | |
class IndexFilter(object): | |
def __init__(self, | |
time_format="%Y.%m.%d", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
def main(): | |
parser = argparse.ArgumentParser("Do a thing with stuff!") | |
parser.add_argument("number", type=int) | |
args = parser.parse_args() | |
print "nan" * args.number + " batman!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class OTIPAddr < IPAddr | |
attr_reader :mask_addr | |
def prefix_len | |
@mask_addr.to_s(2).count "1" | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> def example(): | |
... return 1, 2, 3 | |
... | |
>>> example() | |
(1, 2, 3) | |
>>> a, b, c = example() | |
>>> a | |
1 | |
>>> b | |
2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import os | |
import json | |
import sqlite3 | |
import argparse | |
from collections import namedtuple, OrderedDict | |
from operator import attrgetter | |
from StringIO import StringIO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import copy | |
import random | |
import functools | |
def memoize(fn): | |
memo = {} | |
@functools.wraps(fn) | |
def _wrapper(*args): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import shlex | |
import tempfile | |
import subprocess | |
LOREM = """ | |
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc ornare enim | |
gravida congue mollis. Nullam imperdiet hendrerit lorem, vitae tempor nisl | |
facilisis ut. Integer at blandit ipsum, non blandit metus. Pellentesque enim | |
magna, malesuada sed mi eget, mattis viverra odio. Praesent ut imperdiet libero. | |
Phasellus varius laoreet quam, eget rutrum enim. Fusce sit amet volutpat arcu. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: ircd | |
# Required-Start: $all | |
# Required-Stop: $all | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: starts the charybdis ircd | |
# Description: starts charybdis using start-stop-daemon |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Author: Michael-Keith Bernard | |
-- Date: July 26, 2012 | |
-- | |
-- Game of Life | |
-- | |
-- Ported from this Clojure implementation: | |
-- | |
-- (defn neighbours [[x y]] | |
-- (for [dx [-1 0 1] dy (if (zero? dx) [-1 1] [-1 0 1])] | |
-- [(+ dx x) (+ dy y)])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Author: Michael-Keith Bernard | |
-- Date: July 27, 2012 | |
-- Notes: An example Binary Tree Zipper implementation in Lua | |
function node(v, left, right) | |
local n = {} | |
n.value = v | |
n.left = left | |
n.right = right | |
return n |