Skip to content

Instantly share code, notes, and snippets.

View mmm's full-sized avatar

Mark Mims mmm

View GitHub Profile
@mmm
mmm / install
Created September 7, 2011 13:44
sun java on ubuntu
#!/bin/bash
RELEASE_CODE=`lsb_release -a | awk '/Codename/ { print $2 }'`
add-apt-repository "deb http://archive.canonical.com/ ${RELEASE_CODE} partner"
apt-get update
apt-get -y install -qq --no-install-recommends debconf-utils
echo "sun-java6-plugin shared/accepted-sun-dlj-v1-1 boolean true" | debconf-set-selections
DEBIAN_FRONTEND=noninteractive apt-get -y install -qq sun-java6-jdk
@mmm
mmm / gist:1375100
Created November 18, 2011 00:31
step-by-step hadoop with juju
# install juju
$ sudo apt-get install juju charm-tools
configure your EC2 account...
$ juju
$ vi .juju/environments.yaml
add EC2 access/secret keys
@mmm
mmm / gist:1402781
Created November 29, 2011 00:31
erb templates for juju
# Generated by juju
<% active_backends.each do |server_name, server_info| %>
backend <%= server_name %> {
.host = "<%= server_info[:address] %>";
.port = "<%= server_info[:port] %>";
}
<% end %>
director baz round-robin {
@mmm
mmm / gist:1402941
Created November 29, 2011 01:33
templating with bash/cheetah
# cheetah from the command line...
Template file:
hawk:~ $ cat junk.file
This is a file
With a $stupid_variable to expand
and maybe a common one like $HOME
@mmm
mmm / gist:1406018
Last active September 28, 2015 07:28
decent-sized juju stack
#!/bin/bash
echo "deploying stack"
deploy_ha_mysql() {
juju deploy mysql masterdb
juju deploy mysql slavedb -n2
juju add-relation masterdb:master slavedb:slave
}
@mmm
mmm / gist:1903456
Created February 24, 2012 20:16
poor man's state machine
#
# move the following into lib/state_machine.rb or something?
# Also, the state transitions are not really atomic...
# works fine for now, but should fix eventually
#
%w(
new
validating
valid
invalid
@mmm
mmm / gist:2050525
Created March 16, 2012 15:25
juju rails stack
#!/bin/bash
juju_root=$HOME
juju_env=${1:-"-ecanonical"}
###
echo "deploying stack"
juju bootstrap $juju_env
@mmm
mmm / tmux.conf
Last active July 19, 2019 20:16
tmux config
# Our .tmux.conf file
# Setting the prefix from C-b to C-a
# START:prefix
set -g prefix C-a
set -g prefix2 C-b
# END:prefix
# Free the original Ctrl-b prefix keybinding
# START:unbind
unbind C-b
@mmm
mmm / gist:5878432
Created June 27, 2013 17:23
some simple juju commands to deploy hadoop and ganglia
#!/bin/bash
# hadoop
juju deploy hadoop hadoop-master
juju deploy hadoop hadoop-slave -n12
juju add-relation hadoop-master:namenode hadoop-slave:datanode
juju add-relation hadoop-master:jobtracker hadoop-slave:tasktracker
# instrument hadoop-slave
juju deploy ganglia-node
@mmm
mmm / filters.xml.erb
Last active February 10, 2022 11:29
Quick and dirty Gmail filters. Work ported from procmail a couple of months ago... Write out an xml file `erb filters.xml.erb > filters.xml` and import this into gmail Settings->Filters tab ("import filters" down at the bottom of the page).
<?xml version='1.0' encoding='UTF-8'?>
<feed xmlns='http://www.w3.org/2005/Atom' xmlns:apps='http://schemas.google.com/apps/2006'>
<title>Mail Filters</title>
<% MAILING_LISTS = [
{
:name => "canonical-com",
:pattern => :list,
:base_name => "lists.canonical.com",
:lists => [