Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# Export some ENV variables so you don't have to type anything
export AWS_ACCESS_KEY_ID=<your-access-key-id>
export AWS_SECRET_ACCESS_KEY=<your-secret-access-key>
export PASSPHRASE=<your-gpg-passphrase>
GPG_KEY=<your-gpg-key>
# The source of your backup
SOURCE=/
# Creates a mock object instance for a +model_class+ with common
# methods stubbed out. Additional methods may be easily stubbed (via
# add_stubs) if +stubs+ is passed.
def mock_model(model_class, options_and_stubs = {})
id = options_and_stubs[:id] || next_id
options_and_stubs = options_and_stubs.reverse_merge({
:id => id,
:to_param => id.to_s,
:new_record? => false,
:errors => stub("errors", :count => 0)
module Enumerable
# group_by method included in Ruby 1.9
def group_by
h = {}
each do |o|
key = yield(o)
if h.key?(key)
h[key] << o
else
h[key] = [o]
def cookies
@cookies ||= ActionController::CookieJar.new(self)
end
{
"disclaimer":"This code and data form part of the BBC iPlayer content protection system. Tampering with,
removal of,
misuse of,
or unauthorised use of this code or data constitutes circumvention of the BBC's content protection measures and may result in legal action. BBC (C) 2010.",
"media":
[
{
"width":"1280",
root@ubuntu:/# puppetd --server puppet.example.com --waitforcert 60 --test
info: Retrieving plugin
err: /File[/var/lib/puppet/lib]: Failed to generate additional resources using 'eval_generate': undefined method `closed?' for nil:NilClass
err: /File[/var/lib/puppet/lib]: Failed to retrieve current state of resource: undefined method `closed?' for nil:NilClass Could not retrieve file metadata for puppet://puppet.example.com/plugins: undefined method `closed?' for nil:NilClass
err: Could not retrieve catalog from remote server: undefined method `closed?' for nil:NilClass
warning: Not using cache on failed catalog
err: Could not retrieve catalog; skipping run
info: access[^/catalog/([^/]+)$]: allowing 'method' find
info: access[^/catalog/([^/]+)$]: allowing $1 access
info: access[/certificate_revocation_list/ca]: allowing 'method' find
info: access[/certificate_revocation_list/ca]: allowing * access
info: access[/report]: allowing 'method' save
info: access[/report]: allowing * access
info: access[/file]: allowing * access
info: access[/certificate/ca]: adding authentication no
info: access[/certificate/ca]: allowing 'method' find
info: access[/certificate/ca]: allowing * access
root@balancer:~# puppetd --server operations.Boomer.local --test
info: Creating a new SSL key for balancer.boomer.local
warning: peer certificate won't be verified in this SSL session
info: Caching certificate for ca
warning: peer certificate won't be verified in this SSL session
warning: peer certificate won't be verified in this SSL session
info: Caching certificate_request for balancer.boomer.local
warning: peer certificate won't be verified in this SSL session
warning: peer certificate won't be verified in this SSL session
Exiting; no certificate found and waitforcert is disabled
class common::editors {
apt::package { "emacs23-nox" : ensure => installed }
apt::package { "nano" : ensure => installed }
apt::package { "vim" : ensure => installed }
}
#!/bin/sh
echo ''
echo ' .__ '
echo ' ______ __ __ _____| |__ ___________ '
echo ' \____ \| | \/ ___/ | \_/ __ \_ __ \ '
echo ' | |_> > | /\___ \| Y \ ___/| | \/ '
echo ' | __/|____//____ >___| /\___ >__| '
echo ' |__| \/ \/ \/ '
echo ''