Skip to content

Instantly share code, notes, and snippets.

View codeprimate's full-sized avatar

Patrick Morgan codeprimate

  • Bellingham, WA
  • 16:01 (UTC -07:00)
View GitHub Profile
groupadd -g 5000 vmail
useradd -g vmail -u 5000 vmail
mkdir -p /var/mail/vhosts/example.com
mkdir -p /var/mail/vhosts/example2.com
chown vmail:vmail /var/mail/vhosts/example.com
chown vmail:vmail /var/mail/vhosts/example2.com
/etc/postfix/main.cf:
virtual_mailbox_domains = example.com, example2.com
virtual_mailbox_base = /var/mail/vhosts
xml.instruct!
xml.rss "version" => "2.0", "xmlns:dc" => "http://purl.org/dc/elements/1.1/" do
xml.channel do
xml.title "Feed Name"
xml.link url_for :only_path => false, :controller => 'posts'
xml.pubDate CGI.rfc1123_date @posts.first.updated_at if @posts.any?
xml.description "Feed Description"
// Extended Array functions.
// from http://4umi.com/web/javascript/array.php
// -- Standard functions
// Array.concat() - Join two arrays
if( typeof Array.prototype.concat==='undefined' ) {
Array.prototype.concat = function( a ) {
for( var i = 0, b = this.copy(); i<a.length; i++ ) {
# The CACHE_PATH Proc constant can be used by controller action caching
# Example Usage: caches_action :index, :layout => false, :cache_path => CACHE_PATH
# Override the CACHE_EXPIRATION constant within your controller to change the
# expiration time.
#CACHE_EXPIRATION = 5 #in minutes
CACHE_PATH = Proc.new{ |controller|
"#{Digest::MD5.hexdigest(controller.request.request_uri +
controller.request.format +
controller.session[:user_id].to_s) +
((Time.now - Date.today.to_time).to_i/60).to_f.divmod((CACHE_EXPIRATION || 5))[0].to_s}"
set nu
set autoindent
set tabstop=2
set shiftwidth=2
set ruler
set wildmenu
set wildchar=<Tab> wildmenu wildmode=full
set ignorecase
set smartcase
set nu
set autoindent
set tabstop=2
set shiftwidth=2
set ruler
set wildmenu
set wildchar=<Tab> wildmenu wildmode=full
set ignorecase
set smartcase
require 'rubygems'
require 'www/mechanize'
require 'open-uri'
class GoogleCacheDump
attr_accessor :query, :namer, :user_agent, :output_prefix, :search_url, :ignore
def initialize
@query = nil
@namer = nil
# ~/.irbrc
# Requires the following gems: wirble, hirb
#
# Hirb: http://tagaholic.me/hirb/doc/index.html
# Wirble: http://pablotron.org/software/wirble/
require 'irb/completion'
require 'irb/ext/save-history'
IRB.conf[:SAVE_HISTORY] = 100
@codeprimate
codeprimate / ffmpeg_setup.sh
Created January 19, 2010 00:00
FFMPEG Installation in /opt
# The following notes detail the installation of ffmpeg from source,
# and installed to /opt, instead of the default locations.
# Target OS: Ubuntu 10.04
# This file is not intended to be run as a script, but should be
# seen as a rough guide, especially for dependency finding and
# configure options.
sudo apt-get remove ffmpeg x264 libx264-dev
sudo apt-get install build-essential yasm git-core libtheora-dev libtheora0 \
# ThreadedProcessor : A very simple wrapper for sized queue multithreading with Ruby
#
# Usage:
#
# object_list = %w(1..100).to_a
# threads = 5
# tp = ThreadedProcessor.new(object_list,threads) do |obj|
# puts obj
# end
# tp.run!