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 | |
require 'securerandom' | |
require 'json' | |
require 'benchmark' | |
require 'bunny' | |
conn = Bunny.new | |
conn.start | |
ch = conn.create_channel | |
x = ch.default_exchange |
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 'cgi' | |
require 'base64' | |
require 'openssl' | |
def oauth_url(url) | |
parameters = ["oauth_consumer_key=#{ENV.fetch 'OAUTH_KEY'}", | |
"oauth_nonce=#{Random.rand(100000000).to_s}", | |
"oauth_signature_method=#{'HMAC-SHA1'}", | |
"oauth_timestamp=#{Time.now.to_i.to_s}", | |
"oauth_version=1.0"].join('&') |
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
#define _GNU_SOURCE | |
#define _FILE_OFFSET_BITS 64 | |
#include <stdio.h> | |
#include <time.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <sys/resource.h> | |
#define errExit(msg) do { perror(msg); exit(EXIT_FAILURE); \ | |
} while (0) |
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
source 'https://rubygems.org' | |
gem 'rack' | |
gem 'puma' |
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 'em-http-request' | |
# Reference: | |
# https://github.com/igrigorik/em-http-request/wiki/Parallel-Requests | |
# http://rdoc.info/github/eventmachine/eventmachine/master/EventMachine/Iterator | |
urls = ['http://www.google.com', 'http://www.cloudamqp.com'] |
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
# https://github.com/carlhoerberg/heroku-jruby-example/tree/puma | |
$ siege -b -c 100 -t 60S http://jruby-puma.herokuapp.com/ | |
Transactions: 42918 hits | |
Availability: 100.00 % | |
Elapsed time: 60.18 secs | |
Data transferred: 3.40 MB | |
Response time: 0.14 secs | |
Transaction rate: 713.16 trans/sec | |
Throughput: 0.06 MB/sec | |
Concurrency: 98.90 |
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 'dm-core' | |
DataMapper.setup(:default, 'in_memory::') | |
class A | |
include DataMapper::Resource | |
property :id, Serial | |
property :jada, String | |
has n, :bs | |
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
cloudpostgres (monitor)$ git push | |
Counting objects: 33, done. | |
Delta compression using up to 4 threads. | |
Compressing objects: 100% (18/18), done. | |
Writing objects: 100% (18/18), 2.26 KiB, done. | |
Total 18 (delta 13), reused 0 (delta 0) | |
remote: /data/github/current/lib/github/config/resque.rb:27: undefined method `constantize' for "GitHub::Jobs::TransformUserIntoOrg":String (NoMethodError) | |
remote: from /data/github/current/lib/github/config/resque.rb:26:in `each' | |
remote: from /data/github/current/lib/github/config/resque.rb:26 | |
remote: from /data/github/current/lib/rock_queue.rb:9:in `require' |
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 'sinatra/base' | |
require 'openssl' | |
require 'webrick' | |
require 'webrick/https' | |
class App1 < Sinatra::Base | |
get '/' do | |
'app1' | |
end | |
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
user www-data; | |
pid /var/run/nginx.pid; | |
worker_processes 1; | |
events { | |
worker_connections 1024; # increase if you have lots of clients | |
accept_mutex off; # "on" if nginx worker_processes > 1 | |
use epoll; # enable for Linux 2.6+ | |
} |