#Disable window animations
defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool false
#Enable repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false| def authenticated(auth): | |
| def decore(f): | |
| def _request_auth(handler): | |
| handler.set_header('WWW-Authenticate', 'Basic realm=tmr') | |
| handler.set_status(401) | |
| handler.finish() | |
| return False | |
| #!/bin/sh | |
| # check for where the latest version of IDEA is installed | |
| IDEA=`ls -1d /Applications/IntelliJ\ * | tail -n1` | |
| wd=`pwd` | |
| # were we given a directory? | |
| if [ -d "$1" ]; then | |
| # echo "checking for things in the working dir given" | |
| wd=`ls -1d "$1" | head -n1` |
| {# | |
| Source: http://dev.dbl-a.com/symfony-2-0/symfony2-and-twig-pagination/ | |
| Updated by: Simon Schick <[email protected]> | |
| Parameters: | |
| * currentFilters (array) : associative array that contains the current route-arguments | |
| * currentPage (int) : the current page you are in | |
| * paginationPath (string) : the route name to use for links | |
| * showAlwaysFirstAndLast (bool) : Always show first and last link (just disabled) | |
| * lastPage (int) : represents the total number of existing pages |
| #!/usr/bin/env/python | |
| # | |
| # More of a reference of using jinaj2 without actual template files. | |
| # This is great for a simple output transformation to standard out. | |
| # | |
| # Of course you will need to "sudo pip install jinja2" first! | |
| # | |
| # I like to refer to the following to remember how to use jinja2 :) | |
| # http://jinja.pocoo.org/docs/templates/ | |
| # |
By default when Nginx starts receiving a response from a FastCGI backend (such as PHP-FPM) it will buffer the response in memory before delivering it to the client. Any response larger than the set buffer size is saved to a temporary file on disk. This process is also explained at the Nginx ngx_http_fastcgi_module page document page.
Since disk is slow and memory is fast the aim is to get as many FastCGI responses passing through memory only. On the flip side we don't want to set an excessively large buffer as they are created and sized on a per request basis (i.e. it's not shared memory).
The related Nginx options are:
fastcgi_bufferingappeared in Nginx 1.5.6 (1.6.0 stable) and can be used to turn buffering completely on/off. It's on by default.- [
fastcgi_buffer_size](http://nginx.org/en/
| from django.db import connection | |
| from django.utils.log import getLogger | |
| logger = getLogger(__name__) | |
| class QueryCountDebugMiddleware(object): | |
| """ | |
| This middleware will log the number of queries run | |
| and the total time taken for each request (with a | |
| status code of 200). It does not currently support |
| <?php | |
| /** | |
| * ----------------------------------------------------------------------------------------- | |
| * Based on `https://github.com/mecha-cms/mecha-cms/blob/master/system/kernel/converter.php` | |
| * ----------------------------------------------------------------------------------------- | |
| */ | |
| // HTML Minifier | |
| function minify_html($input) { |
What I did to get Python 3.4.2 on Ubuntu 14.04. The stock version of Python 3 on Ubuntu is 3.4.0. Which is missing some of the best parts! (asyncio, etc). Luckily I discovered pyenv which solved my problem.
Pyenv (not to be confused with pyvenv) is the Python equivelant of rbenv. It lets you configure which Python environment/version is available per directory, user, or other session variables.
I followed the instructions here to install pyenv in my home directory. Verbatem, those instructions are:
sudo apt-get install git python-pip make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev
| [uwsgi] | |
| disable-logging = True | |
| socket = /srv/qrs/test/wsgi.sock | |
| chdir = /srv/qrs/test | |
| chmod = 660 | |
| master = true | |
| processes = 2 | |
| module = qrs.wsgi:application | |
| virtualenv = /env/qrs/test | |
| enable-threads = true |