Skip to content

Instantly share code, notes, and snippets.

@billhathaway
billhathaway / gist:c745afd7fa334e76923a
Created July 29, 2014 23:23
joining strings in confd templates
With confd sometimes you will want to join a bunch of keys together into a line with comma separated values. Here is a template snippet to do that:
servers={{range $index,$server := .myapp_servers}}{{if $index}},"{{$server.Value}}"{{else}}"{{$server.Value}}"{{end}}{{end}}
Credit for the technique goes to Jan Newmarch's tutorial page at http://jan.newmarch.name/go/template/chapter-template.html
# install sysbench with
# sudo yum --enablerepo=epel install -y sysbench
targetDir=/data/benchmark # pick a directory inside your target file system
fileSize=300G # pick large enough size that you aren't using FS cache effectively
threads=128
test=rndrw # can also use rndrd
blockSize=4096
@billhathaway
billhathaway / gist:11222817
Created April 23, 2014 16:40
shell function to SSH to an EC2 hostname
ec2ssh() {
# ec2-54-187-110-140.us-west-2.compute.amazonaws.com -> 54-187-110-140
hostname=`echo $1 | perl -pe 's/\..*//; s/ec2-//; s/-/./g'`
ssh $hostname
}