barinek.com: the official website

Gnip Classic

Gnip Classic

ActiveRecord MySQL Partitions

Check out the below example of how to create partitioned MySQL tables within a Rails Migration. We’ve had a handful of tables that we continually want to partition and a team member wrote the below.

Here’s the migration snippet

class AddResultsTable < ActiveRecord::Migration
  def self.up
    create_partitioned_table :results do |t|

The below creates a results table partitioned by day. The example migration defaults to 4 days back and 4 days forward. We then have a few scripts to manage our partitioned tables.

Here’s the rails source

nginx with thin and monk

The below script is a continuation of my last aws post, however instead of installing Phusion Passenger and Rails, the script installs Thin and Monk. Monk is glue framework for Rack and Sinatra.

Here are the links to the software detailed in the script.

As before, the first part of the script removes pre-configured ruby packages and installs ruby and rubygems from scratch and the second part of the script installs nginx with ssl support and then sets up an example monk application.

Here is the full example

nginx with passenger and rails

The below script walks you through setting up Nginx with Phusion Passenger and Rails. The script is intended for use with RightScale and Amazon Web Services (AWS).

Here are the links to the software detailed in the script.

The first part of the script removes pre-configured ruby packages and installs ruby and rubygems from scratch.

The second part of the script installs nginx with ssl support and then sets up an example rails application.

Here is the full example

the #golf swing&#8230;unfortunately how I didn&#8217;t spend my xmas break

the #golf swing…unfortunately how I didn’t spend my xmas break

nagios ejabberd check via ruby

Below is an example of using Ruby and xmpp4r to check ejabberd’s status from within nagios

You’ll need to define the below nagios command within you nagios config file and then include the below ruby.

define command {
  command_name check_xmpp
  command_line ruby /opt/nagios/plugins/check_xmpp.rb --hostname $HOSTADDRESS$ --jid username@domain.com --password password
}
Here is the ruby example

Alice’s adventures in algebra: Wonderland solved http://bit.ly/7nB2oI barinek