Skip to content

Instantly share code, notes, and snippets.

View jacques's full-sized avatar
🎯
Focusing

Jacques Marneweck jacques

🎯
Focusing
View GitHub Profile
# 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
@kusor
kusor / .gitmodules
Created May 16, 2010 08:20
NodeJS AMQP Exchanges
[submodule "amqp"]
path = amqp
url = http://github.com/ry/node-amqp.git
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)
---- HOSTS
GET /hosts/<hostname>
{ owner: "bob", private: "true", committers: ["bob", "fred"] }
GET /hosts/<hostname>/committers
["bob", "fred"]
GET /hosts/<hostname>/owner
["bob"]
require 'nokogiri'
require 'mash'
module CoopBanking
class Statement
COLUMNS = [:date, :description, :credit, :debit, :balance]
attr_reader :transactions
def initialize(transactions)
@kusor
kusor / info.txt
Created March 12, 2010 15:24 — forked from konobi/info.txt
# 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
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')
@christianromney
christianromney / gist:170804
Created August 20, 2009 03:43 — forked from retr0h/gist:132506
Ubuntu Chef Bootstrapper
#!/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
anonymous
anonymous / gist:161265
Created August 4, 2009 14:09
== 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.
#!/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")