Skip to content

Instantly share code, notes, and snippets.

@mgood
mgood / sample.py
Created March 24, 2014 22:03
Example app for flask-failsafe PR #3
from flask import Flask
from flask_failsafe import failsafe
@failsafe
def create_app():
app = Flask(__name__)
app.config.update(
DEBUG=True,
SERVER_HOST='localhost',
SERVER_PORT=5001
@mgood
mgood / Test results
Created May 29, 2015 21:21
jproperties functional tests
$ py.test
============================= test session starts ==============================
platform darwin -- Python 2.7.6 -- py-1.4.26 -- pytest-2.7.1
rootdir: /Users/matt/Projects/jprops/.venv/jprops/src/jproperties, inifile:
plugins: xdist
collected 66 items
test_functional.py ........FFFFFF...F.........FFF.FFFFFFFFFF....F...F.FFFFFF.F...FFFF
=================================== FAILURES ===================================
def funcall(tuple, ~'[]', [index])
if index < 0
index = index + tuple.size()
erlang::element(index + 1, tuple)
module("Observing global vs. local properties ", {
setup: function() {
objectA = SC.Object.create({
calledLocalObserver: false,
calledGlobalObserver: false,
calledMixedObserver: false,
locallyObservedProperty: 'beingWatched',
2010-05-12 05:28:36 [1092] [INFO] Listening at: unix:/mnt/application/mopho-v5/run/gunicorn.sock
2010-05-12 05:28:36 [1097] [INFO] Worker spawned (pid: 1097)
2010-05-12 05:28:36 [1098] [INFO] Worker spawned (pid: 1098)
2010-05-12 05:28:36 [1098] [ERROR] Unexpected error in acceptor. Sepuku.
Traceback (most recent call last):
File "/mnt/application/mopho-v5/src/gunicorn/gunicorn/workers/geventlet.py", line 59, in acceptor
conn, addr = self.socket.accept()
File "/mnt/application/mopho-v5/lib/python2.6/site-packages/eventlet/greenio.py", line 161, in accept
timeout_exc=socket.timeout("timed out"))
File "/mnt/application/mopho-v5/lib/python2.6/site-packages/eventlet/hubs/__init__.py", line 118, in trampoline
@mgood
mgood / gist:1323560
Created October 28, 2011 21:06
dalton capturing
import dalton
dalton.inject()
from httplib import HTTPConnection
recorder = dalton.Recorder(caller=HTTPConnection('www.google.com'))
def test():
@mgood
mgood / gist:2714694
Created May 16, 2012 22:52
Sentry Script interface
class Script(Interface):
def __init__(self, name, path=None):
self.name = name
self.path = path
def get_hash(self):
return [self.name]
def serialize(self):
@mgood
mgood / Console output
Created August 22, 2012 00:31
Flask-DebugToolbar logging
$ python simpleapp.py
* Running on http://127.0.0.1:5000/
* Restarting with reloader
127.0.0.1 - - [21/Aug/2012 17:29:54] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [21/Aug/2012 17:29:54] "GET /favicon.ico HTTP/1.1" 404 -
@mgood
mgood / releases.py
Created June 5, 2013 20:29
PyPI XML-RPC errors
Fails on Python 2.6 with http:
$ python2.6 releases.py http
Traceback (most recent call last):
File "releases.py", line 5, in <module>
print xmlrpclib.ServerProxy('%s://pypi.python.org/pypi' % protocol).package_releases('roundup')
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/xmlrpclib.py", line 1199, in __call__
return self.__send(self.__name, args)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/xmlrpclib.py", line 1489, in __request
verbose=self.__verbose
@mgood
mgood / gist:6693271
Created September 25, 2013 00:25
HTTPretty errors with requests 2.0
======================================================================
FAIL: HTTPretty should support rotating responses with requests
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/mgood/Projects/HTTPretty/.tox/py27/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
self.test(*self.arg)
File "/Users/mgood/Projects/HTTPretty/.tox/py27/lib/python2.7/site-packages/nose/util.py", line 622, in newfunc
return func(*arg, **kw)
File "/Users/mgood/Projects/HTTPretty/httpretty/core.py", line 829, in wrapper
return test(*args, **kw)