Skip to content

Instantly share code, notes, and snippets.

View cyriltovena's full-sized avatar
🔥

Cyril Tovena cyriltovena

🔥
View GitHub Profile
@bboreham
bboreham / tree.go
Created January 4, 2023 11:01
Tournament Tree aka Loser Tree, in Go
// Loser tree, from https://en.wikipedia.org/wiki/K-way_merge_algorithm#Tournament_Tree
package loser
import (
"math"
)
// Ideally Ordered would be any int, float, etc., bit we need to have a maxVal too, so kludge it.
type Ordered interface{ ~uint64 }
@cyriltovena
cyriltovena / demo.md
Created April 21, 2020 19:48
Loki Webinar Demo

First deploy the demo app.

kubectl apply -f tns.yaml

Make sure tiller is installed in your cluster.

Add our chart repository

helm repo add loki https://grafana.github.io/loki/charts

@posener
posener / go-table-driven-tests-parallel.md
Last active April 30, 2024 20:34
Be Careful with Table Driven Tests and t.Parallel()

Be Careful with Table Driven Tests and t.Parallel()

We Gophers, love table-driven-tests, it makes our unittesting structured, and makes it easy to add different test cases with ease.

Let’s create our table driven test, for convenience, I chose to use t.Log as the test function. Notice that we don't have any assertion in this test, it is not needed to for the demonstration.

func TestTLog(t *testing.T) {
	t.Parallel()
.
├── books
│   ├── handlers.go
│   └── models.go
├── config
│   └── db.go
└── main.go
package main
import (
"net/http"
"database/sql"
"fmt"
"log"
"os"
)
@staltz
staltz / introrx.md
Last active July 6, 2024 08:47
The introduction to Reactive Programming you've been missing
@bradwilson
bradwilson / Cacheability.cs
Created January 23, 2014 20:53
Using chaining to create cached results in ASP.NET Web API v2
public enum Cacheability
{
NoCache,
Private,
Public,
}