This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Chart</title> | |
<style> | |
path { | |
stroke: #f00; | |
} | |
.line { | |
stroke: #0f0; | |
fill: none; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from twisted.trial.unittest import TestCase | |
from twisted.internet import defer | |
class Simple(TestCase): | |
def test_a(self): | |
d = defer.Deferred() | |
self.assertNoResult(d) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ 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> |