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 / main.go
Created August 20, 2020 21:12
Formatting json.Marshall() using time.Time
package main
import (
"encoding/json"
"fmt"
"time"
)
type JSONTime time.Time
@alexrios
alexrios / main.go
Created August 20, 2020 17:48
GCP PubSub ~emulator~ client.
package main
import (
"context"
"encoding/json"
"fmt"
"log"
"os"
"time"
@alexrios
alexrios / crypto-wrong-answers.md
Created June 24, 2020 10:36 — forked from paragonie-scott/crypto-wrong-answers.md
An Open Letter to Developers Everywhere (About Cryptography)
@alexrios
alexrios / pipeline2.kt
Created January 12, 2020 21:27
Using pipeline pattern with Kotlin channels
package app
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.channels.ReceiveChannel
import kotlinx.coroutines.channels.consumeEach
import kotlinx.coroutines.channels.produce
import kotlinx.coroutines.runBlocking
fun main() = runBlocking {
@alexrios
alexrios / pipeline.kt
Created January 12, 2020 21:05
Using pipeline pattern with Kotlin channels
package app
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.channels.consumeEach
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
fun main() = runBlocking {
@alexrios
alexrios / repo-privado-gomod.md
Created December 21, 2019 03:46
Usando repositorios privados com Go Modules

1 - Configurar GIT (~/.gitconfig)

[url "ssh://git@github.com/"]
	insteadOf = https://github.com/

2 - Evitar a checagem do SUMDB

go env -w GONOSUMDB="github.com/<org>/<project>"
package main
import (
"fmt"
"time"
)
func BatchStrings(values <-chan string, maxItems int, maxTimeout time.Duration) chan []string {
batches := make(chan []string)
@alexrios
alexrios / arch-QC35-ii.txt
Last active July 13, 2021 13:50
In order to work the Bose QC35 II Headset Bluetooth do the following
- sudo pacman -Syu pulseaudio-alsa pulseaudio-bluetooth bluez bluez-libs bluez-utils
- turn off bluetooth from your computer
- sudo btmgmt ssp of
- gpasswd -a $USER lp
- pin is always `0000`
FAQ
1 - I only hear the "call from" message
Confirm that by switching the mode from HSP/HFP to `A2DP Sink` solve the problem.
- systemctl restart bluetooth
@alexrios
alexrios / generate_test_files.sh
Created September 14, 2019 18:10
with openssl
#!/usr/bin/zsh
# 100 bytes
totalBytes=100
for i in $totalBytes
do
time openssl rand -out test_file_$i.txt $i
done
@alexrios
alexrios / stream-to-S3.go
Created September 5, 2019 13:46
stream 'multipart form data' to S3 bucket
func MultipartUploadHandler(c *gin.Context) {
multipart, err := c.Request.MultipartReader()
if err != nil {
log.Fatalln("Failed to create MultipartReader", err)
}
for {
mimePart, err := multipart.NextPart()
if err == io.EOF {
break