Skip to content

Instantly share code, notes, and snippets.

View mikeyk's full-sized avatar

Mike Krieger mikeyk

  • San Francisco, CA
View GitHub Profile
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')
@mikeyk
mikeyk / (deprecated)UINotificationKeyboardHeight.m
Created September 8, 2011 23:31
Get keyboard height from an NSNotification
@implementation NSNotification (KeyboardHeight)
- (CGFloat)keyboardHeight {
CGRect bounds;
NSValue *boundsValue = [self.userInfo objectForKey:UIKeyboardBoundsUserInfoKey];
if (boundsValue) {
[boundsValue getValue:&bounds];
return bounds.size.height;
} else {
return 0;
==> Downloading http://download.osgeo.org/geos/geos-3.3.0.tar.bz2
File already downloaded in /Users/mkrieger/Library/Caches/Homebrew
/usr/bin/tar xf /Users/mkrieger/Library/Caches/Homebrew/geos-3.3.0.tar.bz2
==> ./configure --prefix=/usr/local/Cellar/geos/3.3.0 --disable-debug --disable-dependency-tracking
./configure --prefix=/usr/local/Cellar/geos/3.3.0 --disable-debug --disable-dependency-tracking
configure: WARNING: unrecognized options: --disable-debug
checking build system type... i386-apple-darwin11.0.0
checking host system type... i386-apple-darwin11.0.0
checking target system type... i386-apple-darwin11.0.0
set nocompatible
set autoindent
set si
set smartindent
set esckeys
" set highlight=8r,db,es,hs,mb,Mr,nu,rs,sr,tb,vr,ws
set magic
/home/ubuntu/src/redis/redis/client.py in _execute_command
return self.parse_response(command_name, **options) ...
▼ Local vars
Variable Value
self
u'<redis.client.Redis object at 0xabbb02c>'
// placed in my applicationDidFinishLaunchingWithOptions
if(getenv("NSZombieEnabled") || getenv("NSAutoreleaseFreedObjectCheckEnabled"))
NSLog(@"NSZombieEnabled/NSAutoreleaseFreedObjectCheckEnabled enabled!");
// first use the jQuerify plugin here: http://www.learningjquery.com/2009/04/better-stronger-safer-jquerify-bookmarklet
$jq("tbody tr", $("#fs-0")).each(function(index, el){
var nameTD = $jq("td.name", el);
var nameSpan = $jq("span", nameTD);
var name = nameSpan.attr("title") ? nameSpan.attr("title") : nameSpan.text();
var deviceID = $jq("td.id", el).attr("title");
console.log(name + '\t' + deviceID);
})
function Post(){};
Post.prototype = {test : function(){console.log("hello there")}};
p = new Post();
p.test();
/* but I prefer to do two things differently: define my member functions in the 'class' function, and have objects inherit from objects: */
function Post() {
this.test = function(){ console.log("hello there") }
}
/* for query: nearby?lat=37.756988&lon=-122.394458&boxheight=0.001449&boxwidth=0.001449&days=60&apiv=1 */
{"discarded": 0, "num_results": 51, "result_set": [{"category": "Vehicle Theft", "description": "Stolen automobile", "timestamp": 1250335800.0, "lon": -122.394072983, "incident": "090831906", "lat": 37.7576318072}, {"category": "Assault", "description": "Battery", "timestamp": 1249933500.0, "lon": -122.395208449, "incident": "090813346", "lat": 37.7565874457}, {"category": "Assault", "description": "Battery", "timestamp": 1248226200.0, "lon": -122.395383155, "incident": "090742983", "lat": 37.7568374893}, {"category": "Drug\/narcotic", "description": "Possession of base\/rock cocaine for sale", "timestamp": 1252990860.0, "lon": -122.395636483, "incident": "090949060", "lat": 37.7567322847}, {"category": "Assault", "description": "Battery", "timestamp": 1250029800.0, "lon": -122.395685391, "incident": "090817940", "lat": 37.7570410309}, {"category": "Robbery", "description": "Robbery, armed with a knife",