Skip to content

Instantly share code, notes, and snippets.

@fairchild
fairchild / bundle-to-ebs.sh
Created December 5, 2009 23:32
2 scripts that can be used to create an bootable EBS from a running instance. ami-4205e72b created with this process
#!/bin/bash -xe
EBS_DEVICE='/dev/sdh'
INSTANCE_ID=$1
AKI=${2:-'aki-5f15f636'}
ARI=${3:-'ari-0915f660'}
ARCH=${4:-'i386'}
SIZE=${5:-10}
AZ=${6:-'us-east-1d'}
NAME=${7:-"ami-from-$INSTANCE_ID"}
@paulirish
paulirish / gist:366184
Created April 14, 2010 18:59
html5 geolocation with fallback.
// geo-location shim
// currentely only serves lat/long
// depends on jQuery
// doublecheck the ClientLocation results because it may returning null results
;(function(geolocation){
if (geolocation) return;
@silvein
silvein / pre-commit
Created March 26, 2011 07:52
This is a Git pre-commit hook I'm developing to make sure local submodule changes are pushed before committing. This would probably be better as a pre-push hook, but there does not appear to be a facility for that.
#!/bin/bash
function git_submodule_unchanged () {
SUB_MODULE=$1
GSC_RC=0
pushd $SUB_MODULE > /dev/null
SUB_BRANCH=$(git branch | grep '*' | cut -d' ' -f 2)
if [[ "$(git log --pretty=oneline origin/${SUB_BRANCH}..${SUB_BRANCH})" != "" ]]; then
GSC_RC=1
fi
@rdegges
rdegges / proxy_nginx.sh
Created April 11, 2011 05:30
Create a HTTP proxy for jenkins using NGINX.
sudo aptitude -y install nginx
cd /etc/nginx/sites-available
sudo rm default
sudo cat > jenkins
upstream app_server {
server 127.0.0.1:8080 fail_timeout=0;
}
server {
listen 80;
@jedi4ever
jedi4ever / Docu
Created May 19, 2011 11:48
temp getting started with mccloud - for @roidrage
# Only the git works for now (more or less)
$ git clone https://github.com/jedi4ever/mccloud
# the mccloud dir contains an .rvmrc which will creare a new gemset
$ cd mccloud
# Install all dependencies
$ bundle install
@canweriotnow
canweriotnow / unicorn
Created July 5, 2011 17:38
/etc/init.d script for unicorn
#!/bin/sh
#
# init.d script for single or multiple unicorn installations. Expects at least one .conf
# file in /etc/unicorn
#
# Modified by jay@gooby.org http://github.com/jaygooby
# based on http://gist.github.com/308216 by http://github.com/mguterl
#
## A sample /etc/unicorn/my_app.conf
##
$hosts_table = {
:dbm => "192.168.86.101",
:app1 => "192.168.86.102",
:app2 => "192.168.86.103",
:lb => "192.168.86.104",
}
def bootstrap(config, host)
config.vm.box = "lucid64"
config.vm.network $hosts_table[host]
@nkpart
nkpart / A. How to run it.md
Created December 13, 2011 00:45
Ghetto running of commands in separate shells from Vim

In one terminal, run out_pipe.

From vim:

:call PipeCommand("echo " . expand("%"))

See the current file name being printed out by out_pipe.

Win.

@beddari
beddari / install_vagrant_sudoers.sh
Created December 13, 2011 12:47
Allow Vagrant sudo-access without password for NFS-setup
#!/bin/bash
# Script for placing sudoers.d files with syntax-checking
if [ -z "$1" ]; then
# Making a temporary file to contain the sudoers-changes to be pre-checked
TMP=$(mktemp)
cat > $TMP <<EOF
Cmnd_Alias VAGRANT_EXPORTS_ADD = /bin/su root -c echo '*' >> /etc/exports
Cmnd_Alias VAGRANT_NFSD = /etc/init.d/nfs-kernel-server restart
Cmnd_Alias VAGRANT_EXPORTS_REMOVE = /bin/sed -e /*/ d -ibak /etc/exports
@donavanm
donavanm / elasticat.json
Created March 22, 2012 05:44
CloudFormation EC2 & Route53 template
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "Create an EC2 instance, set up Apache, and create Route53 A records",
"Parameters" : {
"KeyName" : {
"Description" : "Name of an existing EC2 KeyPair to enable SSH access to the instances",
"Type" : "String",