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 -c 35 -n 1000 http://127.0.0.1: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
%Replace from line 251 in couch_httpd_misc_handlers.erl | |
% httpd log handlers | |
handle_log_req(#httpd{method='GET'}=Req) -> | |
ok = couch_httpd:verify_is_server_admin(Req), | |
Bytes = list_to_integer(couch_httpd:qs_value(Req, "bytes", "1000")), | |
Offset = list_to_integer(couch_httpd:qs_value(Req, "offset", "0")), | |
Chunk = couch_log:read(Bytes, Offset), | |
case couch_httpd:qs_value(Req, "format", "text") of | |
"json" -> |
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
ENV["RAILS_ENV"] = "staging" | |
Bluepill.application("my_app-staging", :log_file => '/var/my_app/shared/log/bluepill.log') do |app| | |
app.process("unicorn") do |process| | |
process.pid_file = '/var/my_app/shared/pids/unicorn.pid' | |
process.working_dir = '/var/my_app/current' | |
process.start_command = "/usr/local/bin/bundle exec unicorn -c /var/my_app/current/config/unicorn.rb -E staging -D" | |
process.stop_command = "kill -QUIT {{PID}}" |
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
%deploy ALL=(ALL) NOPASSWD: /usr/local/bin/bluepill, /sbin/start my_app_bluepill , /sbin/stop my_app_bluepill |
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
after "deploy:restart", "deploy:restart_workers" | |
namespace :deploy do | |
task :start, :roles => :app, :except => { :no_release => true } do | |
sudo 'start bluepill_conf' | |
end | |
task :stop, :roles => :app, :except => { :no_release => true } do | |
sudo "bluepill 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
description "Demo app Bluepill" | |
start on runlevel [2] | |
stop on runlevel [016] | |
expect daemon | |
exec bluepill load /var/my_app/current/config/staging.pill | |
respawn |
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
# add to config/initializers/instrumentation.rb | |
module CouchRest | |
class Database | |
alias_method :old_get, :get | |
alias_method :old_view, :view | |
alias_method :old_update_doc, :update_doc | |
alias_method :old_delete_doc, :delete_doc |
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(train). | |
-behaviour(gen_fsm). | |
%public api | |
-export([start_link/0, start_engine/0, move/0, stop/0, stop_server/0, slow/0, hit_the_break/0, open_doors/0, close_doors/0]). | |
% gsm api | |
-export([init/1, handle_event/3, handle_sync_event/4, handle_info/3, terminate/3, code_change/4]). | |
% state api |
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(kitchen2). | |
-compile(export_all). | |
start(Items) -> | |
spawn_link(?MODULE, restarter, [Items]), | |
timer:sleep(100). %delay for processes to startup befor can issue commands | |
% register(fridge, Pid). | |
restarter(Items) -> |
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(mathStuff). | |
-export([perimeter/1]). | |
perimeter({square,Side}) -> | |
Side * 4; | |
perimeter({rectangle,A,B}) -> | |
(A * 2) + (B * 2); | |
perimeter({circle,Radius}) -> | |
Radius * 2 * 3.1415; |