Skip to content

Instantly share code, notes, and snippets.

View vdel26's full-sized avatar

Victor Delgado vdel26

View GitHub Profile
@vdel26
vdel26 / nginx.conf
Last active February 20, 2016 00:18
Bypass 3scale in case it is unreachable
http {
# add this near the top of the HTTP section
lua_shared_dict healthcheck 1m;
lua_socket_log_errors off;
# healthchecks are HTTP only
upstream threescale_healthcheck {
server su1.3scale.net:80;
}
@vdel26
vdel26 / logrotate
Created February 16, 2016 14:31
Logrotate configuration Openresty
/opt/openresty/nginx/logs/*.log {
compress
copytruncate
create 0644 root root
delaycompress
missingok
rotate 7
sharedscripts
postrotate
@vdel26
vdel26 / iterators.js
Last active February 2, 2016 16:58
ES5 vs ES6 Object iterator implementation
// ES5
function iterator (obj) {
var len = Object.keys(obj).length;
var i = 0;
var _it = {};
_it.next = function next () {
if (i < len) {
var key = Object.keys(obj)[i++];
return { value: [key, obj[key]], done: false };
}
@vdel26
vdel26 / matcher.lua
Last active January 12, 2016 14:12
Memoize function "get_matched_rule"
local function memoize(fn)
local t = {}
return function(m,h,p,r)
local x, y
local key = j({m,h,p,tostring(r)}, string.char(28))
if t[key] then
x, y = t[key][1], t[key][2]
else
x, y = fn(m,h,p,r)
t[key] = {x,y}
@vdel26
vdel26 / devops-swagger.json
Last active December 2, 2015 10:43
Devops Against Humanity Swagger definition
{
"swagger": "2.0",
"info": {
"version": "1.0.0",
"title": "Devops Against Humanity API",
"description": "Devops Against Humanity API"
},
"host": "devops-api-gateway.herokuapp.com",
"basePath": "/",
"schemes": [
@vdel26
vdel26 / BENCHMARK.md
Created October 16, 2015 09:15 — forked from montanaflynn/BENCHMARK.md
Kong Benchmark Setup

To reproduce Kong's benchmark please follow these instructions.

Create AWS Instances

Spin up three m3.medium EC2 ubuntu 14.04 instances with public DNS enabled and configure them for high network traffic by increasing these limits:

Added fs.file-max=80000 to /etc/sysctl.conf

Added the following lines to /etc/security/limits.conf

@vdel26
vdel26 / tools.md
Last active February 17, 2016 19:54
Useful tools when working with APIs
@vdel26
vdel26 / documentation.html.liquid
Last active August 29, 2015 14:25
Using an external Swagger spec in Active Docs 2.0
<h1>Documentation</h1>
<p>Use our live documentation to learn about Hello World API</p>
<!--
Even if you are pulling from an external spec you need to specify a service here.
You can just create an empty spec and replace SPEC_NAME by the system_name of that
spec in 3scale.
-->
{% active_docs version: "2.0" service: "SPEC_NAME" %}
@vdel26
vdel26 / errors.lua
Last active August 29, 2015 14:21
errors.lua
local errors = {}
local AUTH_FAILED_STATUS = 403
local AUTH_FAILED_HEADERS = 'text/plain; charset=us-ascii'
local AUTH_FAILED_MESSAGE = 'Authentication failed'
local AUTH_MISSING_STATUS = 403
local AUTH_MISSING_HEADERS = 'text/plain; charset=us-ascii'
local AUTH_MISSING_MESSAGE = 'Authentication parameters missing'
@vdel26
vdel26 / Intertial-rotating-animation.markdown
Created April 21, 2015 23:02
Intertial rotating animation