Skip to content

Instantly share code, notes, and snippets.

@iffy
iffy / sqlite
Created February 22, 2012 21:41
storm/sqlite3 diff
>>> import sqlite3
>>> from decimal import Decimal as D
>>>
>>>
>>> db = sqlite3.connect(':memory:')
>>>
>>> cur = db.cursor()
>>> _ = cur.execute('''create table foo (
... id integer primary key,
... val decimal(12,2) default 0.0
@iffy
iffy / index.html
Created May 7, 2012 05:49
line transition problem
<html>
<head>
<title>Chart</title>
<style>
path {
stroke: #f00;
}
.line {
stroke: #0f0;
fill: none;
@iffy
iffy / index.html
Created June 1, 2012 13:42
Introduction and the Reactor
<html>
<head>
<title>Bite-sized Twisted: Introduction and the Reactor</title>
<style>
body {
font: normal normal 16px Crimson Text;
color: #666666;
background: #ffffff none repeat scroll top left;
padding: 0 0 0 0;
}
@iffy
iffy / bleeding edge error
Created June 14, 2012 20:20
Installing codespeed
Command run:
mkvirtualenv speed
pip install django==1.3 South django-tastypie isodate
wget --no-check-certificate https://github.com/tobami/codespeed/tarball/master
tar xf master
cd tobami-codespeed-d9477b2/
python setup.py install
cd example/
python manage.py syncdb
@iffy
iffy / actual.sh
Created August 22, 2012 17:22
salt v. bash
# install dependencies
sudo apt-get install python-pip build-essential python-dev
sudo pip install Twisted buildbot sqlalchemy
# make user
sudo useradd buildbot -d /home/buildbot -m -s /bin/bash
# make build master
sudo su - buildbot
buildbot create-master master
@iffy
iffy / bypass.py
Created November 1, 2012 19:18
WrappedProcessTransport
from twisted.internet import protocol, interfaces, reactor
from zope.interface import implements
from twisted.python import log
class LoggingProtocol(protocol.ProcessProtocol):
def __init__(self, other):
@iffy
iffy / output
Created December 31, 2012 17:32
trial -j doctest failure
(newtx)10:29:17 [matt] ~/tmp $ trial test_stuff.py
Doctest: test_stuff
foo ... [OK]
-------------------------------------------------------------------------------
Ran 1 tests in 0.021s
PASSED (successes=1)
(newtx)10:29:23 [matt] ~/tmp $ trial -j 1 test_stuff.py
Running 1 tests.
@iffy
iffy / a.py
Created January 10, 2013 16:49
from twisted.trial.unittest import TestCase
from twisted.internet import defer
class Simple(TestCase):
def test_a(self):
d = defer.Deferred()
self.assertNoResult(d)
@iffy
iffy / output
Last active December 11, 2015 02:38
buildmaster hang
Last login: Mon Jan 14 10:18:06 on ttys001
10:45:26 [matt] ~ $ cd ~/tmp/
10:45:33 [matt] ~/tmp $ mkdir v
10:45:33 [matt] ~/tmp $ cd v
10:45:33 [matt] ~/tmp/v $ virtualenv sandbox
New python executable in sandbox/bin/python
Installing setuptools............done.
Installing pip...............done.
10:45:35 [matt] ~/tmp/v $ . sandbox/bin/activate
(sandbox)10:45:35 [matt] ~/tmp/v $ wget --no-check-certificate https://pysqlite.googlecode.com/files/pysqlite-2.6.3.tar.gz
$ python asservice.py
2013-01-15 14:42:45-0700 [-] Log opened.
2013-01-15 14:42:45-0700 [-] Factory starting on 9990
2013-01-15 14:42:45-0700 [-] Starting factory <twisted.internet.protocol.Factory instance at 0x12909b8>
2013-01-15 14:42:45-0700 [-] Unable to write to plugin cache /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Twisted-12.2.0-py2.6-macosx-10.3-fat.egg/twisted/plugins/dropin.cache: error number 13
2013-01-15 14:42:45-0700 [-] Starting factory <twisted.internet.protocol.ReconnectingClientFactory instance at 0x1296dc8>
2013-01-15 14:42:45-0700 [-] startService?
2013-01-15 14:42:45-0700 [Uninitialized] client connectionMade
2013-01-15 14:42:45-0700 [twisted.internet.protocol.Factory] server connectionMade
2013-01-15 14:42:46-0700 [BoringProto,client] Stopping factory <twisted.internet.protocol.ReconnectingClientFactory instance at 0x1296dc8>