Skip to content

Instantly share code, notes, and snippets.

View kevinastone's full-sized avatar

Kevin Stone kevinastone

View GitHub Profile
@kevinastone
kevinastone / workon.bash
Last active August 29, 2015 13:55
Bash function and completion script to allow quick switching between projects (especially if they share a relative virtualenv dir)
# Change this to your base projects path [$WORKON_BASE_DIR/{project1,project2,...}]
WORKON_BASE_DIR=/mnt/hgfs
# Change this to your relative virtual_env dir (if exists) [$WORKON_BASE_DIR/{project}/$VENV_DIR]
VENV_DIR=".env"
function workon() {
[ -z "$VIRTUAL_ENV" ] || deactivate
cd $WORKON_BASE_DIR/$1 &&
[ -d $VENV_DIR ] && source $VENV_DIR/bin/activate

Keybase proof

I hereby claim:

  • I am kevinastone on github.
  • I am kevinastone (https://keybase.io/kevinastone) on keybase.
  • I have the public key with fingerprint FC0C AEC9 3398 1A2D 56BF  9619 6344 9238 5969 5C55

To claim this, I am signing this object:

tap caskroom/cask
install brew-cask
install htop-osx
install hub
install node
install phantomjs
install tmux
install tree
install vagrant-completion
install watch
#!/usr/bin/env python
"""
Takes in an input string in python module format (X.Y.Z) and tries to find all
modules that start with that import path.
It takes two options.
The first is a ``recursive`` flag that allows to keep nesting looking for more modules.
@kevinastone
kevinastone / linterblame.py
Created February 8, 2015 17:51
Git Blame Results for Linter Violations
#!/usr/bin/env python
import argparse
from collections import defaultdict
import subprocess
def lint(linter, dirs):
files = defaultdict(lambda: defaultdict(list))
for dir in dirs:
env TEST="line1\nline2" python -c "import os; print repr(os.environ['TEST'])"
'line1\\nline2'
env TEST="line1
line2" python -c "import os; print repr(os.environ['TEST'])"
'line1\nline2'
#!/bin/bash
#
# Virtual Env Export
#
# Copies the dist-packages directory out of a built container.
#
# This allows you access the packages installed (say for IDE support).
if [ $# -lt 1 ]; then
#
# Author:: Adam Jacob (<adam@opscode.com>)
# Author:: Seth Chisamore (<schisamo@opscode.com>)
# Copyright:: Copyright (c) 2010-2011 Opscode, Inc.
# License:: Apache License, Version 2.0
#
# 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
#
class A(object):
y = x + 1
x = 1
a = A()
a.y
x = 1
class A(object):
y = x + 1
a = A()
a.y