Skip to content

Instantly share code, notes, and snippets.

View nailor's full-sized avatar

Jyrki Pulliainen nailor

View GitHub Profile
@nailor
nailor / uuid.py
Created May 26, 2009 12:52 — forked from mmalone/uuid.py
import socket
def sockrecv(sock):
d = ''
while not d or d[-1] != '\n':
d += sock.recv(8192)
return d
import XMonad
import XMonad.Config.Gnome
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.EwmhDesktops
import XMonad.Hooks.ManageDocks
import XMonad.Layout.ToggleLayouts as TL
import XMonad.Layout.PerWorkspace
import XMonad.Layout.NoBorders
import XMonad.Layout.ResizableTile
import XMonad.Util.Run(spawnPipe)
# Basic setup (direct imap)
source ~/.mutt/imap-creds
set folder="imaps://mail.inoi.fi:993/"
set spoolfile="imaps://mail.inoi.fi:993/INBOX"
set postponed="+INBOX.Drafts"
set record="imaps://mail.inoi.fi:993/INBOX.Sent"
set query_command= "abook --mutt-query '%s'"
macro index,pager A "<pipe-message>abook --add-email-quiet<return>" "add the sender address to abook"
@nailor
nailor / tadtwit.py
Created October 2, 2009 13:25
Thing that retweets for Turku Agile Day
#!/usr/bin/python
# This code is public domain and can be freely used.
#
# This script echoes all replies it has received that are either
# prefixed or suffixed with @username
#
# Requirements:
# Python 2.5+
# python-twitter: http://code.google.com/p/python-twitter/
# simplejson: http://www.undefined.org/python/
@nailor
nailor / util.py
Created October 21, 2009 12:31
A method to create test-specific temporary directories
# Copyright (c) 2009 Inoi oy
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use,
# copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following
# conditions:
start on runlevel 2
start on runlevel 3
start on runlevel 4
start on runlevel 5
stop on shutdown
exec /usr/bin/sudo -u www-data \
PHP_FCGI_CHILDREN=5 \
PHP_FCGI_MAX_REQUESTS=125 \
/usr/bin/php-cgi -q -b 127.0.0.1:9000
#!/usr/bin/python
from r12950.app1.models import A
print 'foobar'
@nailor
nailor / random.py
Created November 11, 2010 09:52
SequentialID and MonotonicID to use for CouchDBs not-so-random-IDs
import random
from datetime import datetime
import struct
import binascii
class SequentialID(object):
def __init__(self):
self.rng = random.Random()
self.reinit()
@nailor
nailor / gist:673057
Created November 11, 2010 19:45
For pinning packages from Maverick to Lucid
We couldn’t find that file to show.
@nailor
nailor / issue-10.py
Created February 19, 2011 08:37
Test for issue #10 in Trombi
import trombi
from tornado.ioloop import IOLoop
ioloop = IOLoop.instance()
f = open('onemb.zero')
db = trombi.from_uri('http://localhost:5984/test')
def doc_created(doc):