Skip to content

Instantly share code, notes, and snippets.

View mrrooijen's full-sized avatar

Michael van Rooijen mrrooijen

View GitHub Profile
@mrrooijen
mrrooijen / postgresql.conf
Created July 1, 2011 21:42
Upstart PostgreSQL
start on runlevel [2345]
stop on runlevel [016]
respawn
script
exec su -c "/etc/postgresql/bin/postgres -D /usr/local/pgsql/data" postgres
end script
# note
# change the path ( /etc/postgresql/bin/postgres ) to the directory
@mrrooijen
mrrooijen / Rakefile.rb
Created August 9, 2011 22:33 — forked from carlhoerberg/Rakefile.rb
How to do automatic backup with Heroku PGBackups and Heroku Cron. http://carlhoerberg.com/automatic-backup-of-heroku-database-to-s3
require 'aws/s3'
require 'heroku'
require 'heroku/command'
require 'heroku/command/auth'
require 'heroku/command/pgbackups'
task :cron do
class Heroku::Auth
def self.client
Heroku::Client.new ENV['heroku_login'], ENV['heroku_passwd']
@mrrooijen
mrrooijen / Gemfile
Created September 25, 2011 07:35
Pry with Rails Console
group :development do
gem "pry"
gem "pry-doc"
end
@mrrooijen
mrrooijen / cheddar_getter_transaction_summary.rb
Created November 4, 2011 01:39
A small Ruby utility for CheddarGetter.com to render out summaries over a period of time in ASCII tables.
# encoding: utf-8
require "cheddargetter_client_ruby"
require "terminal-table"
require "parallel"
require "active_support/time"
module CheddarGetter
class TransactionSummary
" Vim color scheme
"
" Name: railscat.vim
" Maintainer: Jeff Kreeftmeijer
" License: public domain
"
" A GUI only extended version of the Railscasts+ theme, that comes with
" Janus [1] and is, in turn, an extension to the original Railscasts theme
" [2], which is a port of the RailsCasts TextMate theme [3] to Vim.
"
@mrrooijen
mrrooijen / PostgreSQL-UTF8.sh
Created December 31, 2011 18:37
Make PostgreSQL use UTF-8 encoding instead of ASCII.
UPDATE pg_database SET datistemplate = FALSE WHERE datname = 'template1';
DROP DATABASE template1;
CREATE DATABASE template1 WITH TEMPLATE = template0 ENCODING = 'UNICODE';
UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template1';
\c template1
VACUUM FREEZE;
UPDATE pg_database SET datallowconn = FALSE WHERE datname = 'template1';
@mrrooijen
mrrooijen / .gitignore
Created February 1, 2012 18:04
MiddleMan on Heroku configuration.
.DS_Store
*.swp
*.swo
Gemfile.lock
@mrrooijen
mrrooijen / systemd.service
Created March 28, 2012 13:55
Example Service File for systemd.
[Service]
ExecStart=/home/kill/.rvm/bin/ruby-1.9.2-p290 /home/kill/bin/echo-server.rb
User=kill
StandardOutput=syslog
StandardError=syslog
@mrrooijen
mrrooijen / deploy.rb
Created April 2, 2012 18:03
Deploy with Capistrano without SCM.
set :scm, :none
set :repository, "."
set :deploy_via, :copy
@mrrooijen
mrrooijen / rbenvsudo.sh
Created April 3, 2012 10:29
A little shell function that allows you to perform rbenv (gem) commands with sudo privileges. Similar to rvmsudo.
function rbenvsudo(){
executable=$1
shift 1
sudo $(rbenv which $executable) $*
}