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 daemon | |
import signal | |
class SighupDaemon(daemon.DaemonContext): | |
""" A DaemonContext that catches SIGHUPs """ | |
# get default signal handler map for this system | |
defaults = daemon.daemon.make_default_signal_map() | |
def __init__(self, *args, **kwargs): |
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
EXTNAME := extension | |
KEYFILE := $(EXTNAME).pem | |
CRXFILE := $(EXTNAME).crx | |
EXTDIR := $(EXTNAME) | |
SHELL := /usr/bin/env bash | |
CHROME := open /Applications/Google\ Chrome.app -n --args | |
CWD := $(shell pwd) | |
SIZE := $(shell wc -c <$(CRXFILE) | tr -d ' ') | |
VERSION := $(shell python -c "import json,sys;print json.loads(sys.stdin.read()).get('version','')" < $(EXTDIR)/manifest.json) | |
ZIPFILE := $(EXTNAME)-$(VERSION).crx |
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
var stack_holder = new Error; | |
function stackPrepare(e,stacks) { | |
var stack = stacks | |
for (var p in stack[0]) { | |
stack[p] = stack[0][p] | |
} | |
stack.find = function(fn) { | |
for (var i=stack.length;i--;) { | |
if (stack[i].getFunction() === fn) break; |
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
# -*- coding: utf-8 -*- | |
""" | |
RandTest | |
A unittest.TestCase subclass that facilitates working with | |
randomly-generated test data. | |
https://gist.github.com/2020459 | |
:copyright: (c) 2012 by Ori Livneh |
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
-*- coding: utf-8 -*- | |
""" | |
Dart-like print function | |
(C) 2012 by Ori Livneh | |
MIT License | |
""" | |
from __future__ import print_function | |
import inspect | |
import string |
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
# tail multiple files | |
# based on http://www.dabeaz.com/coroutines/follow.py | |
import sys | |
import time | |
import itertools | |
def tail(filenames): | |
# open files |
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
# -*- coding: utf-8 -*- | |
""" | |
nose2-random | |
This plug-in facilitates capturing and setting the state of the internal | |
random number generator prior to test execution. Test output is annotated | |
with a seed value that you can re-use to reproduce randomly-generated test | |
data across runs. | |
.. note :: |
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 bash | |
# Update Chromium (on OS X) to the latest nightly build. | |
install_dir='/Applications/Chromium.app' | |
base_url='http://commondatastorage.googleapis.com/chromium-browser-snapshots/Mac' | |
build=$(curl -s -f ${base_url}/LAST_CHANGE) | |
installed=$(/usr/libexec/PlistBuddy -c 'Print :SVNRevision' ${install_dir}/Contents/Info.plist) | |
script=$(basename $0) |
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 sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
# |
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
// An implementation of Jenkins's one-at-a-time hash | |
// <http://en.wikipedia.org/wiki/Jenkins_hash_function> | |
function hashString(key) { | |
var hash = 0, i = key.length; | |
while (i--) { | |
hash += key.charCodeAt(i); | |
hash += (hash << 10); | |
hash ^= (hash >> 6); | |
} |