I hereby claim:
- I am mmrwoods on github.
- I am mmrwoods (https://keybase.io/mmrwoods) on keybase.
- I have a public key ASCzrDxWj3rVBEYaFP5PA0_jWGNQdhiYpwcJ8_d-9NcJowo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
#!/bin/bash | |
if [ "$1" == "" ] || [ "$2" == "" ]; then | |
echo "usage: $0 [options] <host> <port>" | |
echo | |
echo "options:" | |
echo " -i <interval> Number of seconds between checks [default: 5]" | |
exit 1 | |
fi |
#!/bin/bash | |
PS_NAME=apache2 | |
CHECK_URL=http://localhost/ | |
MAX_TRIES=5 | |
apache_running() { | |
ps -eo pid,comm | fgrep $PS_NAME > /dev/null 2>&1 | |
} |
module PostgreSQLMigrationUtils | |
# Changes the type of a string or text column to citext and recreates | |
# indexes on that column that follow the rails naming convention, such | |
# that the index is on the result of the lower(col) function. | |
# | |
# Note: The citext type changes comparisons on citext columns to be on | |
# lower(col), but does nothing about ensuring that indexes created on | |
# citext columns are automatically created on the result of lower(col). | |
def change_column_to_citext(table_name, column_name) |
#!/bin/bash | |
# Find hosts matching pattern in ssh_config and run command on each. | |
# As pattern is an argument to egrep, but is also injected into a string | |
# which is evaluated, you can hack the input to do weird useful things, | |
# like pass options to egrep or pipe the output through another command. | |
usage() { | |
echo "Usage: $0 [pattern] [command]" | |
} |
#!/bin/bash | |
# Vacuum, analyze and re-index all non-template postgres databases | |
# Should be run as root to avoid any permissions issues | |
db_list_sql="SELECT datname FROM pg_database WHERE NOT datistemplate AND datallowconn ORDER BY datname" | |
for db in $(su - postgres -c "psql -At -c '$db_list_sql'"); do | |
su - postgres -c "vacuumdb --analyze --quiet $db" | |
su - postgres -c "PGOPTIONS='--client-min-messages=warning' reindexdb --quiet $db" |
#!/bin/bash | |
# Create a clean SQL dump of each non-template postgres database | |
# Should be run as root to avoid any permissions issues | |
dest_dir=/var/local/backup/postgres | |
db_list_sql="SELECT datname FROM pg_database WHERE NOT datistemplate AND datallowconn ORDER BY datname" | |
for db in $(su - postgres -c "psql -At -c '$db_list_sql'"); do |
#!/usr/bin/env ruby | |
# Dumb-ass backup - better than no backup! | |
# | |
# Run nightly and enjoy daily, weekly and monthly filesystem backups | |
# | |
# - default destination directory is /var/local/backup | |
# - latest, daily, weekly and monthly sub-directories are created | |
# - latest directory should only ever contain the latest backup | |
# - latest backup copied to daily, weekly and monthly directories as required |
require 'active_support' | |
require 'hirb' | |
require 'debugger' | |
user = 'thickpaddy' # FIXME: get from argv | |
def send_request(url, content=nil) | |
curl_opts = ["--max-time 30", "--silent"] | |
if content | |
curl_opts << "--header 'Content-Type: application/json'" |
#!/usr/bin/env ruby | |
require 'bundler' | |
require 'hirb' | |
require 'csv' | |
lock_file = Bundler::LockfileParser.new(Bundler.read_file("Gemfile.lock")) | |
def url_for(spec) | |
case spec.source |