Skip to content

Instantly share code, notes, and snippets.

View nailor's full-sized avatar

Jyrki Pulliainen nailor

View GitHub Profile
#!/usr/bin/perl
# Author: Bart Trojanowski <bart@jukie.net>
# Website: http://www.jukie.net/~bart/blog/urxvt-url-yank
# License: GPLv2
use strict;
use warnings;
my $url_matcher = qr{(
(?:https?://|ftp://|news://|mailto:|spotify:|file://|www\.)[ab-zA-Z0-9\-\@;\/?:&=%\$_.+!*\x27(),~#]+
#! perl -w
# http://triplefusion.net/system/macosx-clipboard
# ----------------------------------------------------------------------
# File: macosx-clipboard
# ----------------------------------------------------------------------
#
# All portions of code are copyright by their respective author/s.
# Copyright (c) 2006 Samuel Ljungkvist <salj@triplefusion.net>
;; -*- emacs-lisp -*-
(when (load "flymake" t)
(defun flymake-pyflakes-init ()
(let* ((temp-file (flymake-init-create-temp-buffer-copy
'flymake-create-temp-inplace))
(local-file (file-relative-name
temp-file
(file-name-directory buffer-file-name))))
(list "/Users/jyrki/.emacs-lib/pychecker.sh" (list local-file))))
(add-to-list 'flymake-allowed-file-name-masks
@nailor
nailor / pagefetcher.py
Created March 20, 2011 21:14
Script that fetches pages from search.twitter.com as long as there's something to fetch
#!/usr/bin/python
import json
import urllib
import sys
def fetch_pages():
i = 1
while True:
result = urllib.urlopen('http://search.twitter.com/search.json?%s' % (
@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):
@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 / 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()
#!/usr/bin/python
from r12950.app1.models import A
print 'foobar'
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
@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: