Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.
Ctrl+X | delete line |
Ctrl+↩ | insert line after |
Ctrl+⇧+↩ | insert line before |
Ctrl+⇧+↑ | move line (or selection) up |
$make | |
nosetests --with-coverage --cover-package=djangotest.registration djangotest/registration/ | |
E.FEEEEEFFF | |
====================================================================== | |
ERROR: djangotest.registration.test.TestRegistration.test_broken_profile | |
---------------------------------------------------------------------- | |
Traceback (most recent call last): | |
File "/usr/lib/python2.5/site-packages/nose-0.10.3-py2.5.egg/nose/case.py", line 182, in runTest | |
self.test(*self.arg) | |
File "/work/workspace/test_ass/djangotest/djangotest/registration/test.py", line 47, in test_broken_profile |
''' | |
# $Id: db_mock.py 149 2007-08-30 08:12:24Z akhavr $ | |
# Copyright (C) 2007 KDS Software Group http://www.kds.com.ua/ | |
''' | |
import copy | |
import django.conf | |
from django.core.management import call_command | |
from django.db import backend, connection |
./manage.py:4:20: E261 at least two spaces before inline comment | |
import settings # Assumed to be in the same directory. | |
^ | |
./manage.py:7:80: E501 line too long (299 characters) | |
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__) | |
^ | |
./settings.py:4:10: E401 multiple imports on one line | |
import os, sys | |
^ | |
./settings.py:10:48: E231 missing whitespace after ',' |
manage.py:4:20: E261 at least two spaces before inline comment | |
Separate inline comments by at least two spaces. | |
An inline comment is a comment on the same line as a statement. Inline | |
comments should be separated by at least two spaces from the statement. | |
They should start with a # and a single space. | |
Okay: x = x + 1 # Increment x | |
Okay: x = x + 1 # Increment x | |
E261: x = x + 1 # Increment x |
""" | |
This fabric file makes setting up and deploying a django application much | |
easier, but it does make a few assumptions. Namely that you're using Git, | |
Apache and mod_wsgi and your using Debian or Ubuntu. Also you should have | |
Django installed on your local machine and SSH installed on both the local | |
machine and any servers you want to deploy to. | |
_note that I've used the name project_name throughout this example. Replace | |
this with whatever your project is called._ |
execve("/var/www/idhooks-root/env2/bin/pip", ["pip", "install", "-E", ".", "-r", "./releases/20100803183012/requir"...], [/* 24 vars */]) = 0 | |
brk(0) = 0x85c6000 | |
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f84000 | |
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) | |
open("/etc/ld.so.cache", O_RDONLY) = 3 | |
fstat64(3, {st_mode=S_IFREG|0644, st_size=26370, ...}) = 0 | |
mmap2(NULL, 26370, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7f7d000 | |
close(3) = 0 | |
open("/usr/lib/libpython2.5.so.1.0", O_RDONLY) = 3 | |
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\260\306\1\0004\0\0\0"..., 512) = 512 |
#!/bin/bash | |
myfilename=$(date "+%Y-%m-%d_%H:%M") | |
pg_dump -U dbuser -w dbname | gzip > /var/www/dbbackups/dbname-$myfilename.dump.gz | |
/var/www/s3/s3-put -S -k <your-key> -s /var/www/dbbackups/secret.key -T /var/www/dbbackups/dbname-$myfilename.dump.gz /dbname-dbbackups/dbname/$myfilename-dbname.dump.gz | |
##you will need to get http://s3-bash.googlecode.com/files/s3-bash.0.02.tar.gz | |
##to ensure that secret file is 40 bytes, use | |
##echo -n your-secret-ket > secret.key |
try: | |
import local_settings | |
for param in dir(local_settings): | |
if not '__' in param: | |
setattr(sys.modules[__name__], param,\ | |
getattr(local_settings, param)) | |
except ImportError: | |
pass |
Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.
Ctrl+X | delete line |
Ctrl+↩ | insert line after |
Ctrl+⇧+↩ | insert line before |
Ctrl+⇧+↑ | move line (or selection) up |
""" | |
Script for automated analysis of profiling data in MongoDB, | |
gathered by Mongo with db.setProfilingLevel(1). | |
See <http://www.mongodb.org/display/DOCS/Database+Profiler> | |
TODO: pass collection and database with profiling data in arguments | |
TODO: make thread-safe | |
""" | |
from collections import defaultdict |