Skip to content

Instantly share code, notes, and snippets.

View arantesxyz's full-sized avatar
♥️
Coding your dreams

Gustavo Arantes arantesxyz

♥️
Coding your dreams
View GitHub Profile
@arantesxyz
arantesxyz / createadmin.sh
Created February 10, 2025 22:39
Little bash script to create sudoers and add ssh keys on a server
#!/bin/bash
USER="$1"
GH_USERNAME="$2"
usage() {
echo "Usage: $0 <username> <GitHub username for SSH keys>"
exit 1
}
@arantesxyz
arantesxyz / bcb-pix-e2e.go
Last active June 18, 2025 22:26
BCB PIX End To End Identification Generation in Golang.
package helpers
import (
"fmt"
"math/rand"
"time"
"unsafe"
)
const letterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789"
@arantesxyz
arantesxyz / cid.go
Created November 24, 2023 19:44
Brazil's PIX CID Calculation in Golang
package main
import (
"fmt"
"strings"
"crypto/hmac"
"crypto/sha256"
"encoding/hex"
)
@arantesxyz
arantesxyz / client.go
Created November 23, 2023 18:34
Golang FastHTTP Wrapper.
package httpclient
import (
"time"
"github.com/valyala/fasthttp"
)
const (
InstanceReadTimeout time.Duration = 5 * time.Second
@arantesxyz
arantesxyz / vsync-pix.js
Created November 13, 2023 20:40
High level example of how to calculate the PIX DICT VSYNC from a CID file
const cids = [] // from the cid file, each line should be a string inside the array
function run() {
let vsync
for (const i in cids) {
const cid = cids[i]
if (i == 0) {
vsync = Buffer.from(cid, 'hex')
continue
@arantesxyz
arantesxyz / backend.md
Last active September 5, 2023 16:12
Desafio conceitos em golang

Desafio de conceitos em GoLang

Deve ser entregue um link para um repositório público no Github com o código do desafio.

O desafio consiste no desenvolvimento de duas aplicações que devem seguir os seguintes requisitos obrigatórios:

  • Desenvolvidas em Golang versão 1.21 ou superior.
  • Test Driven Development (TDD); Não é necessário testar o HTTP ou GRPC, apenas o dominio da aplicação.
  • Arquitetura hexagonal (DDD); Utilizar os conceitos para a estrutura interna dos projetos.
  • Interação com Postgres ou CockroachDB.
  • Conter um readme explicando como executar as aplicações.
@arantesxyz
arantesxyz / telemeter.go
Created August 15, 2023 00:20
OpenTelemetry golang test
package telemetry
import (
"log"
"log/slog"
"os"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/exporters/stdout/stdouttrace"
"go.opentelemetry.io/otel/propagation"
@arantesxyz
arantesxyz / SqsSender.js
Created January 29, 2023 01:23
NodeJs AWS SQS Sender
const AWS = require("aws-sdk");
AWS.config.update({
region: process.env.AWS_REGION,
});
class SQSSender {
constructor() {
this.provider = new AWS.SQS()
}
@arantesxyz
arantesxyz / SnsSender.js
Created January 29, 2023 01:11
NodeJs AWS SNS Sender
const AWS = require("aws-sdk");
AWS.config.update({
region: process.env.AWS_REGION,
});
class SNSSender {
constructor() {
this.provider = new AWS.SNS();
}
@arantesxyz
arantesxyz / test.js
Created November 17, 2022 21:35
mq rpc pattern test
const REPLY_QUEUE = 'amq.rabbitmq.reply-to';
const createClient = (settings) => amqp.connect(settings.url, settings.socketOptions)
.then((conn) => conn.createChannel())
.then((channel) => {
// create an event emitter where rpc responses will be published by correlationId
channel.responseEmitter = new EventEmitter();
channel.responseEmitter.setMaxListeners(0);
channel.consume(REPLY_QUEUE,
(msg) => channel.responseEmitter.emit(msg.properties.correlationId, msg.content),