Skip to content

Instantly share code, notes, and snippets.

View viniciusjssouza's full-sized avatar

Vinícius Souza viniciusjssouza

View GitHub Profile
@viniciusjssouza
viniciusjssouza / idea.properties
Last active April 8, 2024 20:40
u idea properties
# Use ${idea.home.path} macro to specify location relative to IDE installation home.
# Use ${xxx} where xxx is any Java property (including defined in previous lines of this file) to refer to its value.
# Note for Windows users: please make sure you're using forward slashes: C:/dir1/dir2.
#---------------------------------------------------------------------
# Uncomment this option if you want to customize a path to the settings directory.
#---------------------------------------------------------------------
# idea.config.path=${user.home}/.GoLand/config
#---------------------------------------------------------------------
@viniciusjssouza
viniciusjssouza / goland64.vmoptions
Last active April 8, 2024 20:40
u Goland config
######## BEGIN IDE OPTIONS ########
# Add additional options outside this section as they will be overwritten on every IDE startup #
# Select the Java Server VM.
-server
# Set default just-in-time compiled code cache size.
-XX:ReservedCodeCacheSize=768m
# Mark softly-reachable objects' lifespan per megabyte of maximum memory heap size.
@viniciusjssouza
viniciusjssouza / redis-del.lua
Last active July 22, 2023 23:57
Delete redis keys by pattern
# replace "REPLACE_ME_IAM_KEY_PATTERN" with your key pattern that you want to delete local
# to paste this in a redis-cli session, remove the new lines and put everything in an `EVAL "everythin here" 0` command
local cursor='0';
local count = 0;
repeat
local scanResult = redis.call('SCAN', cursor, 'MATCH', 'somekey.*', 'COUNT', 100);
local keys = scanResult[2];
for i = 1, #keys
do
local key = keys[i];
@viniciusjssouza
viniciusjssouza / docker-exec-output
Created December 27, 2021 20:55
Redirect docker exec output to the original container stdout
docker exec -it <container id> sh -c "ls -alh > /proc/1/fd/1"
@viniciusjssouza
viniciusjssouza / clone.sh
Created March 5, 2021 13:37
Clone all repos of an organization
curl -u $USERNAME:$PASSWORD -s https://api.github.com/orgs/$ORG/repos?per_page=200 | jq -rc '.[] | {ssh_url} | .ssh_url' | parallel -n 1 git clone {}
@viniciusjssouza
viniciusjssouza / gist:1956bbc4deb41689007a3394596fb42d
Created November 26, 2020 22:27
Dump mysql 5 DB using mysqldump 8 (no data)
mysqldump db --skip-disable-keys --skip-add-locks --skip-add-drop-table --skip-lock-tables --result-file="output.sql" --skip-extended-insert --no-data --skip-create-options --column-statistics=0
@viniciusjssouza
viniciusjssouza / code-reviews.md
Created July 4, 2020 14:58
Code review - What to look for

Code Reviews

Functionality (high)

  • Do the code provide the desired functionality correctly? Are there any possible bugs?

Tests (high)

  • Does the code have tests for all the "complex" logics in it?
  • Are the tests maintainable and well designed?
  • Do they respect the test pyramid to avoid taking so much time to run?
@viniciusjssouza
viniciusjssouza / amqp.md
Created June 30, 2020 20:49
AMQP model

RabbitMQ (AMQP) model

AMQP

Protocolo aberto da camada de aplicação para comunicação entre clientes e brokers de mensagens. Executa sobre o TCP, com payloads binários.

Entidades envolvidas

  • publisher: processo que publica mensagens;
  • exchange: "mailboxes" onde as mensagens são publicadas;
  • queue: fila de destino das mensagens;
@viniciusjssouza
viniciusjssouza / keep-alive.ts
Created May 23, 2020 20:56
Keep-Alive connection experiment
import { HttpsAgent } from 'agentkeepalive';
import Axios, { AxiosInstance } from 'axios';
import http from 'http';
const KEEP_ALIVE_TIMEOUT = 10_000;
const keepAliveAgent = new HttpsAgent({
maxSockets: 100,
keepAlive: true,
maxFreeSockets: 10,
@viniciusjssouza
viniciusjssouza / broker-auth.md
Created April 29, 2020 14:31
Broken Authentication

Broken Authentication

O que é?

  • Formas de se obter as credenciais de usuários e se passar por eles;
  • Segunda posição no rank de riscos de 2017 da OWASP (most critical security risks to web applications)

Exemplos

Ameaça 1 - Credential stuffing