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 / 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
@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
#!/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:

@chaudum
chaudum / Berlin.json
Last active July 2, 2019 11:09
12 districts of Berlin, JSON object per line so it can be easily imported into Crate.IO
{"geometry": {"type": "MultiPolygon", "coordinates": [[[[13.1865954, 52.489298], [13.1875725, 52.491232], [13.1895918, 52.4929407], [13.1894319, 52.4949858], [13.1898203, 52.4975432], [13.1917093, 52.4986912], [13.1952155, 52.4997414], [13.1981897, 52.499792], [13.1990817, 52.499888], [13.2051704, 52.5013633], [13.2097274, 52.5029098], [13.2093457, 52.5043024], [13.2087621, 52.5050455], [13.2093301, 52.5058751], [13.2104999, 52.5072015], [13.2110126, 52.5085223], [13.2118605, 52.509347], [13.2120085, 52.5093064], [13.2123221, 52.5092443], [13.2124329, 52.5092366], [13.2127884, 52.5091866], [13.2128017, 52.5092091], [13.2130117, 52.5091619], [13.2132311, 52.5090972], [13.2139232, 52.5090727], [13.2139789, 52.5090954], [13.2140851, 52.509101], [13.2141573, 52.5091212], [13.2142409, 52.5091502], [13.2144632, 52.5092745], [13.2145174, 52.509327], [13.2145456, 52.5093678], [13.2155819, 52.5091595], [13.2156956, 52.5093652], [13.2149809, 52.5095096], [13.2151045, 52.5096504], [13.2155245, 52.5102731], [13.2158675,