Skip to content

Instantly share code, notes, and snippets.

View narqo's full-sized avatar
⛅
Berlin, +15°

Vladimir Varankin narqo

⛅
Berlin, +15°
View GitHub Profile
@narqo
narqo / prom-tsdb-db_test.go
Last active September 14, 2026 11:13
Test case to reproduce https://github.com/prometheus/prometheus/issues/19696 (tsdb: OOO blocks contain dead symbols)
// TestOOOCompactionAddsDeadSymbols verifies that compacting the OOO head
// produces a block whose symbol table contains symbols from in-order-only
// series that have no postings in the block.
func TestOOOCompactionAddsDeadSymbols(t *testing.T) {
ctx := t.Context()
opts := DefaultOptions()
opts.OutOfOrderCapMax = 30
opts.OutOfOrderTimeWindow = 300 * time.Minute.Milliseconds()
db := newTestDB(t, withOpts(opts))
# cloud-config
hostname: pi-4
manage_etc_hosts: true
write_files:
- content: |
network:
ethernets:
eth0:
@narqo
narqo / main.go
Last active July 27, 2020 19:56
A boilerplate for a new Go application
package main
import (
"context"
"flag"
"log"
"os"
"os/signal"
"syscall"
)
// pkg/svc
type SettingsService struct {
db DB // DB is an interface
}
func (svc *SettingsService) IsProCustomer(token Token) bool {
v := svc.db.GetProCustomer(makeProPKFromToken(token))
return v == "1"
}
@narqo
narqo / aerospike-README.md
Last active February 10, 2020 21:05
Aerospike Server systemd configuration @ rpi (Ubuntu 19.10, aarch64)
package main
import (
"net"
"net/http"
)
const addr = ":8080"
func main() {
@narqo
narqo / one_value_key_intern_test.go
Last active September 28, 2018 13:32
An example of strings interning. See the discussion https://github.com/golang/go/issues/5160
package main
import (
"sync"
)
type oneValueK struct {
k1, k2, k3 string
}
@narqo
narqo / ids.go
Last active September 21, 2018 11:23
package id
type IdType int
const (
IdTypeUnknown IdType = -1
IdType1 IdType = iota
IdType2
)