Skip to content

Instantly share code, notes, and snippets.

View RonnyPfannschmidt's full-sized avatar
🦖
catching up with backlog

Ronny Pfannschmidt RonnyPfannschmidt

🦖
catching up with backlog
View GitHub Profile
# current method
obj = session.query(Foo).get(id) # select * from foo where id=?
obj.bar = session.query(Bar).get(bar_id) # select * from bar where id=?
# what i want:
obj = session.query(Foo).get(id) # select * from foo where id=?
obj.bar = session.hollow(Bar, bar_id) # invented name, no query should happen until i use attributes of obj.bar
# what i want to avoid
@RonnyPfannschmidt
RonnyPfannschmidt / index.html
Last active August 29, 2015 14:09
the app thats failing me
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h1> stuff</h1>
</body>
</html>
@RonnyPfannschmidt
RonnyPfannschmidt / shell.sh
Created August 2, 2015 09:23
tox shortcoming example
# this does not work since docs is not a factor
$ tox -e docs-html # will build html docs
$ tox -e docs-pdf # will build pdf docs
def parse_payload(data):
assert data, "Invalid data to parse, it's empty."
length, extra = data.split(':', 1)
length = int(length)
payload, extra = extra[:length], extra[length:]
assert extra, "No payload type: %r, %r" % (payload, extra)
payload_type, remain = extra[0], extra[1:]
assert len(payload) == length, "Data is wrong length %d vs %d" % (length, len(payload))
detox
Traceback (most recent call last):
File "/usr/local/bin/detox", line 9, in <module>
load_entry_point('detox==0.4.dev3', 'console_scripts', 'detox')()
File "/home/ronny/Projects/codespeak/detox/detox/main.py", line 17, in main
detox.startloopreport()
File "/home/ronny/Projects/codespeak/detox/detox/proc.py", line 106, in startloopreport
if self.toxsession.report.tw.hasmarkup:
File "/home/ronny/Projects/codespeak/detox/detox/proc.py", line 115, in toxsession
self._toxconfig, Report=ToxReporter, popen=Popen)
@RonnyPfannschmidt
RonnyPfannschmidt / build.sh
Created July 1, 2012 09:56
error with couchdb_browserid
rake plugin="git://github.com/iriscouch/browserid_couchdb origin/master"
% pypy-bin -m unittest test.test_oddball.ThreadingTest
MainThread: <TestThread(Thread-1, initial)>.start(): starting thread
<OS thread 139821105706752>: <Condition(<thread.lock object at 0x0000000003154260>, 0)>.notify(): no waiters
Thread-1: <TestThread(Thread-1, started 139821105706752)>.__bootstrap(): thread started
Thread-1: <TestThread(Thread-1, started 139821105706752)>.__bootstrap(): registering trace hook
Thread-1: <TestThread(Thread-1, started 139821105706752)>.__bootstrap(): normal return
Thread-1: <Condition(<thread.lock object at 0x0000000003154270>, 0)>.notify(): no waiters
MainThread: <TestThread(Thread-1, stopped 139821105706752)>.join(): thread stopped
Coverage.py warning: Trace function changed, measurement is likely wrong: None
FMainThread: <Thread(Thread-2, initial)>.start(): starting thread
- name: test
hosts: application
roles:
- {role: deployment, app: "{{applications[0]}}", }
- {role: deployment, app: "{{applications[1]}}", when: '{{applications|length > 1}}' }
- {role: deployment, app: "{{applications[2]}}", when: '{{applications|length > 2}}' }
- {role: deployment, app: "{{applications[3]}}", when: '{{applications|length > 3}}' }
- {role: deployment, app: "{{applications[4]}}", when: '{{applications|length > 4}}' }
- {role: deployment, app: "{{applications[5]}}", when: '{{applications|length > 5}}' }
- {role: deployment, app: "{{applications[6]}}", when: '{{applications|length > 6}}' }
# coding: utf-8
import pytest
import os
import random
@pytest.fixture(params=xrange(10))
def password():
return os.urandom(random.randrange(6, 10)).encode("hex")
#!/bin/bash
# A hacky command for a common task:
# - stash away all changes in working branch
# - update master from SVN
# - rebase working branch on master
# - flush all committed changes from working branch to master
# - push them to SVN
# - update working branch again
# - patch in changes