1 - Install dnsmasq
sudo pacman -Syu
sudo pacman -S dnsmasq
2 - Configure dnsmasq to resolve .test domains to localhost via creating /etc/NetworkManager/dnsmasq.d/prax:
| require "benchmark" | |
| channel = Channel(Int32).new | |
| spawn do | |
| loop do | |
| channel.receive | |
| end | |
| end |
| require "benchmark" | |
| require "colorize" | |
| require "http" | |
| require "spec/dsl" | |
| class String | |
| private PRIME_RK = 2097169u32 | |
| def index_old(search : String, offset = 0) | |
| offset += size if offset < 0 |
| sysctl -w fs.file-max=12000500 | |
| sysctl -w fs.nr_open=20000500 | |
| ulimit -n 20000000 | |
| sysctl -w net.ipv4.tcp_mem='10000000 10000000 10000000' | |
| sysctl -w net.ipv4.tcp_rmem='1024 4096 16384' | |
| sysctl -w net.ipv4.tcp_wmem='1024 4096 16384' | |
| sysctl -w net.core.rmem_max=16384 | |
| sysctl -w net.core.wmem_max=16384 |
| struct Upload | |
| field : String | |
| data : IO::Delimited | |
| meta : HTTP::FormData::FileMetadata | |
| headers : HTTP::Headers | |
| end | |
| def parse_multipart(env) | |
| HTTP::FormData.parse(env.request) do |field, data, meta, headers| | |
| yield Upload.new field, data, meta, headers |
| lock '3.5.0' | |
| set :application, 'your-app' | |
| set :repo_url, 'https://github.com/your/app' | |
| set :deploy_to, '/home/deploy/apps/your-app/' | |
| namespace :deploy do | |
| after :updated, :build do | |
| on roles(:web) do | |
| execute "cd '#{release_path}' && shards install" |
| # Context is the environment which holds request/response specific | |
| # information such as params, content_type e.g | |
| class HTTP::Server | |
| class Context | |
| STORE = {} of String => Box | |
| def set(key, value) | |
| STORE[key] = {"object": Box.box(value), "type": typeof(value)} | |
| end |
| require "benchmark" | |
| Benchmark.bm do |x| | |
| $status_code = "200" | |
| $method = "GET" | |
| $path = "api/v1/users" | |
| x.report "Normal String" do | |
| 10000000.times do | |
| "|#{$status_code}| #{$method} #{$path}" |
| require "kemal" | |
| post "/json_params" do |env| | |
| like_objects = env.params.json["_json"].as Array | |
| like_objects.each do |likes| | |
| likes_hash = (likes as Hash(String, JSON::Type))["likes"] | |
| end | |
| end | |
| Kemal.run |
| require "kemal" | |
| post "/json_params" do |env| | |
| json = env.params.json["likes"].as Array | |
| # You can learn the type like this | |
| puts json.first.class | |
| first = json.first.as Hash(String, JSON::Type) | |
| puts first["id"] | |
| end |