Skip to content

Instantly share code, notes, and snippets.


Jonathan Clarke jonathanclarke

View GitHub Profile
jonathanclarke / dedup.rb
Created Jun 19, 2021
Export files recusively to a common directory with a unique sha
View dedup.rb
# frozen_string_literal: true
# Export files recusively to a common directory with a unique sha
# Ignore duplicate files, skip directories
require 'pathname'
INPUT_DIR = '/home/jonathan/duplicate-input'
OUTPUT_DIR = '/home/jonathan/deduped-output'
jonathanclarke /
Created May 25, 2021 — forked from toolmantim/
Using rvm and node on Ubuntu with Buildkite Agent

Firstly, you'll need to install rvm as the buildkite-agent user:

sudo su buildkite-agent
curl -sSL | bash -s stable
source /var/lib/buildkite-agent/.rvm/scripts/rvm
rvm install 2.4.0 && rvm use 2.4.0 && gem install bundler

Secondly, make rvm available to your build commands by adding the following pre-command Buildkite Agent hook:

View imagemagick.rb
require 'formula'
class Imagemagick < Formula
homepage ''
url ''
head '',
:using => UnsafeSubversionDownloadStrategy
jonathanclarke / gist:3197355
Created Jul 29, 2012 — forked from danparsons/gist:3195652
How to stream the London 2012 Olympics
View gist:3197355

How to stream the London 2012 Olympics

There have been several HOWTOs posted regarding streaming the 2012 Olympics using HTTP / SOCKS proxies via SSH and other similar methods. None of these actually work using the latest Flash on Mountain Lion (with Firefox, Chrome or Safari). Additionally, the third-party streaming sites don't provide BBC's amazing interface, which lets you quickly skip to individual competitors and events. However, setting up an OpenVPN server does work, with some tweaks. You'll get the exact same UX that people in England receive.

jonathanclarke / Avoiding precompile if no assets change when synching to S3
Created Feb 13, 2012
Avoiding precompile if no assets change when synching to S3
View Avoiding precompile if no assets change when synching to S3
namespace :assets do
task :precompile, :roles => :web, :except => { :no_release => true } do
from = source.next_revision(current_revision)
if capture("cd #{latest_release} && #{source.local.log(from)} vendor/assets/ app/assets/ | wc -l").to_i > 0
run %Q{cd #{latest_release} && #{rake} RAILS_ENV=#{rails_env} #{asset_env} assets:precompile}
else "Skipping asset pre-compilation because there were no asset changes"
View gist:1240608
{ "account" => {
"categories" => {
"18" => 1,
"19" => 1,
"20" => 1,
"21" => 1,
"22" => 1,
"23" => 1,
"24" => 1,
"25" => 1,
jonathanclarke / daily_deal_rss_feed
Created Aug 8, 2011 — forked from davemorro/daily_deal_rss_feed
Recommended Daily Deal RSS Feed
View daily_deal_rss_feed
<?xml version="1.0" encoding="UTF-8" ?>
<title>A perfect daily deal feed for just $17.50</title>
<description><![CDATA[Set your daily deal site up for maximum distribution effectiveness. Many deal sites include HTML within the description however, we recommend you remove all formatting, enabling the aggregator to more easily integrate your information. If you do include HTML, be sure wrap the description in CDATA sequences.]]></description>
<highlights><![CDATA[Usually a list of the deal highlights. Like the description, you should wrap the highlights in CDATA sequences.]]></highlights>
jonathanclarke / gist:848224
Created Feb 28, 2011
Regenerate thumbnails for has_many paperclip
View gist:848224
has_attached_file :file,
:styles => { :thumb => "139x107#", :thumb_ems => "64x64#", :thumb_aar => "100x100#", :thumb_newsletter => "80x60#", :thumb_newsletter_product => "110x85#", :web_image => "145x>" },
:storage => :s3,
:bucket => "domain.com_#{RAILS_ENV}",
:s3_credentials => "#{RAILS_ROOT}/config/s3.yml",
:path => ":class/:id/:style/:filename"
RAILS_ENV=staging rake paperclip:refresh:thumbnails CLASS=Asset
View Installing node.js on Ubuntu 10.10
#Remove existing node.js
cd ~/node-previously-installed
make uninstall
#Installation without using sudo
#IIRC, this only works for shell windows opened
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
View gist:591241
before_create :my_cool_thing
def my_cool_thing