Tested in Mac OS X: super == command
Open/Goto
- super+t: go to file
- super+ctrl+p: go to project
- super+r: go to methods
import datetime | |
# requires python-dateutil (http://labix.org/python-dateutil) | |
from dateutil.relativedelta import relativedelta | |
def get_month_day_range(date): | |
""" | |
For a date 'date' returns the start and end date for the month of 'date'. | |
Month with 31 days: |
#my messy part: add and tweak until it works. Usually followed by remove until it breaks to find the minimal necessary, but not this time. | |
python waf clean | |
export PATH=/usr/local/Cellar/python2.6.7/2.6.7/bin:$PATH | |
export PYTHONPATH=/usr/local/Cellar/python2.6.7/2.6.7 | |
export LD_LIBRARY_PATH=/usr/local/Cellar/python2.6.7/2.6.7:$LD_LIBRARY_PATH | |
export LD_LIBRARY_PATH=/usr/local/Cellar/python2.6.7/2.6.7/lib:$LD_LIBRARY_PATH | |
export LINKFLAGS='-search_dylibs_first -L /usr/local/Cellar/python2.6.7/2.6.7/lib/' | |
#from stackoverflow http://stackoverflow.com/questions/6886578/how-to-install-pycairo-1-10-on-mac-osx-with-default-python | |
export ARCHFLAGS='-arch x86_64' | |
export CC=/usr/bin/gcc |
var cluster = require('cluster'), | |
app = require('./app'); | |
var workers = {}, | |
count = require('os').cpus().length; | |
function spawn(){ | |
var worker = cluster.fork(); | |
workers[worker.pid] = worker; | |
return worker; |
#!/usr/bin/python | |
import re, urllib, urllib2 | |
class Spreadsheet(object): | |
def __init__(self, key): | |
super(Spreadsheet, self).__init__() | |
self.key = key | |
class Client(object): |
This article is now published on my website: Prefer Subshells for Context.
def run_pg_fouine(): | |
info = host_info[env.host_string] | |
db_name = info.tags.get('Name') | |
sudo('perl -pi -e "s/log_min_duration_statement = .*/log_min_duration_statement = 0/" /etc/postgresql/9.*/main/postgresql.conf') | |
sudo('/etc/init.d/postgresql reload') | |
time.sleep(30) | |
sudo('perl -pi -e "s/log_min_duration_statement = .*/log_min_duration_statement = 500/" /etc/postgresql/9.*/main/postgresql.conf') | |
sudo('/etc/init.d/postgresql reload') | |
run('tail -n 100000 /var/log/postgresql/postgresql-9.*-main.log > /tmp/pgfouine.txt') | |
run('gzip -f /tmp/pgfouine.txt') |
Locate the section for your github remote in the .git/config
file. It looks like this:
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = git@github.com:joyent/node.git
Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:
-- Entity Attribute Value Model in Postgres | |
CREATE TABLE public.entity ( | |
id serial NOT NULL, | |
type varchar(25) NOT NULL, | |
PRIMARY KEY (id) | |
); | |
CREATE TABLE public.defined_attributes ( | |
key varchar(25) NOT NULL, |