Skip to content

Instantly share code, notes, and snippets.

View samv's full-sized avatar

Sam Vilain samv

View GitHub Profile
@samv
samv / by-dels.pl
Created March 9, 2011 02:06
changes that net added/removed the most total lines from 2009-01-01 to 2009-09-30
#!/usr/bin/perl -nl
push @$a, $_ unless !@$a and !m{\S};
m{(\d+) insertions.*? (\d+) deletions}
&& do { push @{$x{$2-$1}},$a; $a=[] };
END {
@by_dels = sort {$a<=>$b} keys %x;
my $h2 = sub { print "$_[0]"; print "-" x length($_[0]); print "\n"; };
@samv
samv / refcounter.man
Created July 6, 2011 03:04
threads::tbb::refcounter proposed API
NAME
threads::tbb::refcounter - inside-out refcounts for XS types
SYNOPSIS
use threads::tbb::refcounter qw(Image::Magick);
DESCRIPTION
This module allows XS modules which were not written with
"threads::tbb" in mind (but are thread-safe) to be explicitly marked as
passable between threads, without requiring the XS type to explicitly
@samv
samv / e-mail 1
Created August 11, 2011 20:47
Flagged as spam. Actually ham. But it's no wonder that spamassassin had problems.
From: us.embassy@response-uk.co.uk
Subject: Notification of Credit Card Activity
To: sam@vilain.net
*** WARNING: THIS E-MAIL SERVES ONLY AS NOTIFICATION OF CREDIT CARD
ACTIVITY. THIS IS NOT AN APPOINTMENT LETTER OR A MACHINE READABLE VISA
RECEIPT ***
*** IF YOU APPEAR AT THE U.S. EMBASSY WITH ONLY THIS E-MAIL, YOU WILL BE
@samv
samv / keymap.txt
Created September 9, 2011 23:01
Apple Keymap
Note: quite a few of the marks available via option+key are combining diacritics; eg option+u, u => ü
~ ⁄! €@ ‹# ›$ fi% fl^ ‡& °* ·( ‚) —_ ±+
`` ¡1 ™2 £3 ¢4 ∞5 §6 ¶7 •8 ª9 º0 –- ≠=
ŒQ „W ´E ‰R ˇT ÁY ¨U ˆI ØO ∏P ”{ ’} »|
œq ∑w ´e ®r †t ¥y ¨u ˆi øo πp “[ ‘] «\
ÅA ÍS ÎD ÏF ˝G ÓH ÔJ K ÒL Ú: Æ"
åa ßs ∂d ƒf ©g ˙h ∆j ˚k ¬l …; æ'
@samv
samv / start-ssh-agent.sh
Created September 12, 2011 21:42
SSH AUTH SOCK setter
# ~/bin/start-ssh-agent.sh
# make sure your .bashrc sources this file, I use:
#
# if [ -t ]
# then
# . ~/bin/start-ssh-agent.sh
# fi
#
# Old versions of SSH used to call the variable
# SSH_AUTHORIZATION_SOCKET; this is no longer supported.
@samv
samv / output.log
Created October 31, 2011 16:52
New commits in gerrit since 8 days ago
interzone:~/src/gerrit$ git log --all --since="8 days ago" | git shortlog | cat
Augie Fackler (1):
documentation: update links from kernel.org to code.google.com
Brad Larson (1):
Show latest patchset with cherry-picked merge
Edwin Kempin (17):
Fix NPE in set-project-parent command if parent is not specified
stream-events: fix change subject in patchset-created event
22:25 < mugwump> dbugger: here's an example of how SQLAlchemy does it, for
inspiration:
http://readthedocs.org/docs/sqlalchemy-migrate/en/latest/#user-guide
22:28 < Harzilein> dbugger: here is a thread that mentions plans for schema
migration for typo3:
http://lists.typo3.org/pipermail/typo3-team-core-v5/2009-July/000349.html
@samv
samv / countries.yaml
Created December 29, 2011 19:15
Country codes in pi
---
Abkhazia:
7840: 1
7940: 1
99544: 1
Afghanistan:
93: 1
Albania:
355: 1
Algeria:
@samv
samv / gamble.py
Created February 26, 2012 18:43
Gambler's win
import random
cups = 3
i = 0
keeping_wins = 0
changing_wins = 0
while i < 1000:
i += 1
@samv
samv / output-2.txt
Created March 14, 2012 00:28
Program which uses a slave celery
$ rm celery*; nosetests -s -v tests/test_simplified.py
test_01_task (test_simplified.TestAsync) ... foo_our_task is: <@task: test.task>
assigned!
thread is: <Thread(Thread-1, initial)>
Worker ('worker0') running!
thread is: <Thread(Thread-1, started 4456366080)>
our_task is this time: <@task: test.task>
celery@worker0 has started.
result is :<AsyncResult: 7e42d3b4-0be5-4f48-8c7d-b305a78591a8>
We're in foo_our_task! Returning 'foo bar'