Skip to content

Instantly share code, notes, and snippets.

View gustavosoares's full-sized avatar

Gustavo Soares Souza gustavosoares

  • Vend by Lightspeed
  • Auckland, New Zealand
View GitHub Profile
@gustavosoares
gustavosoares / http-benchmark.md
Created March 22, 2020 06:22 — forked from denji/http-benchmark.md
HTTP(S) Benchmark Tools / Toolkit for testing/debugging HTTP(S) and restAPI (RESTful)
@gustavosoares
gustavosoares / latency.txt
Created March 8, 2020 10:13 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@gustavosoares
gustavosoares / sysctl.conf
Created March 2, 2020 19:40 — forked from techgaun/sysctl.conf
Sysctl configuration for high performance
### KERNEL TUNING ###
# Increase size of file handles and inode cache
fs.file-max = 2097152
# Do less swapping
vm.swappiness = 10
vm.dirty_ratio = 60
vm.dirty_background_ratio = 2
@gustavosoares
gustavosoares / dep.md
Created September 6, 2018 21:31 — forked from subfuzion/dep.md
Concise guide to golang/dep

Overview

This gist is based on the information available at golang/dep, only slightly more terse and annotated with a few notes and links primarily for my own personal benefit. It's public in case this information is helpful to anyone else as well.

I initially advocated Glide for my team and then, more recently, vndr. I've also taken the approach of exerting direct control over what goes into vendor/ in my Dockerfiles, and also work from isolated GOPATH environments on my system per project to ensure that dependencies are explicitly found under vendor/.

At the end of the day, vendoring (and committing vendor/) is about being in control of your dependencies and being able to achieve reproducible builds. While you can achieve this manually, things that are nice to have in a vendoring tool include:

@gustavosoares
gustavosoares / converter-cli.js
Created July 17, 2018 02:43 — forked from sorjef/converter-cli.js
Script to convert AWS Data Pipeline template to Cloudformation template with a sample Terraform module
const fs = require('fs');
const Converter = require('./converter.js');
const options = {
name: process.argv[3],
description: process.argv[4],
activate: process.argv[5],
};
const converter = new Converter(JSON.parse(fs.readFileSync(process.argv[2])), options);
@gustavosoares
gustavosoares / PackerPolicy.json
Created March 9, 2017 20:37 — forked from MattSurabian/PackerPolicy.json
Minimum IAM policy required by AWS for Packer to do its thing. https://github.com/mitchellh/packer Permissions are broken out by API functionality and a resource array has been defined with a wild card for each group. For tighter security resource level permissions can be applied per this documentation: http://aws.typepad.com/aws/2013/07/resourc…
{
"Statement": [
{
"Sid": "PackerSecurityGroupAccess",
"Action": [
"ec2:CreateSecurityGroup",
"ec2:DeleteSecurityGroup",
"ec2:DescribeSecurityGroups",
"ec2:AuthorizeSecurityGroupIngress",
"ec2:RevokeSecurityGroupIngress"
@gustavosoares
gustavosoares / iterm2.md
Created February 8, 2017 06:40
iterm2 cheatsheet

Tabs and Windows

Function Shortcut
Previous Tab + Left Arrow
Next Tab + Right Arrow
Go to Tab + Number
Go to Window + Option + Number
Go to Split Pane by Direction + Option + Arrow
Go to Split Pane by Order of Use + ] , + [
@gustavosoares
gustavosoares / Capybara.md
Created November 11, 2016 03:40 — forked from tomas-stefano/Capybara.md
Capybara cheatsheet

Capybara Actions

# Anchor
click_link 'Save'

# Button
click_button 'awesome'

# Both above
@gustavosoares
gustavosoares / gist:2008272
Created March 9, 2012 19:39
script python mongo stress
import os
import sys
import datetime
import time
import random
import pymongo
ACCESS_SAMPLE = '127.0.0.1 - - [29/Apr/2011:18:10:50 -0300] foreman "POST /reports/create?format=yml HTTP/1.1" 200 15 "-" "-" "-" - 0'
ERROR_SAMPLE = '[Tue May 03 14:51:56 2011] [error] [client 0.0.0.0] client denied by server configuration: /mnt/puppet/conf/rack'
@gustavosoares
gustavosoares / gist:1712882
Created January 31, 2012 21:00
lognit gc stats after new size tuning
....
INFO | jvm 1 | 2012/01/31 18:58:19 | [GC
INFO | jvm 1 | 2012/01/31 18:58:20 | [PSYoungGen: 739316K->18718K(755136K)] 3844179K->3123653K(4163008K), 0.0178820 secs] [Times: user=0.28 sys=0.00, real=0.02 secs]
INFO | jvm 1 | 2012/01/31 18:58:21 | [GC [PSYoungGen: 742558K->27171K(753024K)] 3847493K->3132202K(4160896K), 0.0211990 secs] [Times: user=0.35 sys=0.00, real=0.02 secs]
INFO | jvm 1 | 2012/01/31 18:58:22 | [GC [PSYoungGen: 749475K->21365K(754368K)] 3854506K->3126508K(4162240K), 0.0132120 secs] [Times: user=0.22 sys=0.00, real=0.01 secs]
INFO | jvm 1 | 2012/01/31 18:58:23 | [GC
INFO | jvm 1 | 2012/01/31 18:58:23 | [PSYoungGen: 743669K->22278K(756096K)] 3848812K->3127533K(4163968K), 0.0214980 secs] [Times: user=0.34 sys=0.00, real=0.02 secs]
INFO | jvm 1 | 2012/01/31 18:58:24 | [GC [PSYoungGen: 747334K->30321K(755392K)] 3852589K->3135743K(4163264K), 0.0174970 secs] [Times: user=0.29 sys=0.00, real=0.01 secs]
....