This is an OS X-centric configuration.
The idea here is to use environment variables, loaded via aliases to mutt, to control which account you're loading. Years ago I had all of my accounts configured to be accessible from a single mutt
| # -*- coding: utf-8 -*- | |
| from __future__ import unicode_literals, absolute_import, division | |
| import pytest | |
| from django_webtest import DjangoTestApp, WebTestMixin | |
| class Stub(object): | |
| """Stub methods, keep track of calls.""" |
| from UserDict import IterableUserDict | |
| import collections | |
| __author__ = 'github.com/hangtwenty' | |
| def tupperware(mapping): | |
| """ Convert mappings to 'tupperwares' recursively. |
| -- Adapted from these sources: | |
| -- http://peterdowns.com/posts/open-iterm-finder-service.html | |
| -- https://gist.github.com/cowboy/905546 | |
| -- | |
| -- Modified to work with files as well, cd-ing to their container folder | |
| on run {input, parameters} | |
| tell application "Finder" | |
| set my_file to first item of input | |
| set filetype to (kind of (info for my_file)) | |
| -- Treats OS X applications as files. To treat them as folders, integrate this SO answer: |
| #!/usr/bin/env bash | |
| # This script prints out all of your Redis keys and their size in a human readable format | |
| # Copyright 2013 Brent O'Connor | |
| # License: http://www.apache.org/licenses/LICENSE-2.0 | |
| human_size() { | |
| awk -v sum="$1" ' BEGIN {hum[1024^3]="Gb"; hum[1024^2]="Mb"; hum[1024]="Kb"; for (x=1024^3; x>=1024; x/=1024) { if (sum>=x) { printf "%.2f %s\n",sum/x,hum[x]; break; } } if (sum<1024) print "1kb"; } ' | |
| } |
| When running "pip install m2crypto" in a virtualenv, I got the following error: | |
| Downloading/unpacking m2crypto | |
| Running setup.py egg_info for package m2crypto | |
| Installing collected packages: m2crypto | |
| Running setup.py install for m2crypto | |
| building 'M2Crypto.__m2crypto' extension | |
| swigging SWIG/_m2crypto.i to SWIG/_m2crypto_wrap.c | |
| swig -python -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I/usr/include -includeall -o SWIG/_m2crypto_wrap.c SWIG/_m2crypto.i |
| """ | |
| Add copy to clipboard from IPython! | |
| To install, just copy it to your profile/startup directory, typically: | |
| ~/.ipython/profile_default/startup/ | |
| Example usage: | |
| %clip hello world | |
| # will store "hello world" |
| # force HTTP to HTTPS - /etc/nginx/conf.d/nonssl.conf | |
| server { | |
| listen 80; | |
| server_name jira.example.com; | |
| access_log off; | |
| return 301 https://$server_name$request_uri; | |
| } | |
| # /etc/nginx/conf.d/jira.conf | |
| server { |
This is an OS X-centric configuration.
The idea here is to use environment variables, loaded via aliases to mutt, to control which account you're loading. Years ago I had all of my accounts configured to be accessible from a single mutt
| # Tell system when Xcode utilities live: | |
| sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer | |
| # Set "opendiff" as the default mergetool globally: | |
| git config --global merge.tool opendiff |
(This gist is pretty old; I've written up my current approach to the Pyramid integration on this blog post, but that blog post doesn't go into the transactional management, so you may still find this useful.)
I've created a Pyramid scaffold which integrates Alembic, a migration tool, with the standard SQLAlchemy scaffold. (It also configures the Mako template system, because I prefer Mako.)
I am also using PostgreSQL for my database. PostgreSQL supports nested transactions. This means I can setup the tables at the beginning of the test session, then start a transaction before each test happens and roll it back after the test; in turn, this means my tests operate in the same environment I expect to use in production, but they are also fast.
I based my approach on [sontek's blog post](http://sontek.net/blog/