Skip to content

Instantly share code, notes, and snippets.

View purpleidea's full-sized avatar

James purpleidea

View GitHub Profile
@purpleidea
purpleidea / quick-devops-hacks
Created February 4, 2014 05:04
Code and slides from "Quick DevOps Hacks" lightning talk.
# slides
Available at:
https://dl.dropboxusercontent.com/u/48553683/quick-devops-hacks-devopsmtl-2014.pdf
# show the exit status in your $PS1
Article and code at:
https://ttboj.wordpress.com/2014/01/29/show-the-exit-status-in-your-ps1/
#!/bin/bash
if [ "$1" = '' ]; then
echo "Usage: ./`basename "$0"` <hostname>"
exit 1
fi
# NOTE: lets say you try to provision a previously provisioned host...
# $ vp foo
# [foo] Configuring cache buckets...
@purpleidea
purpleidea / gist:8202237
Created December 31, 2013 21:05
for your .bashrc
# run nethogs on the interface that is being used for the default route
function nethogs {
dev=`ip r | grep '^default' | awk '{print $5}'`
#echo $dev
if [ `id -u` -eq 0 ]; then
nethogs $@ $dev
else
sudo nethogs $@ $dev
fi
@purpleidea
purpleidea / .bashrc_vagrant.sh
Last active August 1, 2017 10:33
# Vagrant vsftp and other tricks# from: https://ttboj.wordpress.com/2013/12/21/vagrant-vsftp-and-other-tricks/# and# Vagrant clustered SSH and 'screen'# from: https://ttboj.wordpress.com/2014/01/02/vagrant-clustered-ssh-and-screen/# for use inside a ~/.bashrc or similar
# vagrant vsftp and other tricks
# from: https://ttboj.wordpress.com/2013/12/21/vagrant-vsftp-and-other-tricks/
# and
# Vagrant clustered SSH and 'screen'
# from: https://ttboj.wordpress.com/2014/01/02/vagrant-clustered-ssh-and-screen/
# for use inside a ~/.bashrc or similar
# copyright James Shubin, 2013, agplv.3+
### VAGRANT ###################################################################
# avoid needing to always add --provider=kvm