Skip to content

Instantly share code, notes, and snippets.

View mnem's full-sized avatar

Dave Clayton-Wagner mnem

View GitHub Profile
@mnem
mnem / pretty_git_bash.sh
Created September 20, 2010 22:51
Prettifies bash terminals with git
# Setup the prompt so that it shows the current branch when in a git directory.
source /usr/local/etc/bash_completion.d/git-completion.bash
source /usr/local/etc/bash_completion.d/git-prompt.sh
function setup_prompts_for_git
{
local BLUE="\[\e[0;34m\]"
local RED="\[\e[0;31m\]"
local YELLOW="\[\e[0;33m\]"
local PURPLE="\[\e[0;35m\]"
local CLR_RESET="\[\e[0m\]"
@botchagalupe
botchagalupe / gist:666110
Created November 7, 2010 12:54
General Chef Notes

Chef Demo One

Prep Work

knife cookbook site vendor -d ntp

Use chef-solo to launch ntp...

Chef Demo Two

Sass/Less Comparison

In this document I am using Sass's SCSS syntax. You can choose to use the indented syntax in sass, if you prefer it, it has no functional differences from the SCSS syntax.

For Less, I'm using the JavaScript version because this is what they suggest on the website. The ruby version may be different.

Variables

Setup a Three Server HAPROXY/APACHE2 Setup

Demo Part One (Launch an Apache Server)

Start the demo by launching three EC2 instances then tell the audience that this will take about 3 minutes. Also explain that we not only starting the instances we are also bootstrapping it with the Chef client (Easy Peasy)...

./setupDemo.sh 

Sample Script

/////// RopeNode.h
#import "cocos2d.h"
#import "ObjectiveChipmunk.h"
struct RopeNodeParticle;
@interface RopeNode : CCNode {
ChipmunkBody *_body1, *_body2;
cpVect _offset1, _offset2;
@mnem
mnem / gist:1285665
Created October 13, 2011 22:00
Python: Hacking in a new builtin
def mnemlog(message):
import datetime
mnemlog = open("/Users/mnem/mnemlog","a+",0)
mnemlog.write(str(datetime.datetime.now()) + " " + message + "\n")
mnemlog.close()
mod = __import__("__builtin__");
mod.mnemlog = mnemlog
mnemlog("It has been done")
@tankchintan
tankchintan / gist:1335220
Last active November 30, 2019 00:17
Procedure for installing and setting Sun JDK Java on Default Amazon Linux AMI
# First verify the version of Java being used is not SunJSK.
java -version
# Get the latest Sun Java SDK from Oracle http://www.oracle.com/technetwork/java/javase/downloads/jdk-7u1-download-513651.html
wget http://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.rpm
# Rename the file downloaded, just to be nice
mv jdk-7u1-linux-i586.rpm\?e\=1320265424\&h\=916f87354faed15fe652d9f76d64c844 jdk-7u1-linux-i586.rpm
# Install Java
@mnem
mnem / Recipe - Scottish Tablet.md
Created November 4, 2011 17:44
My Mum's family recipe for tablet. It's awesome. Imagine a neutron star made from sugar. It'd be a bit like this.

Scottish Tablet

  • 397g tin of sweetened condensed milk. Don't confuse this with evaporated milk.
  • 200ml milk
  • 1kg sugar
  • A piece of butter around the size of a walnut

Method

@mnem
mnem / git_fetch_pull_all_subfolders.sh
Created December 6, 2011 14:35
Simple bash script for fetching and pulling all repos in the executed folder to the latest of the branch they are on
#!/bin/bash
################
# Uncomment if you want the script to always use the scripts
# directory as the folder to look through
#REPOSITORIES="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
REPOSITORIES=`pwd`
IFS=$'\n'
@mnem
mnem / alias_pbcopy_pbpaste.sh
Created December 7, 2011 16:35
pbcopy and pbpaste for linux
# Emulate pbcopy and pbpaste for copying to and from the pasteboard/clipboard
#
# via: http://whereswalden.com/2009/10/23/pbcopy-and-pbpaste-for-linux/
alias pbcopy='xsel --clipboard --input'
alias pbpaste='xsel --clipboard --output'