Skip to content

Instantly share code, notes, and snippets.

View nappa32's full-sized avatar

Imran Ahmed nappa32

View GitHub Profile
namespace :retry do
require 'rubygems'
desc 'Retry Resque DirtyExit jobs'
task resque_dirtyexit_jobs: :environment do
redis = Resque.redis
(0...Resque::Failure.count).each do |i|
serialized_job = redis.lindex(:failed, i)
job = Resque.decode(serialized_job)
aws opsworks --region us-east-1 create-deployment --stack-id 935450cc-61e0-4b03-a3e0-160ac817d2bb --command "{\"Name\":\"deploy\", \"CustomJson\":{\"deploy\":{\"APPSHORTNAME\":{\"scm\":{\"revision\":\"MYBRANCHNAME\"}}}}}"
The JSON structure you want to pass should look like this:
{
"deploy": {
"MYAPPSHORTNAME": {
"scm": {
"revision": "MYGITBRANCH"
@memonic
memonic / cronjob.sh
Created December 15, 2011 13:04
Script to transform Amazon RDS slow log table into the MySQL slow query log format
#!/bin/bash
(/usr/local/bin/db2log | \
mk-query-digest --fingerprints \
--filter '$event->{user} !~ m/^(bi|memonic)$/') 2>&1 | \
mail -s "MySQL slow logs" root
# Rotate slow logs. Will move them into the backup table slow_log_backup. If
# that table exists it's overwritten with the primary slow log.
# So with this strategy we can still access yesterday's slow log by querying
# slow_log_backup.