Skip to content

Instantly share code, notes, and snippets.

@ches
ches / resources.md
Last active August 29, 2015 14:03
BKK Web Meetup - Big Data Open Panel, July 8th 2014 - Resources

Following are some resources referred to during the discussion, afterward in one-on-one chats, plus a few that I thought might be of interest for futher reading. As the panel turned out to be, these are mostly technical, with a few of interest to analyst types. I too wish that we had a bit more coverage of business case studies.

[Big Data: Principles and best practices of scalable realtime data systems][marz]

Nathan Marz and James Warren (Manning Publications)

A wealth of insight on building an architecture employing multiple data stores in order to serve differing latency requirements, and hedge risks and weaknesses. Marz initially developed Apache Storm for Backtype, acquired by Twitter. Still in "Early Access Edition" status, but all chapters are now available. If you're not technical but you'd like an introduction to the technical considerations, [Marz's post that led to the book][marz cap] is a briefer overview.

[Questioning the Lambda Architecture][kreps lambda]

@ches
ches / lighter.rb
Last active August 30, 2015 11:14 — forked from macournoyer/lighter.rb
A tiny little command-line Campfire client using the Tinder gem.
# Lighter -- Campfire from the command line
# usage: ruby lighter.rb subdomain "Main Room" macournoyer@gmail
require "rubygems"
require "tinder"
require "readline"
require "highline/import"
class Lighter
def initialize(room)
@room = room
@ches
ches / environment.rb
Last active September 3, 2015 19:45 — forked from webmat/environment.rb
A little `config.github_gem` helper for back in the day when Rails used `config.gem`-style dependencies.
# Neater Github gem dependencies for Rails
module GithubGem
def github_gem(gem_name, opts={})
lib_name = gem_name.split('-', 2)[1]
self.gem gem_name, {:lib => lib_name, :source => 'http://gems.github.com'}.merge(opts)
end
end
Rails::Initializer.run do |config|
@ches
ches / expire_sessions.rake
Last active September 3, 2015 23:05
Use mysql to expire sessions without loading the Rails environment, so we can call this task from cron without it being unnecessarily expensive.
usage = <<DESC
Use mysql to expire sessions without loading the Rails environment, so we
can call this task from cron without it being unnecessarily expensive.
Takes path to Rails app and desired RAILS_ENV as arguments.
DESC
namespace :db do
namespace :sessions do
desc usage
@ches
ches / db.rake
Created October 17, 2010 05:45
Rake task to open MongoDB console for a Rails app with Mongoid
namespace :db do
desc 'Open a MongoDB console with connection parameters for the current Rails.env'
task :console => :environment do
conn = Mongoid.master.connection
args = []
args << "--username=#{conn.username}" if conn.username rescue nil
args << "--password=#{conn.password}" if conn.password rescue nil
args << "--host=#{conn.host}"
args << "--port=#{conn.port.to_s}"
args << Mongoid.master.name
@ches
ches / gist:718234
Created November 27, 2010 20:20 — forked from jpemberthy/gist:349242
Very simple taggable behavior for Mongoid
# Basic tagging system for mongoid documents.
# jpemberthy 2010
#
# class User
# include Mongoid::Document
# include Mongoid::Document::Taggable
# end
#
# @user = User.new(:name => "Bobby")
# @user.tag_list = "awesome, slick, hefty"
@ches
ches / spec_suites.rake
Created November 29, 2010 18:08
Set up Rake tasks to execute defined sets of specs
# Nice idea from:
# http://kpumuk.info/ruby-on-rails/my-top-7-rspec-best-practices/
#
# ~/test$ rake -T spec:suite
#
# (in /Users/kpumuk/test)
# rake spec:suite:acl # Run all specs in access control spec suite
# rake spec:suite:amazon # Run all specs in Amazon libraries spec suite
SPEC_SUITES = [
@ches
ches / eruby.snippets
Created December 2, 2010 00:36
UltiSnips snippets derived from converting Ruby on Rails TextMate bundle
# TextMate added these variables to cope with changes in ERB handling
# in different versions of Rails -- for instance, Rails 3 automatically
# strips whitespace so that it's no longer necessary to use a form like
# <% end -%>, but if you're still maintaining Rails 2 projects, you
# can't omit the minus sign and get the same behavior.
#
# The following regex replace substitutes the function below for the
# TextMate variable references after the snippets are converted:
#
# /\v\$\{(TM_RAILS_TEMPLATE_([^_]+)_RUBY_([^_\s]+))\}/`!p textmate_var('\1', snip)`/g
@ches
ches / embedded_callbacks.rb
Created December 30, 2010 13:22 — forked from zerobearing2/embedded_callbacks.rb
bubble down callbacks to embedded associations with mongoid
# encoding: utf-8
module Mongoid #:nodoc:
module Associations #:nodoc:
module EmbeddedCallbacks
# bubble callbacks to embedded associations
def run_callbacks(kind, *args, &block)
# now bubble callbacks down
self.associations.each_pair do |name, meta|
if meta.association == Mongoid::Associations::EmbedsMany

SciPy, PyQt and Matplotlib on OS X Snow Leopard

The squeeky-clean way with homebrew and pip/virtualenv.

$ easy_install pip
$ pip install virtualenvwrapper mercurial
$ brew install gfortran && brew install pyqt
# Have a nice long coffee break -- compiling Qt took 67 minutes on my

quad-core i7 MBP, PyQt another 8.