Skip to content

Instantly share code, notes, and snippets.

View mostlyobvious's full-sized avatar

Paweł Pacana mostlyobvious

View GitHub Profile
#!/usr/bin/env python
import fapws._evwsgi as evwsgi
from fapws import base
import sys
sys.path.insert(0, '/var/lib/moin/wiki')
def start():
evwsgi.start('10.0.0.3', '8000')
location /wiki {
uwsgi_pass 10.0.0.3:8000;
include uwsgi_params;
if ($uri ~ ^/wiki(.*)?) {
set $path_info $1;
}
uwsgi_param PATH_INFO $path_info
uwsgi_param SCRIPT_NAME /wiki;
}
@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
/etc/init.d/xvfb start
DISPLAY=:99.0 rake spec
/etc/init.d/xvfb stop
module ABC
extend self
def abc
"abc"
end
end
puts ABC.abc
require 'eventmachine'
require 'logger'
class LoggedConnection < EM::Connection
attr_accessor :logger
def initialize(*args)
self.logger = args.pop[:logger]
super
end
# gem install eventmachine eventmachine_httpserver
require 'eventmachine'
require 'evma_httpserver'
module HttpServer
include EM::HttpServer
def process_http_request
response = EM::DelegatedHttpResponse.new(self)
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:
#!/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!"]