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
$vertx.create_http_server().request_handler() do |req| | |
req.response() | |
.put_header(content-type, "text/plain") | |
.end("Hello World") | |
end.listen(9292) |
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
from datetime import datetime | |
from time import sleep | |
from sys import argv | |
def measure(func): | |
def decorator(n): | |
start = datetime.now() | |
res = func(n) | |
end = datetime.now() |
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
wget --load-cookies cookies.txt --recursive \ | |
--no-clobber \ | |
--page-requisites \ | |
--html-extension \ | |
--convert-links \ | |
--domains <your_domain> \ | |
--no-parent <specific URL path> |
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 "http/server" | |
class Cluster | |
def initialize(@n : Int32, @port : Int32, @io : IO = STDOUT) | |
@workers = Array(Process).new | |
@pid = Process.pid | |
end | |
def call | |
head |
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
global | |
maxconn 4096 | |
pidfile /tmp/haproxy-queue.pid | |
defaults | |
mode http | |
timeout connect 300000 | |
timeout client 300000 | |
timeout server 300000 | |
maxconn 2000 |
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 "http/server" | |
module HTTPCluster | |
struct Worker | |
def initialize(@pid : Int32, @master : Int32) | |
end | |
def call(port) | |
yield(port) | |
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
require "big_int" | |
def fact(n) | |
return 1 if n == 0 | |
n * fact(n - 1) | |
end | |
n = BigInt.new(ARGV[0]) | |
puts fact(n) |
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
def stores_for_user | |
@stores = OsaUser.find_all_by_user(params[:user]). | |
map{|x| [x.store_code, x.store_description]}.uniq unless params[:user].blank? | |
respond_to do |format| | |
format.json { render :json => @stores} | |
end | |
end |