Look at LSB init scripts for more information.
Copy to /etc/init.d:
# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)| require 'benchmark' | |
| begin | |
| require 'active_support/values/time_zone' | |
| rescue LoadError | |
| puts 'Please do `gem install active_support`' | |
| exit(1) | |
| end | |
| def benchmark_hash(hash, key, inverted_hash) | |
| Benchmark.bmbm do |x| |
| require './s3-bucket-copier' | |
| credentials = { | |
| :provider => "AWS", | |
| :region => "eu-west-1", | |
| :aws_access_key_id => "<KeyId>", | |
| :aws_secret_access_key => "<KeySecret>" | |
| } | |
| connection = ::Fog::Storage.new(credentials) |
Look at LSB init scripts for more information.
Copy to /etc/init.d:
# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)Changes:
this version includes backport of Greg Price's patch for speedup startup http://bugs.ruby-lang.org/issues/7158 .
ruby-core prefers his way to do thing, so that I abandon cached-lp and sorted-lf patches of mine.
this version integrates 'array as queue' patch, which improves performance when push/shift pattern is heavily used on Array.
This patch is accepted into trunk for Ruby 2.0 and last possible bug is found by Yui Naruse. It is used in production* for a couple of months without issues even with this bug.
| # Usage: redis-cli publish message hello | |
| require 'sinatra' | |
| require 'redis' | |
| conns = [] | |
| get '/' do | |
| erb :index | |
| end |
| # 2. Include Sweeping module in your controller(s) to have cache_sweeper | |
| # method to be avaliable, or right in ApplicationController so it will be | |
| # available in all controllers inheriting from it. | |
| class ApplicationController < ActionController::Base | |
| include ActionController::Caching::Sweeping | |
| # ... | |
| end |
| # encoding: UTF-8 | |
| # requires ruby 1.9.3 and up | |
| # gem install nokogiri typhoeus | |
| require 'nokogiri' | |
| require 'typhoeus' | |
| module Imgur | |
| class AlbumDownloader |
A Homebrew formula for installing PulseAudio on OS X.
Tested on Lion, and at the moment requires the 10.7 SDK.
brew install https://raw.github.com/gist/1633642/pulseaudio.rb
| # This is Neocities' Rainbows! config file. We are using this in production to run all our web apps. | |
| # It works really well for us and has been heavily load tested, so I wanted to share it with the community. | |
| # | |
| # In my opinion, this is the best way to deploy a ruby web application. Unlike EventMachine based solutions, | |
| # it uses real ruby threads, which allows it to take advantage of the internal non-blocking IO pattern | |
| # in MRI. | |
| # | |
| # Contrary to popular belief, MRI doesn't block execution to wait on IO when you are using threads, even | |
| # with the GIL. The requests are done concurrently for anything that is based on the IO class. This | |
| # includes things like Net::HTTP and even `system commands`. Grep the MRI Ruby source code for |