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 time | |
import ctypes | |
import threading | |
from ctypes.util import find_library | |
CFArrayRef = ctypes.c_void_p | |
CFMutableArrayRef = ctypes.c_void_p | |
CFIndex = ctypes.c_long | |
MultitouchSupport = ctypes.CDLL("/System/Library/PrivateFrameworks/MultitouchSupport.framework/MultitouchSupport") |
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
from __future__ import with_statement | |
# {{{ MultitouchSupport | |
import time | |
import ctypes | |
import threading | |
from ctypes.util import find_library | |
CFArrayRef = ctypes.c_void_p | |
CFMutableArrayRef = ctypes.c_void_p |
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
#include <stdio.h> | |
#include <libmemcached/memcached.h> | |
/** | |
* Test to show that the expiry time of memcached_delete does nothing at all. | |
* gcc -o memcached_delete_test memcached_delete_test.c -lmemcached | |
*/ | |
int main(int argc, char **argv) { | |
memcached_st *mc; |
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
#!/sbin/runscript | |
[[ -z "${PIDFILE}" ]] && PIDFILE="/var/run/gunicorn/${SVCNAME}.pid" | |
[[ -z "${BINARY}" ]] && BINARY="/usr/bin/gunicorn" | |
depend() { | |
need net | |
use dns logger netmount | |
} |
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
commit 4f35913316fa452ca49f44e88963ae6b6aee71a8 | |
Author: Ludvig Ericson <[email protected]> | |
Date: Tue Mar 1 13:49:33 2011 +0100 | |
Only free gets results if results were found | |
Fixes issue #30 | |
diff --git a/_pylibmcmodule.c b/_pylibmcmodule.c | |
index b26dab7..3dae489 100644 |
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 _pylibmc, pylibmc | |
from time import time, sleep | |
mc = pylibmc.Client(["127.0.0.1:11211", "127.0.0.1:11212"]) | |
mc.behaviors.update({"remove_failed": 2, | |
"ketama": True, | |
"ketama_hash": True, | |
"_retry_timeout": 2}) | |
print "libmemcached", _pylibmc.libmemcached_version |
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/2266437/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
import logging | |
from contextlib import contextmanager | |
from timeit import default_timer | |
time_logger = logging.getLogger(__package__ + ".timer") | |
@contextmanager | |
def timed_code(name=None): | |
next_unit = iter(("s", "ms", "ns", "us")).next | |
msg = "section %s took" % (name,) if name else "section took" |
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 | |
# encoding: utf-8 | |
"""Make an assignment pdf file from assignment.md + src directory | |
First run this: | |
sudo easy_install markdown pygments | |
Also, you have to have a title in the markdown file, i.e. a line starting with # |
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 | |
import ctypes | |
import ctypes.util | |
from coreaudio import ( | |
AudioObjectPropertyAddress, | |
kAudioHardwarePropertyDefaultInputDevice, | |
kAudioObjectPropertyScopeGlobal, | |
kAudioObjectPropertyElementMaster, | |
kAudioObjectSystemObject, | |
AudioDeviceID, |
OlderNewer