Skip to content

Instantly share code, notes, and snippets.

View calavera's full-sized avatar

David Calavera calavera

View GitHub Profile
@calavera
calavera / ssl-cert-upgrade-cloudfront.md
Created September 4, 2017 16:45 — forked from jbinto/ssl-cert-upgrade-cloudfront.md
Upgrading SSL certificate on Cloudfront

Upgrading SSL certificate on Cloudfront

Last year I set up jessebuchanan.ca with an SSL certificate on Amazon S3 / CloudFront.

Now, it's time to renew the certificate.

The first time was fraught with peril, but I eventually got it working.

This time I will document the steps to renew the cert. Most steps for a new installation would be omitted.

@calavera
calavera / README.md
Created February 28, 2012 18:02 — forked from fnichol/README.md
Vagrantify: Create a chef-solo enabled Vagrant virtual machine for development

Installation

gem install thor
mkdir -p ~/vagrants && cd ~/vagrants
curl -LO https://raw.github.com/gist/1528832/vagrantify
chmod 755 vagrantify

Usage

./vagrantify init webserver

@calavera
calavera / gist:1522343
Created December 27, 2011 00:30 — forked from headius/gist:1234935
OS X 'pickjdk' command with single-command selection and updated JDK location
#!/bin/bash
#
# Provides a function that allows you to choose a JDK. Just set the environment
# variable JDKS_ROOT to the directory containing multiple versions of the JDK
# and the function will prompt you to select one. JAVA_HOME and PATH will be cleaned
# up and set appropriately.
_macosx()
{
if [ $(uname -s) = Darwin ]; then
# cat config/trinidad.yml
---
environment: production
port: 5000
log: info
extensions:
daemon:
pid_file: /data/cloudstock_demo/current/tmp/pids/trinidad_cloudstock_demo.pid
jvm_args: '-Xmx2048m'
@calavera
calavera / greed.rb
Created January 5, 2011 16:43 — forked from xaviuzz/greed.rb
def score(dice)
compute_singles(dice) + compute_triples(dice)
end
def compute_singles(diceRoll)
diceRoll.inject(0) do |result, roll|
result += single_value(roll)
end
end
# Monkey-patch LoadError's message to include the current $LOAD_PATH.
class LoadError
def initialize(*args)
super
@path = $LOAD_PATH.dup
end
def message
if $servlet_context && $servlet_context.get_init_parameter('rack.load.path.debug') == 'true'
$servlet_context.log("Current path:\n" + @path.join("\n"))
require 'paperclip/geometry'
module Paperclip
module ClassMethods
# Places ActiveRecord-style validations on the width of the file assigned. The
# possible options are:
# * +in+: a Range of pixels (i.e. +10..100+),
# * +less_than+: equivalent to :in => 0..options[:less_than]
# * +greater_than+: equivalent to :in => options[:greater_than]..Infinity
# * +message+: error message to display, use :min and :max as replacements
def validates_attachment_width name, options = {}