Skip to content

Instantly share code, notes, and snippets.

View bouchard's full-sized avatar

Brady Bouchard bouchard

View GitHub Profile
@bouchard
bouchard / .profile
Created September 3, 2016 19:45 — forked from bmhatfield/.profile
Automatic Git commit signing with GPG on OSX
# In order for gpg to find gpg-agent, gpg-agent must be running, and there must be an env
# variable pointing GPG to the gpg-agent socket. This little script, which must be sourced
# in your shell's init script (ie, .bash_profile, .zshrc, whatever), will either start
# gpg-agent or set up the GPG_AGENT_INFO variable if it's already running.
# Add the following to your shell init to set up gpg-agent automatically for every shell
if [ -f ~/.gnupg/.gpg-agent-info ] && [ -n "$(pgrep gpg-agent)" ]; then
source ~/.gnupg/.gpg-agent-info
export GPG_AGENT_INFO
else
@bouchard
bouchard / config.rb
Last active December 26, 2017 05:43
Podcast XML/Builder Template for Middleman
page '/podcast.xml', layout: false
# Methods defined in the helpers block are available in templates
helpers do
def podcast_source_path(article)
"source/audio/#{article.data.file}"
end
end
@bouchard
bouchard / download.rb
Created December 31, 2014 23:51
Download Private but Embedded Vimeo Videos
#!/usr/bin/env ruby
require 'nokogiri'
require 'net/http'
require 'shellwords'
require 'json'
source = Net::HTTP.get('www.domain.com', '/thepagethathasthevideos/')
doc = Nokogiri::HTML(source)
ids = doc.css('a').map{ |a| a.attr('data-vimeoid') }.compact.uniq
@bouchard
bouchard / state_machine.rb
Created December 25, 2014 20:05
Hack to Get Rails 4.1.0.rc1 through 4.2.0 to work with state_machine
# Rails 4.1.0.rc1 through 4.2.0 and StateMachine don't play nice
# https://github.com/pluginaweek/state_machine/issues/295
# https://github.com/pluginaweek/state_machine/issues/314
require 'state_machine/version'
unless StateMachine::VERSION == '1.2.0'
# If you see this message, please test removing this file
# If it's still required, please bump up the version above
Rails.logger.warn "Please remove me, StateMachine version has changed."
@bouchard
bouchard / keybase.md
Created September 17, 2014 23:07
Keybase Proof

Keybase proof

I hereby claim:

  • I am bouchard on github.
  • I am brady (https://keybase.io/brady) on keybase.
  • I have a public key whose fingerprint is 9F51 0077 BCBA AC87 3017 DD84 9FF6 1476 A7C4 DFF6

To claim this, I am signing this object:

@bouchard
bouchard / delete_all_archives.rb
Last active August 1, 2016 15:12
Delete all archives in an Amazon Glacier Vault
#!/usr/bin/env ruby
require 'aws-sdk'
require 'json'
glacier = AWS::Glacier.new(
:access_key_id => "ID_GOES_HERE",
:secret_access_key => "SECRET_GOES_HERE"
)
2012/06/08 10:39am,2,29,88,12,39,4,28,31,106,25,6,127,13,15,25
2012/06/08 10:40am,2,29,88,12,39,4,28,31,106,25,6,127,13,15,25
2012/06/08 10:41am,2,29,88,12,39,4,28,31,106,25,6,127,13,15,25
2012/06/08 10:42am,2,29,88,12,39,4,28,31,106,25,6,127,13,15,25
2012/06/08 10:43am,2,29,88,12,39,4,28,31,106,25,6,127,13,15,25
2012/06/08 10:44am,2,29,88,12,39,4,28,31,106,25,6,127,13,15,25
2012/06/08 10:45am,2,29,88,12,39,4,28,31,106,25,6,127,13,15,25
2012/06/08 10:46am,2,29,88,12,39,4,28,31,106,25,6,127,13,15,25
2012/06/08 10:47am,2,29,88,12,39,4,28,31,106,25,6,127,13,15,25
2012/06/08 10:48am,2,29,88,12,39,4,28,31,106,25,6,127,13,15,25
Date/Time: 2012-11-06 12:50:52 +1000
OS Version: 10.8.2 (Build 12C60)
Architecture: x86_64
Report Version: 11
Command: Tagalicious
Path: /Applications/Tagalicious.app/Contents/MacOS/Tagalicious
Version: 1.5.5 (1.5.5)
Parent: launchd [173]
#!/usr/bin/env ruby
# A few helpful tips about the Rules file:
#
# * The string given to #compile and #route are matching patterns for
# identifiers--not for paths. Therefore, you can’t match on extension.
#
# * The order of rules is important: for each item, only the first matching
# rule is applied.
#
@bouchard
bouchard / gist:1528761
Created December 28, 2011 17:18
Force Lowercase and Force Parameterize for Acts as Taggable On.
module ActsAsTaggableOn
class TagList < Array
cattr_accessor :force_lowercase, :force_parameterize
self.force_lowercase = false
self.force_parameterize = false
private
# Remove whitespace, duplicates, and blanks.
def clean!