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/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]" | |
} |
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
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) |
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/bash | |
PS_NAME=apache2 | |
CHECK_URL=http://localhost/ | |
MAX_TRIES=5 | |
apache_running() { | |
ps -eo pid,comm | fgrep $PS_NAME > /dev/null 2>&1 | |
} |
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 | |
require 'rubygems' | |
require 'term/ansicolor' | |
require 'net/ping' | |
String.send(:include, Term::ANSIColor) | |
url = ARGV[0] |
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 | |
require 'rubygems' | |
require 'autotest' | |
require 'optparse' | |
# exit if we're not in a git repository | |
exit $?.exitstatus unless system('git diff --name-only > /dev/null') | |
# make sure we're in the root path for the repository |
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 | |
# When committing directly to master, look for lighthouse ticket number in commit msg and, if necessary, append in format recognised by github | |
# When committing to a topic/feature branch, barf if the branch name doesn't include a ticket number that can be parsed by the post-merge hook | |
# Note: this hook only applies when -m option used and can also be skipped by using --no-verify option | |
COMMIT_MASTER_STATE = 'coding-done' | |
branchname = `git branch --no-color 2> /dev/null`[/^\* (.+)/, 1] |
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
/* save this file to ~/Library/KeyBindings/DefaultKeyBinding.dict */ | |
/* | |
Prefixes for modifier keys... | |
------------------------------ | |
~ Option key (⌥) | |
$ Shift key (⇧) | |
^ Control key (⌃) | |
@ Command key (⌘) | |
# keys on number pad |
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 | |
# this simple script takes two arguments, the rails environment we're deploying to and a commit range to be passed to git-log | |
# The commit range MUST be in the format <full sha of previous revision>..<full sha of current revision>, otherwise the world will end | |
# It looks at git commit messages between the previous and current revision, extracts lighthouse ticket numbers where they are provided | |
# in the commit message; updates the ticket in lighthouse, changing the state to 'resolved' for deploys to production, both changing | |
# state to 'uat' and re-assigning the ticket to the creator for deploys to stage; then sends an email listing the deployed tickets. | |
# Note: if rails environment is edge, does a dummy run as if it was deploying to stage, but doesn't save updates to tickets or send the email |
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 | |
# Dumb-ass Daily Backup - Better than no backup, and so simple it can't fail! | |
# | |
# A backup directory will be created within the destination directory for each key of the sources hash. | |
# Values can be files, directories or glob patterns. | |
# Directories will be backed up as gzipped tar archives, text files are gzipped, binary files are copied. | |
# Create a /etc/dumb_ass_daily_backup.yml config file to override the default sources and destination. | |
# Nothing fancy, no incremental backups, no syncing to remote servers, just a dumb backup script. |
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 | |
# Dumb-ass Remote Copy - Copy dumb-ass daily backups to remote servers using scp, genius! | |
# | |
# Copies today's sub-directory of local source directory to remote destination directory. | |
# Uses only ssh and scp, but requires batch mode / authorized keys. | |
# Does not "sync" files, today's destination directory is trashed and everything is copied. | |
# Copies recursively, maintaining directory structure on remote host, but does so by creating | |
# directories as required and executing scp once for each file to copy - slow, but robust. | |
# Create a /etc/dumb_ass_remote_copy.yml config file to override default configuration options. |
OlderNewer