Skip to content

Instantly share code, notes, and snippets.

View larsar's full-sized avatar

Lars Preben Sørsdahl larsar

View GitHub Profile
# config/initializers/char_converter.rb
require 'uri'
module Support
class CharConverter
SANITIZE_ENV_KEYS = [
"HTTP_COOKIE", # bad cookie encodings kill rack: https://github.com/rack/rack/issues/225
"HTTP_REFERER",
"PATH_INFO",
# config/initializers/char_converter.rb
require 'uri'
module Support
class CharConverter
def initialize(app)
@app = app
end
Steps to install and run PostgreSQL 9.3 using Homebrew (Mac OS X)
(if you aren't using version 9.2.4, change to the correct version)
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
mv /usr/local/var/postgres /usr/local/var/postgres92
brew upgrade postgresql
initdb /usr/local/var/postgres -E utf8
pg_upgrade -b /usr/local/Cellar/postgresql/9.2.4/bin -B /usr/local/Cellar/postgresql/9.3.0/bin -d /usr/local/var/postgres92 -D /usr/local/var/postgres
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
module Delayed
module Plugins
class Airbrake < Plugin
module Notify
def error(job, error)
::Airbrake.notify_or_ignore(error)
super
end
end
import os
import simplejson
import subprocess
import datetime
f = open('latitude.json', 'r')
locdata = simplejson.loads(f.read());
fd = open('latitude.gpx', 'w')
fd.write("""# <?xml version="1.0" encoding="UTF-8" standalone="no" ?>

Install Python

$ brew install readline sqlite gdbm
$ brew install python --universal --framework
$ python --version
Python 2.7

Symlinks...

@larsar
larsar / gitolite.pp
Created November 14, 2011 13:02 — forked from larstobi/gitolite.pp
Gitolite manifest
file {
"/var/spool/gitolite":
ensure => directory,
owner => "git",
group => "git";
"admin.pub":
ensure => present,
path => "/var/spool/gitolite/admin.pub",
content => "ssh-rsa AAAAB3NzaC1...bmhLcxczOQ== admin@example.net";
@larsar
larsar / user_larstobi.pp
Created November 14, 2011 13:01 — forked from larstobi/user_larstobi.pp
Puppet user resource
class user_larstobi {
$user = "larstobi"
group { "$user":
ensure => present,
allowdupe => false,
}
user { "$user":
comment => "Lars Tobias Skjong-Borsting",
gid => "$user",