A "Best of the Best Practices" (BOBP) guide to developing in Python.
- "Build tools for others that you want to be built for you." - Kenneth Reitz
- "Simplicity is alway better than functionality." - Pieter Hintjens
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import json | |
from oauthlib.oauth2 import ( | |
FatalClientError, OAuth2Error, TokenExpiredError, MobileApplicationClient | |
) | |
from requests_oauthlib import OAuth2Session, TokenUpdated |
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import json | |
import web | |
urls = ( | |
'/', 'Index', | |
) |
import urlparse | |
def urldecode(query_str): | |
""" | |
>>> urldecode('a=1&b=2') | |
{'a': '1', 'b': '2'} | |
""" | |
return dict(urlparse.parse_qsl(query_str)) |
package main | |
import ( | |
"bytes" | |
"fmt" | |
"io" | |
"io/ioutil" | |
"mime/multipart" | |
"net/http" | |
"os" |
package main | |
import ( | |
"bytes" | |
"fmt" | |
"io" | |
"io/ioutil" | |
"mime/multipart" | |
"net/http" | |
"os" |
sudo apt-get remove --purge vim vim-runtime vim-gnome vim-tiny vim-common vim-gui-common | |
sudo apt-get build-dep vim-gnome | |
sudo apt-get install liblua5.1-dev luajit libluajit-5.1 python-dev ruby-dev libperl-dev libncurses5-dev libgnome2-dev libgnomeui-dev libgtk2.0-dev libatk1.0-dev libbonoboui2-dev libcairo2-dev libx11-dev libxpm-dev libxt-dev | |
sudo rm -rf /usr/local/share/vim | |
sudo rm /usr/bin/vim | |
[Unit] | |
Description=supervisord - Supervisor process control system for UNIX | |
Documentation=http://supervisord.org | |
After=network.target | |
[Service] | |
Type=forking | |
ExecStart=/bin/supervisord -c /etc/supervisord/supervisord.conf | |
ExecReload=/bin/supervisorctl reload | |
ExecStop=/bin/supervisorctl shutdown |
server { | |
listen 80; | |
server_name subdomain.example.com; | |
access_log /var/log/nginx/example.access.log; | |
location / { | |
if ($http_origin ~* "https?://.*\.example\.com(:[0-9]+)?") { | |
set $cors "true"; |
!/bin/sh | |
# Generate test coverage statistics for Go packages. | |
# | |
# Works around the fact that `go test -coverprofile` currently does not work | |
# with multiple packages, see https://code.google.com/p/go/issues/detail?id=6909 | |
# | |
# Usage: go_coverage [ [--html | html] | --coveralls | --help ] | |
# | |
# --html Additionally create HTML report and open it in browser | |
# --coveralls Push coverage statistics to coveralls.io |