I've been trying to understand how to setup systems from
the ground up on Ubuntu. I just installed redis onto
the box and here's how I did it and some things to look
out for.
To install:
| require "stateful" | |
| class Folder < ActiveRecord::Base | |
| include Stateful | |
| # ... | |
| stateful do | |
| state :active | |
| state :inactive |
| Surround these with : e.g. :calling: | |
| +1 | |
| -1 | |
| bulb | |
| calling | |
| clap | |
| cop | |
| feet |
| (function() { | |
| var ua = 'Mozilla/5.0 (iPhone; U; CPU iPhone OS 3'; | |
| if (navigator.userAgent.indexOf(ua) === 0) { | |
| document.write('<sc' + 'ript src="/js/ios3_bug.js"></sc' + 'ript>'); | |
| } | |
| })(); | |
| // iPhone OS 3 requires an external script tag to be synchronously | |
| // loaded in the HEAD od the HTML document if there's a reference |
| #!/usr/bin/env ruby | |
| # | |
| # USAGE: | |
| # | |
| # ruby -rubygems -ropen-uri -e 'eval open("http://gist.github.com/raw/473222/snippet.rb").read' jbarnette dr-nic-magic-awesome | |
| # | |
| # Or locally: | |
| # | |
| # $ show_forks jbarnette dr-nic-magic-awesome | |
| # jbarnette - 2008/06/05 15:54:29 -0700 |
| ~$ ARCHFLAGS='-arch i386 -arch x86_64' | |
| ~$ rvm install 1.8.7 --debug --reconfigure -C --enable-shared=yes | |
| ~$ wget http://sourceforge.net/projects/rubycocoa/files/RubyCocoa/1.0.0/RubyCocoa-1.0.0.tar.gz/download | |
| ~$ tar xzf RubyCocoa-1.0.0.tar.gz && rm RubyCocoa-1.0.0.tar.gz && cd RubyCocoa-1.0.0 | |
| ~/RubyCocoa-1.0.0$ ruby install.rb config --build-universal=yes | |
| ~/RubyCocoa-1.0.0$ ruby install.rb setup | |
| ~/RubyCocoa-1.0.0$ sudo ruby install.rb install |
| # If your workers are inactive for a long period of time, they'll lose | |
| # their MySQL connection. | |
| # | |
| # This hack ensures we re-connect whenever a connection is | |
| # lost. Because, really. why not? | |
| # | |
| # Stick this in RAILS_ROOT/config/initializers/connection_fix.rb (or somewhere similar) | |
| # | |
| # From: | |
| # http://coderrr.wordpress.com/2009/01/08/activerecord-threading-issues-and-resolutions/ |
| # Run the given block +num+ times and then print out the mean, median, min, | |
| # max, and stddev of the run. For example: | |
| # | |
| # irb> stats(10) { sleep(rand / 100) } | |
| # mean: 5.99ms | |
| # median: 6.76ms | |
| # min: 1.49ms | |
| # max: 9.28ms | |
| # stddev: 2.54ms | |
| def stats(num) |