Skip to content

Instantly share code, notes, and snippets.

View chaudum's full-sized avatar
🏠
Working from home

Christian Haudum chaudum

🏠
Working from home
View GitHub Profile
@chaudum
chaudum / bloomblock.txt
Last active September 23, 2024 13:53
Binary format of Loki bloom blocks
# Binary format
## Tar Archive
+--------------------------------------------------------------------------------------------------------+
| Compression (optional) |
| +----------------------------------------------------------------------------------------------------+ |
| | Tar Archive | |
| | +------------------------------------------------------------------------------------------------+ | |
| | | `series` file | | |
@chaudum
chaudum / benchmark.txt
Created March 30, 2023 07:42
int map vs *int map
$ gotest -v ./ -bench=Benchmark -test.run=^$ -benchtime=100000000x
goos: linux
goarch: amd64
pkg: maptest
cpu: 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz
BenchmarkIntMap
BenchmarkIntMap-8 100000000 55.85 ns/op 0 B/op 0 allocs/op
BenchmarkIntPointerMap
BenchmarkIntPointerMap-8 100000000 24.43 ns/op 0 B/op 0 allocs/op
package main
import (
"context"
"fmt"
"os"
"time"
"github.com/grafana/loki/pkg/logproto"
"github.com/weaveworks/common/user"
#!/usr/bin/env bash
mpc idle > /dev/null
TRACK="$(mpc -f '%title%' current)"
# long version
if [ ${#TRACK} -gt 60 ]; then
echo "${TRACK:0:57}..."
else
echo $TRACK
@chaudum
chaudum / prometheus.vim
Created January 10, 2022 19:55
Prometheus metrics syntax for Vi/Vim/NeoVim
" Vim syntax file
" Language: Prometheus Metrics
" Maintainer: Christian Haudum
" Last Revision: 10 January 2022
"
if exists("b:current_syntax")
finish
endif
#!/usr/bin/env python3
import argparse
import json
import sys
import re
from typing import Dict, List, Tuple
def parse_args():
# pip install wetterdienst==0.9.0 crate[sqlalchemy]
# pip install cr8
#
# Usage:
# cr8 run-crate 4.2.x
# python example.py
from sqlalchemy import create_engine
from wetterdienst import DWDObservationData
from wetterdienst import Parameter, PeriodType, TimeResolution
#!/usr/bin/env python3
#
# Brain Dump
#
# Requirements:
# pip install aiofiles aiopg
#
# Usage:
# python dump.py
import abc
class Base(abc.ABC):
@property
@abc.abstractmethod
def prop(self):
...
class Impl(Base):

Keybase proof

I hereby claim:

  • I am chaudum on github.
  • I am chaudum (https://keybase.io/chaudum) on keybase.
  • I have a public key whose fingerprint is EBCE F684 BA35 529C B936 E65B 9EBD BC4E EBD1 576F

To claim this, I am signing this object: