Skip to content

Instantly share code, notes, and snippets.

@ivanvanderbyl
ivanvanderbyl / gist:4222308
Created December 6, 2012 06:55
Postgres 9.1 to 9.2 upgrade guide for Ubuntu 12.04
sudo add-apt-repository ppa:pitti/postgresql
sudo apt-get update
sudo apt-get install postgresql-9.2 postgresql-server-dev-9.2 postgresql-contrib-9.2
sudo su -l postgres
psql -d template1 -p 5433
CREATE EXTENSION IF NOT EXISTS hstore;
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
service postgresql stop
/usr/lib/postgresql/9.2/bin/pg_upgrade -b /usr/lib/postgresql/9.1/bin -B /usr/lib/postgresql/9.2/bin -d /var/lib/postgresql/9.1/main/ -D /var/lib/postgresql/9.2/main/ -O "-c config_file=/etc/postgresql/9.2/main/postgresql.conf" -o "-c config_file=/etc/postgresql/9.1/main/postgresql.conf"
class Course < ActiveRecord::Base
def self.prototype(overrides={})
attributes = {
:code => 'ruby',
:title => 'Ruby Programming',
:active => true,
:released_on => 15.days.ago
}
new(attributes.merge(overrides))
end
@rdj
rdj / update-ip
Created October 24, 2011 22:47
Dynamic DNS with Zerigo and a cron job
#!/bin/bash
# Run `crontab -e` and add this line:
# */1 * * * * /Users/youraccount/bin/update-ip
# Enable API access under Zerigo's DNS / Preferences / API Access and Dynamic Updates
# Then get your API key from that same page after you save the form.
ZERIGO_HOSTNAME=host.example.com
ZERIGO_USERNAME=email%40gmail.com
@detroitpro
detroitpro / FlashHelpers
Created December 16, 2010 04:44
Rob Conery's ASP.NET MVC FlashHelpers class - ala: rails
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Text;
namespace System.Web.Mvc {
public static class FlashHelpers {
public static void FlashInfo(this Controller controller,string message) {
@andruby
andruby / dyndns_update.rb
Created April 17, 2010 11:01
Zerigo dynamic dns updater
#!/usr/bin/env ruby
# Dynamic DNS updater by Andruby for Zerigo
# www.andrewsblog.org
ApiKey = 'myzerigoapikey' # your Zerigo API key
Host = 'test.example.com' # the host you want to dynamically update
User = '[email protected]' # your Zerigo username
NameServer = 'a.ns.zerigo.net' # Zerigo nameserver to query
LastIpTmpFile = '/tmp/dyn_update_last_ip' # a temporary file where we store the last ip adress