Skip to content

Instantly share code, notes, and snippets.

View leetrout's full-sized avatar
🎸

Lee Trout leetrout

🎸
View GitHub Profile
@leetrout
leetrout / array.insert.js
Created February 12, 2012 01:04
JavaScript Array Insert and Bisect
Array.prototype.bisect = function (val) {
var idx;
if (this.length === 0) {
return 0;
}
for (idx=0; idx < this.length; idx++) {
if (val < this[idx]) {
return idx;
}
}
@leetrout
leetrout / gist:1810433
Created February 12, 2012 19:40 — forked from cmer/gist:1566734
UnixBench comparison of EC2, Joe's Data Center, and Rackspace CloudServers
apt-get install -y build-essential libx11-dev libgl1-mesa-dev libxext-dev perl perl-modules make
cd /tmp
wget http://byte-unixbench.googlecode.com/files/UnixBench5.1.3.tgz
tar xzvf UnixBench5.1.3.tgz
cd UnixBench
./Run
@leetrout
leetrout / aREADME.rst
Created February 28, 2012 02:45
Clone all your github repos into a local directory

USAGE

python ghclone.py

Follow the prompts

Notes

@leetrout
leetrout / example.md
Created March 8, 2012 18:46
Command line tool for Pivotal Tracker
(eex)vader:pt lee$ alias ptls="python ~/code/scripts/ptcli.py"
(eex)vader:pt lee$ ptls 
Your Current Work on PivotalTracker
[#31118493] (started) User is unable to reset password
[#38774275] (delivered) Bill Management page not showing Consumption.
[#31026073] (started) ?next is not preserved on log in
[#37554097] (unstarted) Total consumption cost error
[#38713035] (unscheduled) Ion - Tests - Helpers
@leetrout
leetrout / ssh-copy-id
Created March 24, 2012 06:45 — forked from reu/ssh-copy-id
ssh-copy-id
#!/bin/sh
# Shell script to install your public key on a remote machine
# Takes the remote machine name as an argument.
# Obviously, the remote machine must accept password authentication,
# or one of the other keys in your ssh-agent, for this to work.
ID_FILE="${HOME}/.ssh/id_rsa.pub"
if [ "-i" = "$1" ]; then
@leetrout
leetrout / color_utils.py
Created April 14, 2012 06:09
Color utils for working with hex values. Purpose built to create a monochromatic triad from a single value.
import colorsys
def hex_to_rgb(hex_str):
"""Returns a tuple representing the given hex string as RGB.
>>> hex_to_rgb('CC0000')
(204, 0, 0)
"""
if hex_str.startswith('#'):
hex_str = hex_str[1:]
@leetrout
leetrout / rscloud.py
Created April 23, 2012 19:32
Rackspace CloudServers tools for Fabric
"""Rackspace CloudServers tools for Fabric"""
import os
from cloudservers import CloudServers
from fabric.api import task, prompt
from fabric.contrib.console import confirm
RS_USER = os.environ.get('CLOUD_SERVERS_USERNAME')
RS_API_KEY = os.environ.get('CLOUD_SERVERS_API_KEY')
@leetrout
leetrout / monokai.ksf
Created April 24, 2012 04:00
My Monokai Theme for Komodo Edit
Version = 4
Booleans = {'caretLineVisible': True, 'preferFixed': True, 'useSelFore': True}
CommonStyles = {'attribute name': {'fore': 7872391},
'attribute value': {'fore': 3100463},
'bracebad': {'back': 65535, 'bold': 1, 'fore': 16777215},
'bracehighlight': {'bold': 1, 'fore': 16777215},
'classes': {'bold': True, 'fore': 3272098},
'comments': {'fore': 7301991, 'italic': 1},
@leetrout
leetrout / spine_modelresource.py
Created May 24, 2012 02:37 — forked from stringfellow/spine_modelresource.py
Spinejs - django-tastypie integration base ModelResource class
#!/usr/bin/env python
# -*- coding: iso-8859-15 -*-
from tastypie.resources import ModelResource
class SpineFrontedResource(ModelResource):
"""A base model resource for spine-fronted models.
* Bins the 'id' that spine sends.
* Removes 'meta' from the list, returns only objects.
@leetrout
leetrout / auto_example.md
Created August 7, 2012 19:33
OpenSSL encryption helper scripts

Sometimes I use this automagically from a script... Just toss in the -kfile flag.

Decrypt:

#!/bin/bash
openssl enc -aes-256-cbc -d -kfile /path/to/passwd_in_file.txt -in $1 -out `echo $1 | sed s/.enc//`

Encrypt:

#!/bin/bash