Skip to content

Instantly share code, notes, and snippets.

View leetrout's full-sized avatar
🎸

Lee Trout leetrout

🎸
View GitHub Profile
@leetrout
leetrout / runinenv.sh
Created January 29, 2012 18:16 — forked from parente/runinenv.sh
run a command in virtualenv, useful for supervisord
#!/bin/bash
VENV=$1
if [ -z $VENV ]; then
echo "usage: runinenv [virtualenv_path] CMDS"
exit 1
fi
. ${VENV}/bin/activate
shift 1
echo "Executing $@ in ${VENV}"
exec "$@"
@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 / 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 / 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 / gist:4515970
Last active December 11, 2015 00:19 — forked from kipanshi/gist:4007717
import cProfile
from django.template.defaultfilters import floatformat as floatformat_django
from django.contrib.humanize.templatetags.humanize import intcomma as intcomma_django
num = 100000
float_num = 1 / 3.0
def floatformat(value, places=2):
#!/usr/bin/env python
# -*- coding: utf-8 -*-
class AttrDict(dict):
def __init__(self, arg=(), **kwargs):
items = arg.items() if isinstance(arg, (dict, )) else arg
for key, value in items:
self[key] = self.fromdict(value)
for key, value in kwargs.items():
self[key] = self.fromdict(value)
'use strict';
angular.module('reusableThings')
.directive('fileDropzone', () ->
restrict: 'A'
scope: {
file: '='
fileName: '='
}
link: (scope, element, attrs) ->
@leetrout
leetrout / git-dmz-flow.md
Created February 13, 2016 15:57 — forked from djspiewak/git-dmz-flow.md
Git DMZ Flow

Git DMZ Flow

I've been asked a few times over the last few months to put together a full write-up of the Git workflow we use at RichRelevance (and at Precog before), since I have referenced it in passing quite a few times in tweets and in person. The workflow is appreciably different from GitFlow and its derivatives, and thus it brings with it a different set of tradeoffs and optimizations. To that end, it would probably be helpful to go over exactly what workflow benefits I find to be beneficial or even necessary.

  • Two developers working on independent features must never be blocked by each other
    • No code freeze! Ever! For any reason!
  • A developer must be able to base derivative work on another developer's work, without waiting for any third party
  • Two developers working on inter-dependent features (or even the same feature) must be able to do so without interference from (or interfering with) any other parties
  • Developers must be able to work on multiple features simultaneously, or at lea
@leetrout
leetrout / nginx-custom-build.sh
Created March 25, 2016 14:37
Build Ubuntu or Debian packages for nginx with custom patches, configs, and name suffixes in one command
#!/bin/bash
# Author: Alexander Rodin <rodin.alexander@gmail.com>
# License: MIT
BUILD_DIR=build
while getopts "hp:s:r:b:o:c:n" opt; do
case $opt in
h)
echo "Usage: $0 [options]"
@leetrout
leetrout / introrx.md
Created February 2, 2018 00:09 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing