Skip to content

Instantly share code, notes, and snippets.

View ctrochalakis's full-sized avatar

Christos Trochalakis ctrochalakis

View GitHub Profile
@ctrochalakis
ctrochalakis / command line
Created June 30, 2010 08:42
eventmachine-tail bug
touch tailme
# Tail the same file twice
tailer.rb tailme
echo "smth" |cat >tailme
# results:
Tailing tailme
Tailing tailme
@ctrochalakis
ctrochalakis / em_munin.rb
Created June 25, 2010 10:17
draft for parsing munin data
require 'eventmachine'
module Munin
include EM::Deferrable
Delimiter = "\n".freeze
End = '.'.freeze
def receive_data(data)
(@buffer||='') << data
while index = @buffer.index(Delimiter)
# checkout: http://github.com/igrigorik/async-rails/
From bb2a78858cffa7c6937642986e9aca1a4f862c0d Mon Sep 17 00:00:00 2001
From: Ilya Grigorik <ilya@igvita.com>
Date: Thu, 10 Jun 2010 00:46:48 -0400
Subject: [PATCH] async rails3
---
Gemfile | 6 ++++++
app/controllers/widgets_controller.rb | 6 ++++++
@ctrochalakis
ctrochalakis / unicorn_github
Created June 14, 2010 20:30 — forked from rtomayko/unicorn_github
ruby heap options
#!/bin/sh
# Usage: unicorn_github
# Script used to start unicorn in GitHub staging and production environments.
# This is called primarily by god.
set -e
# configure GC settings
export RUBY_HEAP_MIN_SLOTS=800000
export RUBY_HEAP_FREE_MIN=100000
export RUBY_HEAP_SLOTS_INCREMENT=300000
require "redis"
require "nest"
redis = Redis.new
users = Nest.new(:users, redis)
posts = Nest.new(:posts, redis)
user = users[users.incr]
user.hmset(:name, "Albert")
user nginx;
worker_processes 5;
error_log /var/log/nginx.error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
@ctrochalakis
ctrochalakis / ab-test
Created June 13, 2010 06:08
Fun with async webserver
-> ab -c 10 -n 10 http://localhost:3000/timer
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient).....done
Server Software: thin
Server Hostname: localhost
From bb2a78858cffa7c6937642986e9aca1a4f862c0d Mon Sep 17 00:00:00 2001
From: Ilya Grigorik <ilya@igvita.com>
Date: Thu, 10 Jun 2010 00:46:48 -0400
Subject: [PATCH] async rails3
---
Gemfile | 6 ++++++
app/controllers/widgets_controller.rb | 6 ++++++
app/models/widget.rb | 2 ++
config.ru | 1 +
@ctrochalakis
ctrochalakis / dalton.rb
Created June 11, 2010 12:17
facebook, google, twitter, yahoo warden strategies
require 'dalton/strategies/skroutz'
require 'dalton/strategies/facebook'
require 'dalton/strategies/openid' # yahoo, #google
require 'dalton/strategies/twitter'
# Setup OpenId file storage, don't change the storage engine!
require 'openid/store/filesystem'
Rails.configuration.middleware.use(Rack::OpenID,
OpenID::Store::Filesystem.new(Rails.root + 'tmp/openid'))
From bb2a78858cffa7c6937642986e9aca1a4f862c0d Mon Sep 17 00:00:00 2001
From: Ilya Grigorik <ilya@igvita.com>
Date: Thu, 10 Jun 2010 00:46:48 -0400
Subject: [PATCH] async rails3
---
Gemfile | 6 ++++++
app/controllers/widgets_controller.rb | 6 ++++++
app/models/widget.rb | 2 ++
config.ru | 1 +