Skip to content

Instantly share code, notes, and snippets.

View ulope's full-sized avatar

Ulrich Petri ulope

View GitHub Profile
~# apt-cache policy ubuntu-zfs spl spl-dkms zfs-dkms zfsutils
spl-dkms:
Installed: 0.6.0.31-0ubuntu1~natty1
Candidate: 0.6.0.32-0ubuntu1~natty1
Version table:
0.6.0.32-0ubuntu1~natty1 0
500 http://ppa.launchpad.net/dajhorn/zfs/ubuntu/ natty/main amd64 Packages
*** 0.6.0.31-0ubuntu1~natty1 0
100 /var/lib/dpkg/status
spl:
from operator import attrgetter
import random
import string
import sys
# Evolutionary word finding.
# Inspired by: http://www.electricmonk.nl/log/2011/09/28/evolutionary-algorithm-evolving-hello-world/
#
#
# Copyright (c) 2011, Ulrich Petri <mail@ulo.pe>
@ulope
ulope / gist:1935894
Created February 28, 2012 23:06
Python: super(ClassName, self) vs. super(self.__class__, self)
"""Simple example showing why using super(self.__class__, self) is a BAD IDEA (tm)"""
class A(object):
def x(self):
print "A.x"
class B(A):
def x(self):
print "B.x"
super(B, self).x()
@ulope
ulope / fs_stress.py
Created March 5, 2012 15:23
FS Stressing (my use case: Provoking ZFS on Linux hang bugs)
#!/usr/bin/env python
# Copyright (c) 2012 Ulrich Petri <mail@ulo.pe>
#
# 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:
@ulope
ulope / css.css
Created April 19, 2012 17:06
CSS A4 page ruler
#page .ruler {
position: absolute;
}
#page .ruler.horz span {
width: 1cm;
height: 297mm;
display: block;
position: absolute;
}
17327887002563635621
980220736020261149
980189841993496163
385614653616940039
91237321471363057
76727623139027569
64739449360580447
56252530049601631
46105655694387571
41040815765288497
import fileinput
import itertools
def get_diff(teams):
a = teams[:len(teams)/2]
b = teams[len(teams)/2:]
# print "comp", a, b
return abs(sum(a) - sum(b))
def main():
html = format_html(
'<p class="url">{0} <a {1}>{2}</a><br />{3} {4}</p>',
_('Currently:'), flatatt(final_attrs), value,
_('Change:'), html
)
@ulope
ulope / interpolation.scss
Created October 15, 2012 14:14 — forked from idan/interpolation.scss
Works with this changes
$colors: rgb(202,0,32), rgb(244,165,130), rgb(247,247,247), rgb(146,197,222), rgb(5,113,176);
@mixin choropleth($bucket) {
.RdBu .q#{$bucket}-5 {
$base-fill: nth($colors, $bucket);
fill: $base-fill;
&:hover {
fill: darken($base-fill, 10%);
}
}
± ls -l
total 56
-rw-r--r-- 1 ulo staff 925 Nov 2 14:52 AUTHORS.txt
-rw-r--r-- 1 ulo staff 1090 Nov 2 14:52 LICENSE.txt
-rw-rw-rw- 1 ulo staff 162 Oct 30 2011 MANIFEST.in
-rw-r--r-- 1 ulo staff 172 Nov 2 14:52 README.rst
drwxrwxrwx 4 ulo staff 136 Oct 30 2011 ScriptTest-1.1.1-py2.7.egg
drwxrwxrwx 5 ulo staff 170 Nov 2 15:13 build
drwxrwxrwx 6 ulo staff 204 Oct 30 2011 contrib
drwxrwxrwx 5 ulo staff 170 Nov 2 15:13 dist