Skip to content

Instantly share code, notes, and snippets.

@shedd
shedd / assets.rake
Created June 20, 2011 18:05
Check asset encoding for valid UTF-8
namespace :assets do
task :check => :environment do
paths = ["app/assets", "lib/assets", "vendor/assets"]
paths.each do |path|
dir_path = Rails.root + path
if File.exists?(dir_path)
dir_files = File.join(dir_path, "**")
@shedd
shedd / CI Deploy Pattern for Netlify.md
Last active October 30, 2018 16:59
A simple pattern for pushing production builds live on Netlify when your CI build passes.
@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 / keybase.md
Created September 12, 2016 14:08
Keybase Verification

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 C098 9ED3 FEDF E11A CD4C 1958 129B 668B 99F6 EF77

To claim this, I am signing this object:

@shedd
shedd / schedule.rb
Created May 7, 2011 15:03
Lockrun support for Whenever cron jobs
# Support running Whenever cron jobs with Lockrun
# Lockrun: http://www.unixwiz.net/tools/lockrun.html
# lockrun typically installed at /usr/bin/lockrun
# On Mac, install with: brew install lockrun
# Lockrun prefix for cronjobs: /usr/bin/lockrun --lockfile=/path/to/tmp/JOBNAME.lockrun -- sh -c "COMMAND"
def wrap_with_lockrun command
"/usr/bin/env lockrun --lockfile=:path/tmp/:lockfile.lockrun -- sh -c \"#{ command }\""
end
#redefine the three default job types to use Lockrun (i.e. just add 'lockrun_' in front of the existing job names)
@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 <ola@sitarska.com>
This script requires python-epub-library: http://code.google.com/p/python-epub-builder/
"""
import re, ez_epub, urllib2, genshi
@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 / 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 / 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 / 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***