Skip to content

Instantly share code, notes, and snippets.

@keis
keis / yielding
Created September 18, 2013 21:31
try to figure out how often we yield for IO / other callbacks
function yielding() {
var stop = false,
stamp = (new Date()).getTime(),
count = 0,
clear;
function tick() {
if (!stop) {
count++;
clear = setImmediate(tick);
@keis
keis / bcproto
Created June 4, 2013 05:44
construct description of bitcoin block https://en.bitcoin.it/wiki/Protocol_specification
'''Description of bitcoin binary protocol fragments'''
from construct import (Construct, ConstructError, Struct, Bytes, Array,
ULInt8, ULInt16, ULInt32, ULInt64)
class VarInt(Construct):
def __init__(self, name):
Construct.__init__(self, name)
@keis
keis / screenshot.py
Created March 1, 2013 11:29
some screenshot stuff for selenium I ended up not using
'''screenshot utilities for selenium
Let's you work with screenshots of specific elements as PIL images.
>>> el = driver.find_element_by_css_selecto('#logotype')
>>> img = screenshot.element(driver, el)
>>> ref = Image.open('reference.png')
>>> screenshot.compare(ref, img)
True
'''

smoke

A concise Publish/Subscribe utility module. It supports both free-form signal names and a stricter style where signals are declared first. You can also mix them.

usage

@keis
keis / multigource
Created July 20, 2011 20:36
multi repo gource
#!/usr/bin/env bash
# Generates gource video (h.264) out of multiple repositories.
# Pass the repositories in command line arguments.
# Example:
# <this.sh> /path/to/repo1 /path/to/repo2
i=0
for repo in $*; do
# 1. Generate a Gource custom log files for each repo. This can be facilitated by the --output-custom-log FILE option of Gource as of 0.29:
logfile="$(mktemp /tmp/gource.XXXXXX)"
@keis
keis / slideshow
Created July 20, 2011 19:03
uzbl slideshow
#!/bin/sh
static='slideshow'
queue='slideshow_temp'
uri=""
Zzz=5
if [ -z "$UZBL_FIFO" ]; then
echo "$0: error: set UZBL_FIFO before running"
exit 2
@keis
keis / pyf
Created July 14, 2011 20:42
python pretty formater
#!/usr/bin/env python
import re
split = re.compile(r'(%[A-Z][^%]|%[^%])').split
def format(s, values):
return ''.join([str(values[k[1:]]) if k.startswith('%') else k for
k in split(s)])
if __name__ == '__main__':
@keis
keis / miniscollbarbug
Created April 11, 2011 18:08
mod of gtklauncher that display the scrollbars bug with gtk+-3.0
/*
* Copyright (C) 2006, 2007 Apple Inc.
* Copyright (C) 2007 Alp Toker <alp@atoker.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
@keis
keis / meshy.patch
Created February 1, 2011 21:21
install stuff
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1031631..d8f9b5c 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -16,10 +16,14 @@ endif()
if(WIN32)
set(CMAKE_MODULE_PATH "$ENV{OGRE_HOME}/CMake/;${CMAKE_MODULE_PATH}")
+ set(DATA_DIR bin/Release/Resources)
+ set(RELEASE_DIR bin/Release)
SWEOSWIK - Ord som rekommenderas utvidgat nyttjande i samtliga kontext
oortodox
ooficill
utensil
KIWSOEWS - Ord vars användade vänligt men bestämt undanbedes
fokus
I annat sammanhang än optik