This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'socket' | |
require 'dm-core' | |
require 'fastercsv' | |
WRITE_SHUTDOWN = 1 | |
module DataMapper | |
module Adapters | |
class LqlAdapter < AbstractAdapter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/etc/init.d/xvfb start | |
DISPLAY=:99.0 rake spec | |
/etc/init.d/xvfb stop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ABC | |
extend self | |
def abc | |
"abc" | |
end | |
end | |
puts ABC.abc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'eventmachine' | |
require 'logger' | |
class LoggedConnection < EM::Connection | |
attr_accessor :logger | |
def initialize(*args) | |
self.logger = args.pop[:logger] | |
super | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# gem install eventmachine eventmachine_httpserver | |
require 'eventmachine' | |
require 'evma_httpserver' | |
module HttpServer | |
include EM::HttpServer | |
def process_http_request | |
response = EM::DelegatedHttpResponse.new(self) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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!"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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!"] |
OlderNewer