Skip to content

Instantly share code, notes, and snippets.

View mostlyobvious's full-sized avatar

Paweł Pacana mostlyobvious

View GitHub Profile
@mostlyobvious
mostlyobvious / chef-client.sh
Created June 11, 2011 12:32
chef client install for debian
#!/bin/bash
#
# default debian install does not have sudo,
# run as root
apt-get -q -y install lsb-release
echo "deb http://apt.opscode.com/ `lsb_release -cs`-0.10 main" | tee /etc/apt/sources.list.d/opscode.list
wget -qO - http://apt.opscode.com/[email protected] | apt-key add -
apt-get update
apt-get -q -y install chef
*** glibc detected *** thin server (127.0.0.1:3000): double free or corruption (out): 0x00002aaab42ad350 ***
======= Backtrace: =========
/lib/libc.so.6[0x2ba1f4ce69a8]
/lib/libc.so.6(cfree+0x76)[0x2ba1f4ce8ab6]
/usr/local/rvm/rubies/ruby-1.9.2-p180/lib/libruby.so.1.9(onig_free_body+0x16)[0x2ba1f3e53586]
/usr/local/rvm/rubies/ruby-1.9.2-p180/lib/libruby.so.1.9(onig_free+0xe)[0x2ba1f3e536de]
/usr/local/rvm/rubies/ruby-1.9.2-p180/lib/libruby.so.1.9(rb_reg_search+0x469)[0x2ba1f3e50f59]
/usr/local/rvm/rubies/ruby-1.9.2-p180/lib/libruby.so.1.9[0x2ba1f3e90673]
/usr/local/rvm/rubies/ruby-1.9.2-p180/lib/libruby.so.1.9[0x2ba1f3edf3c7]
/usr/local/rvm/rubies/ruby-1.9.2-p180/lib/libruby.so.1.9[0x2ba1f3ed3419]
#!/usr/bin/env ruby
# encoding: utf-8
$:<< '../lib' << 'lib'
require 'goliath'
# Our custom Goliath API
class HelloWorld < Goliath::API
def response(env)
[200, {}, "hello world!"]
#!/usr/bin/env ruby
# encoding: utf-8
$:<< '../lib' << 'lib'
require 'goliath'
# Our custom Goliath API
class HelloWorld < Goliath::API
def response(env)
[200, {}, "hello world!"]
ab -n 10000 -c 100 http://localhost:8000
eventmachine:
Requests per second: 2495.36 [#/sec] (mean)
Time per request: 40.074 [ms] (mean)
node.js:
# gem install eventmachine eventmachine_httpserver
require 'eventmachine'
require 'evma_httpserver'
module HttpServer
include EM::HttpServer
def process_http_request
response = EM::DelegatedHttpResponse.new(self)
require 'eventmachine'
require 'logger'
class LoggedConnection < EM::Connection
attr_accessor :logger
def initialize(*args)
self.logger = args.pop[:logger]
super
end
module ABC
extend self
def abc
"abc"
end
end
puts ABC.abc
/etc/init.d/xvfb start
DISPLAY=:99.0 rake spec
/etc/init.d/xvfb stop
@mostlyobvious
mostlyobvious / gist:635249
Created October 19, 2010 22:14
DM adapter for most basic query in MKLiveStatus broker
require 'socket'
require 'dm-core'
require 'fastercsv'
WRITE_SHUTDOWN = 1
module DataMapper
module Adapters
class LqlAdapter < AbstractAdapter