Skip to content

Instantly share code, notes, and snippets.

View 1stvamp's full-sized avatar
:shipit:

Wes Mason 1stvamp

:shipit:
View GitHub Profile
@1stvamp
1stvamp / git_branch_and_version_in_prompt.sh
Created October 13, 2011 15:26 — forked from bassdread/Version Display
Display git branch and version in your prompt
# Show current git branch or SVN subfolder in prompt.
GREEN="\[\033[0;32m\]"
LIGHT_GREEN="\[\033[1;32m\]"
GRAY="\[\033[1;30m\]"
LIGHT_BLUE="\[\033[1;34m\]"
LIGHT_GRAY="\[\033[0;37m\]"
COLOR_OFF="\[\e[0m\]"
LAST_GIT_DIR="!"
function prompt_func() {
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
@1stvamp
1stvamp / gist:1293006
Created October 17, 2011 16:26
Install latest uwsgi, nginx and mongodb on Ubuntu
apt-get install python-software-properties
add-apt-repository ppa:nginx/stable
add-apt-repository ppa:uwsgi/uwsgi
echo "# MongoDB" >> /etc/apt/sources.list
echo "deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen" >> /etc/apt/sources.list
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
apt-get update
apt-get install nginx uwsgi-common uwsgi-extra uwsgi-plugins-all mongodb-10gen
@1stvamp
1stvamp / mongodb-src.rb
Created December 8, 2011 19:58
Homebrew formula to install mongodb from source rather than prebuilt package
require 'formula'
class MongodbSrc < Formula
url 'http://downloads.mongodb.org/src/mongodb-src-r2.0.1.tar.gz'
homepage 'http://www.mongodb.org/'
md5 'cb8579074b7c9752eb382a2094ac4523'
depends_on 'boost'
depends_on 'pcre++'
depends_on 'scons'
@1stvamp
1stvamp / SmtpPlugin.py
Created April 27, 2012 16:20
Extremely basic serverdensity plugin for monitoring an SMTP mail server
import smtplib
class SmtpPlugin(object):
def __init__(self, config, logger, raw_config):
self.config = config
self.logger = logger
self.raw_config = raw_config
def run(self):
@1stvamp
1stvamp / curl_wrapper.sh
Created May 1, 2012 07:18
Wrap curl to output a newline after output
#!/bin/bash
# Add this to your .bashrc
# alias curl="/path/to/curl_wrapper.sh"
curl $*
echo
@1stvamp
1stvamp / francois.py
Created May 8, 2012 21:28
Super simple tweet fetcher using python.
import json
import urllib2
username = 'ignorethecrane'
url = 'https://twitter.com/statuses/user_timeline/%s.json' % (username,)
u = urllib2.urlopen(url)
tweets = json.loads(u.read())
@1stvamp
1stvamp / celeryconfig.py
Created July 7, 2012 01:17
Monkey patch pymongo to have a binary module again for compatibility with systems like Celery 2.5.x
try:
from pymongo import binary
except ImportError:
import sys
from bson import binary
sys.modules['pymongo.binary'] = binary
@1stvamp
1stvamp / bootstrap.php
Created July 16, 2012 10:04
Bootstrap a PHP Composer instance to "./bin/composer"
#!/usr/bin/env php
<?php
$bin = getcwd() . '/bin/';
// Create dynamic paths for environment
if (!file_exists($bin))
{
mkdir($bin);
echo "Created ./bin" . PHP_EOL;
}
@1stvamp
1stvamp / init.sh
Created September 3, 2012 09:27
Kludgy shell script to init hubot in a vagrant vm
#!/bin/bash
# Install steps
sudo sed -i -e 's#us.archive.ubuntu.com#gb.archive.ubuntu.com#g' /etc/apt/sources.list
sudo apt-get update
sudo apt-get -y install redis-server python-software-properties build-essential g++ libssl-dev pkg-config
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get -y install nodejs nodejs-dev npm
if [ ! -d /var/log/hubot ]; then
@1stvamp
1stvamp / device_metrics.sh
Created September 3, 2012 12:54
Get networking metrics for a list of devices on Server Density using the densli CLI app
#!/bin/bash
for id in "4e4e1638c85e808431000003 4e4e1638c85e808431000004 4e4e1638c85e808431000005"
do
densli metrics.getRange metric=networkTraffic deviceId=$id -t 30m -s
done