Skip to content

Instantly share code, notes, and snippets.

View mikeyk's full-sized avatar

Mike Krieger mikeyk

  • San Francisco, CA
View GitHub Profile
// 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);
})
// placed in my applicationDidFinishLaunchingWithOptions
if(getenv("NSZombieEnabled") || getenv("NSAutoreleaseFreedObjectCheckEnabled"))
NSLog(@"NSZombieEnabled/NSAutoreleaseFreedObjectCheckEnabled enabled!");
/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>'
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
==> 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
@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;
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 / watch_wal-e.py
Created July 26, 2012 00:43
Watch WAL-E
#! /usr/bin/env python
from boto.ses.connection import SESConnection
import sys
import subprocess
import socket
if __name__ == '__main__':
return_code = 'unknown'
host = socket.getfqdn()
try:
""" Run with:
gunicorn -k gevent -b 0.0.0.0:8080 test_mc:app
or
gunicorn -k sync -b 0.0.0.0:8080 test_mc:app
"""
import memcache as memcache
# toggle to try pylibmc instead
# import pylibmc as memcache
client = memcache.Client(["127.0.0.1:11222", "127.0.0.1:11223"])