Skip to content

Instantly share code, notes, and snippets.

View ggbellotti's full-sized avatar

Guilherme G. Bellotti ggbellotti

View GitHub Profile
@ggbellotti
ggbellotti / aws-bootstrap.sh
Created May 21, 2026 00:00
AWS EC2 bootstrap for crowpay perf test
#!/bin/bash
# Bootstrap: AWS EC2 Ubuntu 24.04 → simular starly local com crowpay-api
# Uso: GH_TOKEN=<pat> bash aws-bootstrap.sh
set -e
if [ -z "$GH_TOKEN" ]; then
echo "ERROR: precisa GH_TOKEN=<github personal access token com scope 'repo'>"
exit 1
fi
@ggbellotti
ggbellotti / run-battery.sh
Created May 20, 2026 23:10
k6 battery against crowpay starly
#!/bin/bash
export SK=sk_test_xHNopk5u1rgnSZdCKCjp8xu1CBQI2HkY
export OFFER_ID=WG87
export BASE_URL=https://api.crowpay.black
export SK_TEST_KEY=$SK
mkdir -p ~/results
echo "=== Preflight warm x3 ==="
for i in 1 2 3; do
curl -sS -w "warm-$i: HTTP=%{http_code} t=%{time_total}s\n" -o /dev/null $BASE_URL/v1/transactions -X POST -H "Authorization: Bearer $SK" -H "Content-Type: application/json" -H "Idempotency-Key: pfwarm-$i-$RANDOM" -d "{\"offer_id\":\"$OFFER_ID\",\"buyer\":{\"name\":\"PF\",\"email\":\"p@f.test\",\"cpf\":\"03953676031\",\"phone\":\"+5511999999999\"},\"payment_method\":\"pix\"}"
done
@ggbellotti
ggbellotti / find-knee.js
Created May 20, 2026 22:53
k6 find-knee for crowpay perf test
import { check } from "k6";
import http from "k6/http";
/**
* tests/load/scenarios/find-knee.js — varredura de capacidade (J-DIAGNOSIS round 11+).
*
* Roda uma janela de carga SUSTENTADA em uma TAXA FIXA configurável via env
* (`RATE`), por uma duração configurável (`DURATION`, default 30s). Não é o
* gate D-07 (esse fica em `simulator.js`) — esse script existe pra mapear a
* curva latência×throughput e achar a taxa máxima sob o SLO p99<300ms.