Lucid Lynx a fresh install with ruby, rails, passenger etc

A fresh install for my laptop, with some Desktop tools ans all the rails/ruby stuff i need. I tried using rvm for all gems, but since executables are not available it kind of sucks for things like passenger, where youd have to change the ruby path all the time, a real showstopper imo.

  1. Replace radiance theme with clearlock
  2. copy important dotfiles + firefox history/forms/… database from .mozilla
  3. install dotfiles
  4. Multi-clipboard: sudo apt-get install glipper (add to panel)
  5. install Skype
  6. Application laucher: sudo apt-get install gnome-do + enable skype plugin
  7. Ruby enterprise
  8. Java: sudo apt-get install sun-java6-jre
  9. Rubymine + add Rubymine Desktop icon + choose “meta is mapped to left win” in advanced keyboard layout options
  10. Mysql: sudo apt-get install mysql-server mysql-client libmysql-ruby
  11. Apache:  sudo apt-get install build-essential apache2 apache2-mpm-prefork apache2-prefork-dev
  12. sudo a2enmod rewrite
  13. Passenger
  14. SSL for apache/passenger
  15. gem sources -a http://gems.github.com
  16. gems…
  17. Git: sudo apt-get install git-core git-svn
  18. install redis
  19. sudo apt-get install memcached + add memcached -d to startup
  20. Arial/Verdana etc fonts:   sudo apt-get install msttcorefonts
  21. VirtualBox

Empty session id leads to shared session + Fix

We recently encountered some users that had an empty sessionid and therefore where logged in as other users, to fix this (the reason why the ids where empty is still unknown….) we now forbid blank session ids.

# users with blank session id get logged in as other users / share session 
#-> forbid empty session ids
# TEST: set _session_id cookie to "" it should be removed/replaced
class ActionController::Session::AbstractStore
  def load_session_with_blank_id_protection(*args)
    id, data = load_session_without_blank_id_protection(*args)
    return [nil, {}] if id.blank?
    [id, data]
  end
  alias_method_chain :load_session, :blank_id_protection
end

Reliable timeout for Ruby 1.8.x with fallback

We want reliable timeouts, but dont want to hard-code SystemTimer everywhere, so atm we are using this:

# lib/safe_timeout.rb
# stolen from klarlack -- http://github.com/schoefmax/klarlack
# to get an reliable timeout that wont fail on other platforms
# or if sytem_timer is missing
SafeTimeout = begin
  # Try to use the SystemTimer gem instead of Ruby's timeout library
  # when running on something that looks like Ruby 1.8.x. See:
  # http://ph7spot.com/articles/system_timer
  # We don't want to bother trying to load SystemTimer on jruby and
  # ruby 1.9+.
  if RUBY_VERSION =~ /^1\.8\./ and RUBY_PLATFORM !~ /java/
    require 'system_timer'
    SystemTimer
  else
    require 'timeout'
    Timeout
  end
rescue LoadError => e
  $stderr.puts "Could not load SystemTimer gem, falling back to Ruby's slower/unsafe timeout library: #{e.message}"
  require 'timeout'
  Timeout
end