Skip to content

Instantly share code, notes, and snippets.

{ "account" => {
"categories" => {
"18" => 1,
"19" => 1,
"20" => 1,
"21" => 1,
"22" => 1,
"23" => 1,
"24" => 1,
"25" => 1,
@jonathanclarke
jonathanclarke / Avoiding precompile if no assets change when synching to S3
Created February 13, 2012 03:13
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
logger.info "Skipping asset pre-compilation because there were no asset changes"
end
end
end
@jonathanclarke
jonathanclarke / gist:3197355
Created July 29, 2012 10:27 — forked from danparsons/gist:3195652
How to stream the London 2012 Olympics

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.

require 'formula'
class Imagemagick < Formula
homepage 'https://legacy.imagemagick.org'
url 'https://ftp.osuosl.org/pub/blfs/conglomeration/ImageMagick/ImageMagick-6.9.7-8.tar.xz'
head 'https://github.com/ImageMagick/ImageMagick/tree/ImageMagick-6',
:using => UnsafeSubversionDownloadStrategy
@jonathanclarke
jonathanclarke / 0-readme.md
Created May 25, 2021 11:49 — forked from toolmantim/0-readme.md
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 https://get.rvm.io | 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:

@jonathanclarke
jonathanclarke / dedup.rb
Created June 19, 2021 12:13
Export files recusively to a common directory with a unique sha
# 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'