Skip to content

Instantly share code, notes, and snippets.

View evansde77's full-sized avatar

Dave Evans evansde77

View GitHub Profile
#!/usr/bin/env python
"""
_gists_
functions for getting gists
Requires a section in your gitconfig like:
[cirrus]
@evansde77
evansde77 / gist:0a833b79b2cf104b63a0
Created May 6, 2014 14:51
How to create a wilson virtualenv with Carburetor installed in it
# carburetor build from source
git clone git@github.com:cloudant/carburetor.git
cd carburetor/
#### Check out a specific tag here if you dont want HEAD
virtualenv --distribute venv
. venv/bin/activate
pip install -r requirements.txt
# -OR- since Macs are being difficult with XCode lately...
import unittest
import mock
from wilson.views.bluemix import BluemixSingleUser
class TestBluemixUser(unittest.TestCase):
def test_get_user(self):
@evansde77
evansde77 / bash_profile
Created June 18, 2014 20:36
How to show your git branch in your shell prompt
function parse_git_branch ()
{
ref=$(git symbolic-ref HEAD 2> /dev/null) || return;
BRANCH="("${ref#refs/heads/}")";
echo "${BRANCH}"
}
export PS1="[\t \W] \$(parse_git_branch) "
@evansde77
evansde77 / installer.sh
Last active August 29, 2015 14:05
Cirrus installer script with a public URL
#!/bin/bash
#
# installer for cirrus
# Sets up working dir eg $HOME/.cirrus
# Clones latest stable tag of cirrus into it
# runs setup commands to build venv for cirrus
# installs git alias commands
# gets token for github access & updates .gitconfig
@evansde77
evansde77 / git_shell_funcs.sh
Created February 25, 2015 16:25
Useful Bash prompt/tab settings for showing git info
#
# Added to .bash_profile on a mac, these utils will show the
# current repo in the terminal tab name and will include the current git
# branch name on the shell prompt.
#
function set_terminal_tabname {
# function that sets Terminal Tab name to $1
printf "\e]1;$1\a"
function carb_logs(){
CLUSTER=$1
knife ssh -x evansde77 role:load_balancer_${CLUSTER} "tail -f /opt/sapi/logs/carburetor_package.log" -a ip.public
}
class MyTest(unittest.TestCase):
harness, setUp, tearDown = make_database_test_harness(**args)
def test_a_thing(self):
print self.harness
@evansde77
evansde77 / Vagrantfile
Last active January 29, 2016 23:15
Details for reproducing error in docker cookbook dependency under Vagrant/Chef-solo
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = '2'
Vagrant.require_version '>= 1.5.0'
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# All Vagrant configuration is done here. The most common configuration
==> derp: Loading Berkshelf datafile...
==> derp: Sharing cookbooks with VM
==> derp: Updating Vagrant's Berkshelf...
==> derp: Resolving cookbook dependencies...
==> derp: Fetching 'derp' from source at .
==> derp: Fetching 'docker' from source at docker
==> derp: Using apt (2.9.2)
==> derp: Using build-essential (2.2.4)
==> derp: Using chef-sugar (3.3.0)
==> derp: Using compat_resource (12.5.26)