Skip to content

Instantly share code, notes, and snippets.

@timo
timo / gist:1641976
Created January 19, 2012 19:27
test case for pyside bug 1124
import unittest
from PySide import QtGui, QtCore
import itertools
class TestBug1124(unittest.TestCase):
def test_bug_1124(self):
a = QtGui.QApplication([])
all_black = QtGui.QPixmap(10, 6)
half_half = QtGui.QPixmap(2, 2)
@timo
timo / voronoi.py
Created January 20, 2012 14:48 — forked from purpleposeidon/voronoi.py
Voronoi!
#!/usr/bin/python
import math
import pygame
import random
import time
class Coord:
def __init__(self, x=0, y=0):
@timo
timo / fib.pl
Created February 28, 2012 14:48
perl6ish fibonacci
# vi: ft=perl6
use v6;
sub fib(Int $x) {
constant @fib_list = 0, 1, * + * ... *;
die "non-negative arguments required"
unless $x >= 0;
@fib_list[$x];
}
called from Sub 'Stringy' pc 28 ((file unknown):26524566) (src/gen/CORE.setting:673)
called from Sub 'infix:<~>' pc 34 ((file unknown):453) (src/gen/CORE.setting:960)
called from Sub 'Str' pc 87 ((file unknown):27026035) (src/gen/CORE.setting:670)
called from Sub 'nqp;Perl6;World;Str' pc 13364 (src/gen/perl6-symboltable.pir:5628) (src/Perl6/World.pm:639)
called from Sub 'Stringy' pc 28 ((file unknown):26524566) (src/gen/CORE.setting:673)
called from Sub 'infix:<~>' pc 34 ((file unknown):453) (src/gen/CORE.setting:960)
called from Sub 'Str' pc 87 ((file unknown):27026035) (src/gen/CORE.setting:670)
called from Sub 'nqp;Perl6;World;Str' pc 13364 (src/gen/perl6-symboltable.pir:5628) (src/Perl6/World.pm:639)
called from Sub 'Stringy' pc 28 ((file unknown):26524566) (src/gen/CORE.setting:673)
called from Sub 'nqp;Perl6;World;Stringy' pc 13364 (src/gen/perl6-symboltable.pir:5628) (src/Perl6/World.pm:639)
@timo
timo / segfault.py
Created May 1, 2012 19:47
crash due to improper reference counting in pyside and pyqt4
implementation = "PySide"
if implementation == "PySide":
from PySide.QtCore import *
from PySide.QtGui import *
else:
from PyQt4.QtCore import *
from PyQt4.QtGui import *
import sys
class TestPyTestFail(object):
def test_rewrite_fail(self):
yoink = range(10)
assert yoink[5] % 4 != 1
#> assert yoink[5] % 4 != 1
#E assert (5 %(py3)s) != 1
@timo
timo / gist:2602685
Created May 5, 2012 14:00
not sure what's wrong
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> traceback >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
self = <pypy.module.micronumpy.test.test_compile.TestRunner object at 0x50c04d0>
def test_slice(self):
interp = self.run("""
a = [1,2,3,4]
b = a -> :
b -> 3
> """)
@timo
timo / conftest.py
Created May 6, 2012 11:10 — forked from minrk/checkipnb.py
collect ipython notebook files for py.test runs
# put this file into any folder under which ipynb files shall be collected.
import pytest
import os,sys
wrapped_stdin = sys.stdin
sys.stdin = sys.__stdin__
from IPython.zmq.blockingkernelmanager import BlockingKernelManager
sys.stdin = wrapped_stdin
from IPython.nbformat.current import reads
@timo
timo / gist:2842279
Created May 31, 2012 09:42
error building parrot
: blib/lib/libparrot.a
/usr/bin/perl tools/build/pmc2c.pl --c src/dynpmc/select.pmc
/usr/bin/perl tools/build/pmc2c.pl --c src/dynpmc/dynlexpad.pmc
/usr/bin/perl tools/build/pmc2c.pl --c src/dynpmc/file.pmc
/usr/bin/perl tools/build/pmc2c.pl --c src/dynpmc/foo.pmc
/usr/bin/perl tools/build/pmc2c.pl --dump src/dynpmc/foo2.pmc
/usr/bin/perl tools/build/pmc2c.pl --c src/dynpmc/os.pmc
/usr/bin/perl tools/build/pmc2c.pl --c src/dynpmc/pccmethod_test.pmc
/usr/bin/perl tools/build/pmc2c.pl --c src/dynpmc/rotest.pmc
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/Scrt1.o(.debug_info): relocation 0 has invalid symbol index 11
@timo
timo / gist:2844565
Created May 31, 2012 16:24
unhelpful ipcluster output
[IPClusterStart] Using existing profile dir: u'/home/timo/.ipython/profile_ssh'
2012-05-31 18:23:02.844 [IPClusterStart] Starting ipcluster with [daemon=False]
2012-05-31 18:23:02.844 [IPClusterStart] Creating pid file: /home/timo/.ipython/profile_ssh/pid/ipcluster.pid
2012-05-31 18:23:02.844 [IPClusterStart] Starting Controller with SSH
2012-05-31 18:23:03.844 [IPClusterStart] Starting 6 Engines with SSH
2012-05-31 18:23:04.420 [IPClusterStart] IPython cluster: stopping
2012-05-31 18:23:04.421 [IPClusterStart] Stopping Engines...
2012-05-31 18:23:07.424 [IPClusterStart] Removing pid file: /home/timo/.ipython/profile_ssh/pid/ipcluster.pid