Skip to content

Instantly share code, notes, and snippets.

View costela's full-sized avatar
🦥
moving slow and still breaking stuff

Leo Antunes costela

🦥
moving slow and still breaking stuff
View GitHub Profile
func BenchmarkServeContent(b *testing.B) {
type readSeekWriterTo interface {
io.ReadSeeker
io.WriterTo
}
content, err := os.ReadFile("../../testdata/Isaac.Newton-Opticks.txt")
if err != nil {
b.Fatalf("could not open source file: %v", err)
}
@costela
costela / test_xxhash_distribution.go
Created June 8, 2021 06:56
test xxhash distribution
package main
import (
"bufio"
"fmt"
"math"
"os"
"github.com/cespare/xxhash"
"gonum.org/v1/gonum/floats"
@costela
costela / discussion_go_issue_16100.go
Created March 30, 2021 10:45
counter-example for the duscission in golang/go#16100
package main
import (
"context"
"log"
"net/http"
"sync/atomic"
"time"
)
@costela
costela / auto_search_vector_field.py
Created October 28, 2020 15:08
Self-updating search vector field using postgres 12 "generated" column feature
from django.contrib.postgres.search import SearchVectorField
from django.db.models.fields import NOT_PROVIDED
class AutoSearchVectorField(SearchVectorField):
def __init__(self, language_field: str, source_field_weights: dict, *args, **kwargs) -> None:
self.language_field = language_field
self.source_field_weights = source_field_weights
kwargs["editable"] = False

Keybase proof

I hereby claim:

  • I am costela on github.
  • I am costela (https://keybase.io/costela) on keybase.
  • I have a public key whose fingerprint is E0D8 88C9 518B 7DE7 2331 6D93 D6CE 13EE 3535 08BF

To claim this, I am signing this object: