Skip to content

Instantly share code, notes, and snippets.

@haxney
haxney / httpd.conf
Created June 19, 2012 21:04
Service FileMaker web publishing with Apache
LoadModule jk_module "c:/Program Files/FileMaker/FileMaker Server/Web Publishing/publishing-engine/web-server-support/apache-2.2/mod_jk.so"
JkWorkersFile "c:/Program Files/FileMaker/FileMaker Server/Admin/admin-helper/WEB-INF/conf/workers.properties"
JkMountFile "c:/Program Files/FileMaker/FileMaker Server/Admin/admin-helper/WEB-INF/conf/uriworkermap.properties"
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
JkRequestLogFormat "%w %V %T"
@haxney
haxney / denmark.csv
Created June 18, 2012 18:42
Eurostat import to Silk
GEO COUNTRY YEAR UNIT SECTOR Value
Denmark-2002 Denmark 2002 Millions of euro General government 100 829.0
Denmark-2003 Denmark 2003 Millions of euro General government 103 801.1
Denmark-2004 Denmark 2004 Millions of euro General government 107 505.9
Denmark-2005 Denmark 2005 Millions of euro General government 109 465.9
Denmark-2006 Denmark 2006 Millions of euro General government 112 841.5
Denmark-2007 Denmark 2007 Millions of euro General government 115 600.0
Denmark-2008 Denmark 2008 Millions of euro General government 121 145.8
Denmark-2009 Denmark 2009 Millions of euro General government 129 816.8
Denmark-2010 Denmark 2010 Millions of euro General government 136 225.5
@haxney
haxney / simple-recursive.el
Created April 22, 2012 22:19
Simple way to find files recursively and evaluate a body there
(defmacro go-files (base-dir &rest body)
"Recursively open files, visiting each one and running BODY there."
`(recursive-files ,base-dir '(progn ,@body)))
(defun recursive-files (dir form)
(loop
for (file is-dir) in (directory-files-and-attributes
dir
t
;; Ignore "." and ".." directories, but is too aggressive
@haxney
haxney / compiz.sh
Created February 27, 2012 19:13
Making Ubuntu usable again
$ sudo apt-get install compiz compizconfig-settings-manager
@haxney
haxney / gist:1841869
Created February 16, 2012 04:03
Some set elements reversed
{0, 8} #=> {8, 0}
{1, 9} #=> {9, 1}
{2, 10} #=> {10, 2}
{3, 11} #=> {3, 11}
{4, 12} #=> {4, 12}
{5, 13} #=> {13, 5}
@haxney
haxney / gist:1841863
Created February 16, 2012 04:02
differently-ordered equal sets
{0, 8} # => {8, 0}
{8, 0} # => {0, 8}
{8, 0} == {0, 8} #=> True
list({0, 8}) == list({8, 0}) #=> False
@haxney
haxney / gist:1841760
Created February 16, 2012 03:45
tricking python's set
a == b #=> false
hash(a) == hash(b) #=> true
ab = {a, b}
ba = {b, a}
ab == ba #=> true
list(ab) == list(ba) #=> false
@haxney
haxney / gist:1841437
Created February 16, 2012 03:18
setentry object
typedef struct {
long hash; /* cached hash code for the entry key */
PyObject *key;
} setentry;
@haxney
haxney / gist:1841325
Created February 16, 2012 03:04
Python hash collision resolution
# Find an entry for the given key, probing to a free location if the default is
# taken
#
# table - set object
# key - the item we are looking for
# hash_val - the hash of key
def lookup_entry(table, key, hash_val):
index = hash_val & table.mask
entry = table[index]
@haxney
haxney / _form.html.haml
Created August 22, 2011 02:07
Genericizing Rails views
= semantic_form_for entry do |f|
= f.inputs
= f.buttons