Skip to content

Instantly share code, notes, and snippets.

@mrmachine
mrmachine / profile_middleware.py
Created June 5, 2018 03:06
profile_middleware
# profile_middleware - a middleware that profiles views
#
# Inspired by udfalkso's http://www.djangosnippets.org/snippets/186/
# and the Shwagroo Team's http://www.djangosnippets.org/snippets/605/
#
# Install this by adding it to your MIDDLEWARE_CLASSES. It is active
# if you are logged in as a superuser, or always when settings.DEBUG
# is True.
#
# To use it, pass 'profile=1' as a GET or POST parameter to any HTTP
@mrmachine
mrmachine / .bashrc
Last active March 8, 2016 22:54
Short git status for current directory and all repos in `$VIRTUAL_ENV` directory.
git_status() {
STATUS=$(git status -s 2> /dev/null)
LOCAL=$(git rev-parse "@" 2> /dev/null)
UPSTREAM=$(git rev-parse "@{u}" 2> /dev/null)
if [[ -n $STATUS ]] || ([[ -n $UPSTREAM ]] && [[ $LOCAL != $UPSTREAM ]]); then
git status -bs
fi
}
venv_git_status() {
[[ ! -d "$VIRTUAL_ENV" ]] && return
"""
The MIT License (MIT)
Copyright (c) 2016 Interaction Consortium
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is