Skip to content

Instantly share code, notes, and snippets.

View metalmatze's full-sized avatar
🤘

Matthias Loibl metalmatze

🤘
View GitHub Profile
@metalmatze
metalmatze / numbericbuilder-value.diff
Created May 22, 2023 15:54
Add `Value(i int)` to `numericbuilder.gen.go.tmpl`
diff --git a/go/arrow/array/dictionary.go b/go/arrow/array/dictionary.go
index 3a46774e5..f796a4f69 100644
--- a/go/arrow/array/numericbuilder.gen.go
+++ b/go/arrow/array/numericbuilder.gen.go
@@ -143,6 +143,10 @@ func (b *Int64Builder) Resize(n int) {
}
}
+func (b *Int64Builder) Value(i int) int64 {
+ return b.rawData[i]
@metalmatze
metalmatze / receiver_test.go
Created March 12, 2021 16:38
Benchmarking the Thanos Receiver Handler for a memory leak
// Trying to reproduce https://github.com/thanos-io/thanos/issues/3726
// Add this somewhere (at the end) in the pkg/receive/handler_test.go
// Run go test -bench=BenchmarkHandler ./pkg/receive
func BenchmarkHandler(b *testing.B) {
wreq1 := &prompb.WriteRequest{
Timeseries: []prompb.TimeSeries{
{
Labels: []labelpb.ZLabel{{Name: "foo", Value: "bar"}},
Samples: []prompb.Sample{
@metalmatze
metalmatze / nginx-ingress-red-dashboard.json
Created April 25, 2020 14:44
NGINX Ingress RED dashboard
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
@metalmatze
metalmatze / keybase.md
Last active April 11, 2020 13:16
keybase.md

Keybase proof

I hereby claim:

  • I am metalmatze on github.
  • I am metalmatze (https://keybase.io/metalmatze) on keybase.
  • I have a public key ASBSYKeab6u3KX9MtcavrSSuo7MCJR7wOm6wCaCNVokkgAo

To claim this, I am signing this object:

@metalmatze
metalmatze / devsummit.md
Last active December 4, 2019 17:00
Prometheus 2019 Dev Summit 2 Summary
@metalmatze
metalmatze / .gitignore
Last active March 6, 2019 00:10
kube-prometheus-demo
.demo-last-step
@metalmatze
metalmatze / prometheus.diff
Last active January 16, 2019 16:21
Changing Prometheus in Custom Resource with Prometheus Operator
apiVersion: monitoring.coreos.com/v1
kind: Prometheus
metadata:
labels:
prometheus: k8s
name: k8s
namespace: monitoring
spec:
alerting:
alertmanagers:
@metalmatze
metalmatze / http.go
Created June 29, 2018 22:39
Run Go as WebAssembly
package main
import (
"fmt"
"net/http"
)
// https://github.com/golang/go/tree/master/misc/wasm
func main() {
@metalmatze
metalmatze / php.php
Created March 21, 2017 19:35
PHP...
<?php
$a = array(1 => 'a', true => 'b', 'c', "2" => 'd', 2 => "e", 0x1 => "g", 2e0 => "h");
echo(count($a));
var_dump($a);
@metalmatze
metalmatze / substract.go
Created April 6, 2017 15:19
What not to do in Go.
// Subtract deals with subtraction of all types of number.
func Subtract(left interface{}, right interface{}) interface{} {
var rleft, rright int64
var fleft, fright float64
var isInt = true
switch left.(type) {
case int:
rleft = int64(left.(int))
case int8:
rleft = int64(left.(int8))