The intent is to define terse, standards-supported names for AWS regions.
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
# 1. Clear retry set | |
Sidekiq::RetrySet.new.clear | |
# 2. Clear scheduled jobs | |
Sidekiq::ScheduledSet.new.clear | |
# 3. Clear 'Processed' and 'Failed' jobs |
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
function asdf() { | |
case $1 in | |
"start") | |
case $2 in | |
"psql"|"postgres") | |
pg_ctl -D `asdf where postgres $(asdf current postgres)`/data start > /dev/null 2>&1 | |
echo "[STARTED] Postgres `asdf current postgres`" | |
;; | |
"redis"|"redis-server") | |
`asdf which redis`-server /usr/local/etc/redis.conf |
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 | |
# | |
# THOR template | |
$PROG = File.basename($PROGRAM_NAME) | |
$DIR = File.dirname($PROGRAM_NAME) | |
# Possibly modify the LOAD_PATH | |
# $LOAD_PATH << File.join(__dir__, '..', 'lib/migrations') |
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 bash | |
# install-pre-push-hook | |
# this script installs the pre-push hook into the current .git repo. | |
# by default, the pre-push hook protects the "master" branch. | |
set_git_hooks_dir_path() { | |
set_git_dir_path | |
git_hooks_dir_path="$git_dir_path/hooks" | |
if [[ ! -d "$git_hooks_dir_path" ]] ; then | |
echo 1>&2 "$git_hooks_dir_path does not exist!" | |
exit |
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
# for use by collection_select and friends, to link a human-readable label with a db-friendly symbolic value | |
# todo: ActiveRecord macros for setters (for allowing multiple values or just one) | |
# Usage: | |
# Table name: snacks | |
# id :integer | |
# ice_cream :string | |
# class Snack < ActiveRecord::Base | |
# FLAVORS = Enum.new [ | |
# [:vanilla, "Vanilla"], | |
# [:chocolate, "Chocolate"], |
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
Dealing with conflicts to db/structure.sql (when merging master) | |
$ git checkout master | |
# Change database.yml to point to database: clean (on localhost) in development env | |
# In one command: | |
# 1) drops the database specified in database.yml for current env ('clean' database) | |
# 2) creates a db with name specified in database.yml | |
# 3) loads master's structure into the database specified in database.yml |
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
-- show running queries (pre 9.2) | |
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(clock_timestamp(), query_start), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
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 python | |
# with help and inspiration from | |
# * ASN1_generate_nconf(3) (specifically the SubjectPublicKeyInfo structure) | |
# * http://www.sysmic.org/dotclear/index.php?post/2010/03/24/Convert-keys-betweens-GnuPG%2C-OpenSsh-and-OpenSSL | |
# * http://blog.oddbit.com/2011/05/converting-openssh-public-keys.html | |
import sys | |
import base64 | |
import struct |