$ wrk -t12 -c400 -d2s http://127.0.0.1:8080
Running 2s test @ http://127.0.0.1:8080
12 threads and 400 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 7.71ms 3.16ms 23.05ms 69.17%
Req/Sec 3.44k 1.98k 7.80k 58.22%
63697 requests in 2.00s, 17.86MB read
This file contains hidden or 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
| nginx/ | |
| !nginx/.gitkeep | |
| !nginx/logs/.gitkeep | |
| src/ | |
| tmp/ |
This file contains hidden or 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
| --[[ | |
| LuaJIT-cURL | |
| Lucien Greathouse | |
| LuaJIT FFI cURL binding aimed at cURL version 7.38.0. | |
| Copyright (c) 2014 lucien Greathouse | |
| This software is provided 'as-is', without any express | |
| or implied warranty. In no event will the authors be held | |
| liable for any damages arising from the use of this software. |
This file contains hidden or 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
| -- Debian packages nginx-extras, lua-zlib required | |
| ngx.ctx.max_chunk_size = tonumber(ngx.var.max_chunk_size) | |
| ngx.ctx.max_body_size = tonumber(ngx.var.max_body_size) | |
| function create_error_response (code, description) | |
| local message = string.format('{"status":400,"statusReason":"Bad Request","code":%d,"exception":"","description":"%s","message":"HTTP 400 Bad Request"}', code, description) | |
| ngx.status = ngx.HTTP_BAD_REQUEST | |
| ngx.header.content_type = "application/json" | |
| ngx.say(message) |
This file contains hidden or 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
| var p1={ | |
| x:0, | |
| y:0 | |
| }; | |
| var p2={ | |
| x:0, | |
| y:1 | |
| }; |
This file contains hidden or 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
| #!/bin/sh | |
| # AUTHOR | |
| # DANIEL E. GILLESPIE (2016) | |
| # https://github.com/dantheman213 | |
| # DESCRIPTION | |
| # Export your app's table schemas and stored functions from a PostgreSQL | |
| # database into individual *.sql files for easy management and source control. |
This file contains hidden or 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
| <?php | |
| use Symfony\Component\Process\PhpExecutableFinder; | |
| require_once __DIR__.'/../vendor/autoload.php'; | |
| $phpBin = (new PhpExecutableFinder)->find(); | |
| if (false === $phpBin) { | |
| throw new \LogicException('Php executable could not be found'); | |
| } |
This file contains hidden or 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
| -- a quick LUA access script for nginx to check IP addresses match an | |
| -- `ip_whitelist` set in Redis, and if no match is found send a HTTP | |
| -- 403 response or just a custom json instead. | |
| -- | |
| -- allows for a common whitelist to be shared between a bunch of nginx | |
| -- web servers using a remote redis instance. lookups are cached for a | |
| -- configurable period of time. | |
| -- | |
| -- white an ip: | |
| -- redis-cli SADD ip_whitelist 10.1.1.1 |
This file contains hidden or 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
| type Dispatcher struct { | |
| // A pool of workers channels that are registered with the dispatcher | |
| WorkerPool chan chan Job | |
| } | |
| func NewDispatcher(maxWorkers int) *Dispatcher { | |
| pool := make(chan chan Job, maxWorkers) | |
| return &Dispatcher{WorkerPool: pool} | |
| } |
This file contains hidden or 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
| package main | |
| import ( | |
| "database/sql" | |
| "log" | |
| ) | |
| func main() { | |
| db, err := sql.Open("VENDOR_HERE", "YOUR_DSN_HERE") | |
| handleError(err) |