Skip to content

Instantly share code, notes, and snippets.

@brantfaircloth
brantfaircloth / py2app.bash
Created June 14, 2010 17:10
Steps to get a working py2app
## Roll your own python from source:
wget http://www.python.org/ftp/python/2.6.5/Python-2.6.5.tgz
tar -xzvf Python-2.6.5.tgz && cd Python-2.6.*
./configure --enable-framework=/Library/Frameworks --with-universal-archs=intel --enable-universalsdk=/
make
sudo make install
# Update the symlink for `python` (and check others)
/*
Copyright 2010 Kevin Whinnery
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@jamesmacaulay
jamesmacaulay / gist:860763
Created March 8, 2011 18:53
zsh hooks to growl completion of long-running commands
# long-running command growler
# hooks for zsh, built on bash version at http://hints.macworld.com/article.php?story=20071009124425468
preexec_functions+='save_preexec_time'
save_preexec_time() {
export PREEXEC_CMD="$(history $HISTCMD | sed 's/ *[0-9]* *//')"
export PREEXEC_TIME=$(date +'%s')
}
precmd_functions+='growl_about_long_running_commands'
var TinyORM = (function(options) {
/* a hash containing all the available models */
var Models = {};
var connection = null;
var config = _.extend({
/* The name of the database which Ti will open. The local db is located at:
~/Library/Application Support/iPhone Simulator/4.2/Applications/APP_ID/Library/Application Support/database/dbname
*/
dbname: 'add.db',
@mrtazz
mrtazz / irssi_osx_dock.markdown
Created July 4, 2012 22:08
Shortcut for OSX dock to run irssi in tmux with iTerm2

Shortcut for OSX dock to run irssi in tmux with iTerm2

Synopsis

I run irssi inside a tmux session on OSX. I often close the terminal as I usually get notified by growl about important stuff. I don't want to open a terminal and write a command every time I want to check IRC.

The solution

1. Create a shell script with the following content

#!/bin/zsh
/usr/local/bin/tmux attach -d -t irssi || /usr/local/bin/tmux new -s irssi irssi
@prabirshrestha
prabirshrestha / TextFieldChanges.m
Created August 2, 2012 13:53
Reactive Cocoa examples
@synthesize firstName = _firstName;
@synthesize txtFirstName = _txtFirstName;
[RACAbleSelf(self.firstName) subscribeNext:^(id x) { [self firstNameChanged:x]; }];
[self rac_bind:RAC_KEYPATH_SELF(self.firstName) to:self.txtFirstName.rac_textSubscribable];
- (void) firstNameChanged:(id)firstName {
NSLog(@"changed: %@", firstName);
}
@yjsoon
yjsoon / gist:3485271
Created August 27, 2012 03:22
vim search Dash for word under cursor, filetype-specific
" Searches Dash for the word under your cursor in vim, using the keyword
" operator, based on file type. E.g. for JavaScript files, I have it
" configured to search j:term, which immediately brings up the JS doc
" for that keyword. Might need some customisation for your own keywords!
function! SearchDash()
" Some setup
let s:browser = "/usr/bin/open"
let s:wordUnderCursor = expand("<cword>")
@tavisrudd
tavisrudd / kinesis.txt
Created March 2, 2013 18:10
A partial list of the Kinesis Advantage / Controllermate / Emacs keybinding tweaks I've done.
Remapped on kinesis itself
--------------------------------------------------------------------------------
caps lock -> backspace (freq use)
backspace -> right gui/windows (freq use)
left alt -> return/enter (very infreq use)
right ctrl -> return/enter (freq use)
right gui/windows -> left gui
enter -> right gui (infreq use)
@viglesiasce
viglesiasce / monitor-jenkins.py
Last active November 19, 2018 03:55
Monitor Jenkins Free Executors and post to CloudWatch
#!/usr/bin/python
import subprocess
from eucaops import Eucaops
from eucaops import EC2ops
from eutester.eutestcase import EutesterTestCase
from eutester.sshconnection import CommandExitCodeException
import ast
import urllib
class JenkinsCloudwatch(EutesterTestCase):
@artemrizhov
artemrizhov / south_multidb.py
Created October 30, 2013 15:49
This adds multiple databases support to South. Import the module in your migration. Set `database` attribute on your migration class to the alias of db that you want to use. Access the database api via self.db.
from south import db as db_module
from south.migration.migrators import Migrator, DryRunMigrator
def with_db(run_migration):
def run_migration_with_db(self, migration, database):
migration_db = getattr(migration._migration.Migration,
'database', None)
if migration_db is not None: