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:
| # 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/ |
| require 'rubygems' | |
| require 'spoon' | |
| Spoon.spawnp 'jruby', *ARGV |
| module God | |
| module Conditions | |
| class RestartFileTouched < PollCondition | |
| attr_accessor :restart_file | |
| def initialize | |
| super | |
| end | |
| def process_start_time | |
| Time.parse(`ps -o lstart -p #{self.watch.pid} --no-heading`) |
| # Ruby 1.8 | |
| m { } | |
| arity: -1 | |
| proc call arg check: no | |
| wraps values: n/a | |
| m { || } | |
| arity: 0 | |
| proc call arg check: yes, 0 |
| # THANKS EVERYONE FOR YOUR BELOVED BENCHMARKS. | |
| # THIS PATCH IS NOW IN RAILS: | |
| # | |
| # https://github.com/rails/rails/commit/885a599303585b796da7a0a1c3ccd0bc5c642134 | |
| # Please add the following lines after Bundler.require | |
| # and before "class Application < Rails::Application" | |
| # in your config/application.rb | |
| # | |
| # Notice this is just an experiment, don't leave those |
| #!/usr/bin/env ruby -w | |
| # brew-services(1) - Easily start and stop formulas via launchctl | |
| # =============================================================== | |
| # | |
| # ## SYNOPSIS | |
| # | |
| # [<sudo>] `brew services` `list`<br> | |
| # [<sudo>] `brew services` `restart` <formula><br> | |
| # [<sudo>] `brew services` `start` <formula> [<plist>]<br> |
Eventually platforms outgrow the single-source-tree model and become distributed systems. A common pattern in these distributed systems is distributed composition via event buffering. Here we motivate and describe this event buffering pattern.
| (ns queries.postgres | |
| (:gen-class) | |
| (:require [cascalog.ops :as c]) | |
| (:use [cascalog.api]) | |
| (:import [com.twitter.maple.jdbc JDBCTap JDBCScheme TableDesc] | |
| [cascading.tap.SinkMode])) | |
| (defn db-tap [table] | |
| (let [tap (com.twitter.maple.jdbc.JDBCTap. | |
| "jdbc:postgresql://my-db-uri?ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory" |