Skip to content

Instantly share code, notes, and snippets.

View lericson's full-sized avatar
🎺
Doot doot

Ludvig Ericson lericson

🎺
Doot doot
View GitHub Profile
@lericson
lericson / inda-pdf.py
Last active August 29, 2015 13:57
Assignment PDF creator tool automator
#!/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 #
@lericson
lericson / _main.py
Last active August 29, 2015 14:05 — forked from andreif/_main.py
# coding=utf-8
import ctypes
import ctypes.util
from coreaudio import (
AudioObjectPropertyAddress,
kAudioHardwarePropertyDefaultInputDevice,
kAudioObjectPropertyScopeGlobal,
kAudioObjectPropertyElementMaster,
kAudioObjectSystemObject,
AudioDeviceID,
@lericson
lericson / gist:0294c23d51af5cee579e
Created October 9, 2014 12:35
Logikanteckningar
det finns ett X så att X är en person och X har ett paraply
person(X), har(X, paraply).
det finns ett X så att om X är en person så har X ett paraply
person(X) -> har(X, paraply).
det finns inte ett X så att X inte har ett paraply
<=> för alla X som är en person så har X ett paraply
not(person(X), not(har(X, paraply)).
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")
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
#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;
@lericson
lericson / gist:847486
Created February 28, 2011 15:45
Gunicorn init script for Gentoo that checks liveliness properly
#!/sbin/runscript
[[ -z "${PIDFILE}" ]] && PIDFILE="/var/run/gunicorn/${SVCNAME}.pid"
[[ -z "${BINARY}" ]] && BINARY="/usr/bin/gunicorn"
depend() {
need net
use dns logger netmount
}
commit 4f35913316fa452ca49f44e88963ae6b6aee71a8
Author: Ludvig Ericson <ludvig@lericson.se>
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
@lericson
lericson / hack.sh
Created March 31, 2012 16:12 — forked from erikh/hack.sh
OSX For Hackers
#!/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
#
@lericson
lericson / gist:1430689
Created December 4, 2011 17:02
Failover test
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