Skip to content

Instantly share code, notes, and snippets.

@shedd
shedd / gist:1301135
Created October 20, 2011 13:24
Rakefile snippet
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require(File.join(File.dirname(__FILE__), 'config', 'boot'))
require 'rake'
# Log any errors to Hoptoad as needed
# ** define this before the lib/tasks are included
def task_with_airbrake_notification(options)
task(options) do
begin
@shedd
shedd / img_convert.rb
Created April 14, 2012 17:03 — forked from arirusso/img_convert.rb
convert html img tags to rails image_tag calls
#!/usr/bin/env ruby -Ku
require "nokogiri"
require "iconv"
# opens every file in the given dir tree and converts any html img tags to rails image_tag calls
#
# example usage:
# ruby convert.rb ~/my_rails_app/app/views
#
# ***be careful and backup before using this***
@shedd
shedd / README.md
Created April 21, 2012 00:13
Import Pivotal Tracker into Kanbanery - CSV export/import translation

Pivotal Tracker CSV export to Kanbanery CSV import translator

This script is designed to take a CSV input file, generated by Pivotal Tracker's CSV export process, and translate it into the CSV import format used by Kanbanery.

The fields used by the tools don't map exactly, but this tool tries to adapt them as best as possible. For instance, Pivotal makes use of labels. Kanbanery doesn't have tags or labels. Instead, this tool takes the labels and inserts them into the story title so that they can still be used for searching in Kanbanery.

Additionally, the Kanbanery import format doesn't take tasks or comments as explicit data elements. Thus, the script merges these into the Kanbanery description field separated by ASCII horizontal rules.

Hopefully, this is useful to you!

Configuration

@shedd
shedd / ideal ops.md
Created May 27, 2012 12:33 — forked from bhenerey/ideal ops.md
ideal ops checklist

In a perfect world, where things are done well, not just quickly, I would expect to find the following when joining the company:

Documentation

  • Accurate / up-to-date systems architecture diagram

  • Accurate / up-to-date network diagram

  • Out-of-hours support plan

  • Incident management plan

@shedd
shedd / indexes.rb
Created August 8, 2012 08:30 — forked from durran/indexes.rb
Missing FK indexes
connection = ActiveRecord::Base.connection
connection.tables.each do |table|
columns = connection.columns(table).collect(&:name).select {|x| x.ends_with?("_id" || x.ends_with("_type"))}
indexed_columns = connection.indexes(table).collect(&:columns).flatten.uniq
unindexed = columns - indexed_columns
unless unindexed.empty?
puts "#{table}: #{unindexed.join(", ")}"
end
end
@shedd
shedd / default.rb
Created August 9, 2012 09:43 — forked from emachnic/default.rb
Chef recipe to write redis.yml on Engine Yard Cloud
# ey-cloud-recipes/cookbooks/redis-yml/recipes/default.rb
if ['app_master', 'app'].include?(node[:instance_role])
redis_instance = node['utility_instances'].find { |instance| instance['name'] == 'redis' }
if redis_instance
node[:applications].each do |app, data|
template "/data/#{app}/shared/config/redis.yml"do
source 'redis.yml.erb'
owner node[:owner_name]
@shedd
shedd / pgessays.py
Created November 22, 2012 03:55 — forked from olasitarska/pgessays.py
Builds epub book out of Paul Graham's essays.
# -*- coding: utf-8 -*-
"""
Builds epub book out of Paul Graham's essays: http://paulgraham.com/articles.html
Author: Ola Sitarska <[email protected]>
This script requires python-epub-library: http://code.google.com/p/python-epub-builder/
"""
import re, ez_epub, urllib2, genshi
@shedd
shedd / tmux.cheat
Last active August 29, 2015 13:56 — forked from afair/tmux.cheat
========================================== ==========================================
TMUX COMMAND WINDOW (TAB)
========================================== ==========================================
List tmux ls List ^b w
New new -s <session> Create ^b c
Attach att -t <session> Rename ^b , <name>
Rename rename-session -t <old> <new> Last ^b l (lower-L)
Kill kill-session -t <session> Close ^b &
@shedd
shedd / A Model RegExp.coffee
Last active August 29, 2015 13:56
A CoffeeScript for RegExps?
# Sample RegEx with CoffeeScript comments
# from http://www.elijahmanor.com/regular-expressions-in-coffeescript-are-awesome/
emailPattern = /// ^ # begin of line
([\w.-]+) # one or more letters, numbers, _ . or -
@ # followed by an @ sign
([\w.-]+) # then one or more letters, numbers, _ . or -
\. # followed by a period
([a-zA-Z.]{2,6}) # followed by 2 to 6 letters or periods
$ ///i # end of line and ignore case

Keybase proof

I hereby claim:

  • I am shedd on github.
  • I am shedd (https://keybase.io/shedd) on keybase.
  • I have a public key whose fingerprint is 2B69 E8EB 97F3 6DFA 989A D880 2A44 A6A0 6ABB 1812

To claim this, I am signing this object: