Skip to content

Instantly share code, notes, and snippets.

View alexrios's full-sized avatar
🦎
Zigging around

Alex Rios alexrios

🦎
Zigging around
View GitHub Profile
@alexrios
alexrios / regras-do-encontro.md
Last active October 18, 2022 21:25
System Design BR - Discussão das regras do encontro

Regras do encontro

Concordar em discordar.

Seja educado! Não existe uma maneira única de experimentar ou interpretar um conteúdo. Na verdade, opiniões divergentes são boas e bem vindas.

Seja gentil, mas firme.

Insistiremos para que o tempo de discussão seja limitado ao conteúdo.

Não monopolize a conversa

Nunca é fácil. “Vamos ouvir alguns outros” é uma abordagem. Podemos ter uma estratégia sobre só uma pessoa falar, e as pessoas que querem falar devem "levantar a mão".

@alexrios
alexrios / syllabus.md
Last active June 27, 2021 09:40
Go Concorrente

Go Concorrente

Intro

  • Concorrência
  • Scheduler
    • internals (semantics)
  • Deadlocks, Livelocks e starvation
  • O que é CSP?

Nivel 1

@alexrios
alexrios / main.go
Created June 9, 2021 10:30
Sync Package - Wait Group
package main
import (
"fmt"
"sync"
"time"
)
func main() {
wg := sync.WaitGroup{}
@alexrios
alexrios / TickLeakyBucket.go
Last active May 29, 2021 21:08
Ticker Based Leaky Bucket
package main
import (
"errors"
"fmt"
"sync"
"time"
)
var ErrBucketReachedCap = errors.New("bucket reached its max capacity")
@alexrios
alexrios / starred-until-2020.json
Created January 12, 2021 05:09
All projects starred until 2020
{
"ulr": "https://github.com/ssrathi/go-attr"
}
{
"ulr": "https://github.com/m7shapan/querycsv"
}
{
"ulr": "https://github.com/hotwired/turbo"
}
{
@alexrios
alexrios / k8s-jumpbox.sh
Created December 10, 2020 01:40
Tuneling RDS through K8S
#!/usr/bin/env bash
set -e
TEMP_POD_NAME=postgres-jump-server
LOCAL_PORT=5433
REMOTE_HOST=<postgres-host>
REMOTE_PORT=5432
function cleanup {
@alexrios
alexrios / presign-url.go
Created November 27, 2020 18:17
Creating pre sign URL AWS S3
package main
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
"log"
"time"
)
@alexrios
alexrios / pglock.go
Created November 13, 2020 02:26
Postgres advisory locks with Go
package database
import (
"context"
"errors"
"fmt"
)
import "github.com/jackc/pgx/v4"
// mutex is an implementation of the Mutexer interface
@alexrios
alexrios / utf-8-test.txt
Created November 3, 2020 12:42
UTF-8 stress test (thanks Markus Kuhn)
UTF-8 decoder capability and stress test
----------------------------------------
Markus Kuhn <http://www.cl.cam.ac.uk/~mgk25/> - 2015-08-28 - CC BY 4.0
This test file can help you examine, how your UTF-8 decoder handles
various types of correct, malformed, or otherwise interesting UTF-8
sequences. This file is not meant to be a conformance test. It does
not prescribe any particular outcome. Therefore, there is no way to
"pass" or "fail" this test file, even though the text does suggest a
@alexrios
alexrios / main.go
Created September 13, 2020 01:28
Rate limiting with redis
package main
import (
"context"
"fmt"
"log"
"time"
"github.com/go-redis/redis/v8"
"github.com/go-redis/redis_rate/v9"