Skip to content

Instantly share code, notes, and snippets.

@mrrooijen
mrrooijen / Capistrano-Deployment-Recipe.rb
Created July 29, 2009 09:34
a "base" Capistrano Rails Deployment Recipe. Use it to deploy your Rails application. It is also easily expandable. So feel free to grab this Recipe and add your own tasks/customization!
# Guide
# Configure the essential configurations below and do the following:
#
# Repository Creation:
# cap deploy:repository:create
# git add .
# git commit -am "initial commit"
# git push origin master
#
# Initial Deployment:
error do
exception = request.env['sinatra.error']
Hoptoad::Notifier.send_error exception, params, request.env if %w(staging production).include?(ENV['RACK_ENV'])
erb :five_hundred
end
@pklaus
pklaus / create-lxc-container.sh
Created January 25, 2011 01:08
Automates the steps to set up LXC containers with virtualized environments on Ubuntu Linux
#!/bin/bash
### Bash Script that automates the steps to set up an LXC (Linux Container) boxed environment on Ubuntu Linux
### <http://blog.philippklaus.de/2011/01/container-virtualization-using-lxc-on-ubuntu/>
###
### More inspiration can be found in <https://github.com/phbaer/lxc-tools> and in
### <https://github.com/halcyon/lxc-tools/commit/b428a6973dd12b75c2400d41f60c454e752c10c6> and
### <http://mindref.blogspot.com/2011/01/debian-lxc-create.html>.
###
### Written by Philipp Klaus <philipp.l.klaus @ web.de>
@jtimberman
jtimberman / gist:881058
Last active August 14, 2022 21:15
i can has ruby-1.9 package with fpm
sudo apt-get install libssl-dev
sudo gem install fpm
wget ftp://ftp.ruby-lang.org//pub/ruby/1.9/ruby-1.9.3-p392.tar.gz
tar -zxvf ruby-1.9.3-p392.tar.gz
cd src/ruby-1.9.3-p392
time (./configure --prefix=/usr && make && make install DESTDIR=/tmp/installdir)
fpm -s dir -t deb -n ruby -v 1.9.3-p392 -C /tmp/installdir \
-p ruby-VERSION_ARCH.deb -d "libstdc++6 (>= 4.4.3)" \
@ryanb
ryanb / rails_3_1_rc4_changes.md
Created May 6, 2011 01:10
The Changelogs for Rails 3.1 Beta 1

Railties 3.1 RC4

  • The new rake task assets:clean removes precompiled assets. [fxn]

  • Application and plugin generation run bundle install unless --skip-gemfile or --skip-bundle. [fxn]

  • Fixed database tasks for jdbc* adapters #jruby [Rashmi Yadav]

  • Template generation for jdbcpostgresql #jruby [Vishnu Atrai]

@minhajuddin
minhajuddin / Procfile
Created June 27, 2011 18:58 — forked from czottmann/Procfile
Example of a Foreman/Capistrano/upstart setup
worker: QUEUE=* bundle exec rake environment resque:work
scheduler: bundle exec rake environment resque:scheduler
@a-chernykh
a-chernykh / forum.rb
Created July 14, 2011 11:49
Mongoid counter cache
class Forum
include Mongoid::Document
include Mongoid::Timestamps
field :posts_count, :type => Integer, :default => 0
has_many_related :posts
end
namespace :db do
desc "Replace the local dev DB with a copy from Heroku."
task :pull, [:src, :dest] do |t, args|
abort "Only in dev." unless ENV.development?
src = args.src || "heroku-app-name"
dest = args.dest || "local-db-name"
restore = "pg_restore -x -O -d #{dest}"
url = "heroku pgbackups:url --app #{src}"
@peterc
peterc / dnsd.rb
Created December 2, 2011 23:47
Simple, scrappy UDP DNS server in Ruby (with protocol annotations)
# Simple, scrappy UDP DNS server in Ruby (with protocol annotations)
# By Peter Cooper
#
# MIT license
#
# * Not advised to use in your production environment! ;-)
# * Requires Ruby 1.9
# * Supports A and CNAME records
# * See http://www.ietf.org/rfc/rfc1035.txt for protocol guidance
# * All records get the same TTL
@kylelemons
kylelemons / piping.go
Last active July 4, 2022 01:25 — forked from dagoof/piping.go
piping exec.Cmd in golang (example sorts all regular files under a directory by their extension)
package main
import (
"bytes"
"exec"
"log"
"os"
)
// Pipeline strings together the given exec.Cmd commands in a similar fashion