Skip to content

Instantly share code, notes, and snippets.

View aaronlelevier's full-sized avatar

Aaron Lelevier aaronlelevier

View GitHub Profile
@simoncoulton
simoncoulton / nginx-uwsgi-python3
Created May 7, 2012 04:39
Setting up Nginx, uWSGI & Python3
======================================
Setting up Nginx, uWSGI and Python3
======================================
First off, I'm traditionally a PHP developer, but am looking at moving across to Python. I really struggled to find decent documentation on how to get a server up and running for deploying Python web applications from the point of view of someone coming from PHP. The main problems I came across with documentation were:
1) Only showed you how to run the server for a single web application.
2) Only showed you how to configure the app, not the server it was running on.
My preferred workflow for development is by setting up a new VM in VMware Fusion and then forwarding through all requests to that VM via /etc/hosts. This might not be the optimal way to get things up and running, but it works for me.
@amtal
amtal / fileop.erl
Created September 25, 2011 00:37
Monad example in Erlang.
-module(fileop).
-export([write_file/3]).
-compile({parse_transform,do}).
%% Uses an error monad to neatly compose a bunch of failing functions.
%%
%% Everything being composed returns ok|{ok,Result}|{error,Reason}. At
%% the first error, the reason term is returned. The monad factors out
%% the behaviour of piping all possible errors to the output (via a
%% try-throw or case tree) if they occur.
@baijum
baijum / selenium_with_python.rst
Last active February 9, 2026 05:31
Selenium with Python
@coderanger
coderanger / admin.py
Created August 31, 2010 22:45
Pagination for admin inlines
class MyInline(admin.TabularInline):
model = MyModel
extra = 0
template = 'admin/edit_inline/list.html'
def get_formset(self, request, obj=None, **kwargs):
FormSet = super(ActivationKeyInline, self).get_formset(request, obj, **kwargs)
class NewFormSet(FormSet):
def _construct_forms(self, *args, **kwargs):
qs = self.get_queryset()
@justintv
justintv / .bashrc
Created August 17, 2009 00:53
Display git branch in bash prompt
# If you work with git, you've probably had that nagging sensation of not knowing what branch you are on. Worry no longer!
export PS1="\\w:\$(git branch 2>/dev/null | grep '^*' | colrm 1 2)\$ "
# This will change your prompt to display not only your working directory but also your current git branch, if you have one. Pretty nifty!
# ~/code/web:beta_directory$ git checkout master
# Switched to branch "master"
# ~/code/web:master$ git checkout beta_directory
# Switched to branch "beta_directory"