Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bats
@test "copy ocaml code into place" {
run cp -r /opt/mirage-web /tmp
[ "$status" -eq 0 ]
}
@test "configure mirage" {
cd /tmp/mirage-web
run env OPAMROOT=/usr/local/opam NET=socket mirage configure --unix
require 'serverspec'
set :backend, :exec
['ocaml', 'opam', 'libxen-dev'].each do |package_name|
describe package(package_name) do
it { is_expected.to be_installed }
end
end
weave::interface { "Ensure ethwe (bound to $ip) $ensure on $host_name":
  ensure    => $ensure,
  ip        => $weave_routable_ip/cidr,
  container => $host_name,
}
class { 'mirageos':
vsphere_vm { '/dc/vm/eng/sample':
  ensure => running,
  source => '/dc/vm/eng/source',
  memory => 1024,
  cpus   => 1,
}
@garethr
garethr / Django Fabric File
Created September 6, 2009 10:44
Sample fabric build file for a Django project
config.project_name = 'sample'
config.repo_address = 'http://path/to/repo'
def server():
config.fab_hosts = ['{ip address}']
config.path = '/srv/sample'
config.fab_user = '{username}'
config.virtualhost_path = "configs/"
config.group = '{username}'
@garethr
garethr / gist:226208
Created November 4, 2009 16:54
Apache virtualhost for an asset server
<VirtualHost *:80>
ServerName assets
FileETag none
ExpiresActive On
ExpiresByType image/x-icon "access plus 1 year"
ExpiresByType text/css "access plus 1 year"
ExpiresByType application/javascript "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
@garethr
garethr / pre-receive
Created July 11, 2010 17:51
pre-receive git hook for integrity continuous integration server
#!/usr/bin/env ruby
require 'rubygems'
require 'grit'
require 'nokogiri'
require 'open-uri'
# This is a pre-receive git hook designed to be part of a continuous
# deployment workflow using the Integrity continuous integration server
@garethr
garethr / gist:471712
Created July 11, 2010 17:51
post-receive git hook for integrity continuous integration server
#!/usr/bin/env ruby
require 'net/http'
# This is a post-receive git hook designed to tirgger a build in the
# Integrity continuous integration server
INTEGRITY = 'http://localhost:9292'
PROJECT = 'site'
@garethr
garethr / delete.sh
Last active September 7, 2015 09:46
Delete all disks and storage accounts in Azure
#!/bin/bash -x
azure vm disk list | grep 'Linux' | awk '{ print $2 }' | xargs -n 1 -P 5 azure vm disk delete -b
azure storage account list | grep 'Standard_GRS' | awk '{ print $2 }' | xargs -n 1 -P 5 azure storage account delete -q
@garethr
garethr / amqpserver.feature
Created November 21, 2010 17:35
using cucumber for monitoring AMQP server
Feature: AMQP capacity
To make sure the rest of the system is in order
Our message queues must not be backed up
Scenario: Check queue status
Given I have a AMQP server on example.com
And I want to check on the fork queue
Then it should have less than 400 messages
Then it should have at least 5 consumers
Then it should have less than 50 messages per consumer