This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The ability to disable/enable access to phpMyAdmin on a Rails project that has | |
# an installation in the public directory. | |
namespace :phpmyadmin do | |
desc "Disable access to phpMyAdmin" | |
task :disable, :roles => :web do | |
run "echo 'deny from all' > #{current_path}/public/phpmyadmin/.htaccess" | |
end | |
desc "Enable access to phpMyAdmin" | |
task :enable, :roles => :web do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[submodule "amqp"] | |
path = amqp | |
url = http://github.com/ry/node-amqp.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_revision(path=None): | |
""" | |
Return the revision identifier of the last commit in a git or svn source pool. | |
""" | |
if path is None: | |
path = "." | |
import os, re, subprocess | |
revision = None | |
os.chdir(path) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
---- HOSTS | |
GET /hosts/<hostname> | |
{ owner: "bob", private: "true", committers: ["bob", "fred"] } | |
GET /hosts/<hostname>/committers | |
["bob", "fred"] | |
GET /hosts/<hostname>/owner | |
["bob"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'nokogiri' | |
require 'mash' | |
module CoopBanking | |
class Statement | |
COLUMNS = [:date, :description, :credit, :debit, :balance] | |
attr_reader :transactions | |
def initialize(transactions) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# In .ssh/config: | |
Host * | |
ControlMaster no # Connections by default are not a master | |
ControlPath ~/.ssh/master-%r@%h:%p | |
ServerAliveInterval 60 | |
ServerAliveCountMax 60 | |
# On normal connections, if there is no master running on the ControlPath it will behave as normal | |
ssh some.host |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'money' | |
require 'xe_exchange' | |
Money.default_bank = XE::Exchange.instance | |
ten_dollars = Money.new(1000, 'USD') | |
ten_dollars_in_pounds = ten_dollars.exchange_to('GBP') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
trap "exit 2" 1 2 3 13 15 | |
OPTS="--no-rdoc --no-ri" | |
if [ -f "/etc/lsb-release" ]; then | |
### bootstrap with git. | |
apt-get update -y && apt-get upgrade -y --force-yes && apt-get install -y git-core vim | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
== Rules == | |
On Infrastructure | |
----------------- | |
There is one system, not a collection of systems. | |
The desired state of the system should be a known quantity. | |
The "known quantity" must be machine parseable. | |
The actual state of the system must self-correct to the desired state. | |
The only authoritative source for the actual state of the system is the system. | |
The entire system must be deployable using source media and text files. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# | |
# fetch hosts from amazon EC2 meta-data | |
# | |
# Based on http://dysinger.net/2008/10/13/using-amazon-ec2-metadata-as-a-simple-dns | |
# | |
%w(logger optparse rubygems right_aws resolv pp).each { |l| require l } | |
LOGGER = Logger.new("/var/log/fetch_hosts.log") |