Skip to content

Instantly share code, notes, and snippets.

View ekkinox's full-sized avatar
:octocat:
Working from home

Jonathan Vuillemin ekkinox

:octocat:
Working from home
View GitHub Profile
@theothertomelliott
theothertomelliott / otel_filter_grpc_healthchecks.go
Created November 13, 2022 00:13
How to filter gRPC health checks from opentelemetry incerceptors
import "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
import "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/filters"
// ...
grpc.UnaryInterceptor(
otelgrpc.UnaryServerInterceptor(
otelgrpc.WithInterceptorFilter(
filters.Not(
filters.HealthCheck(),
@tkrajina
tkrajina / unmarshal_interface.go
Last active March 24, 2025 01:02
Unmarshal JSON to specific interface implementation
package main
import (
"encoding/json"
"fmt"
"reflect"
)
type Something interface{}
@avafloww
avafloww / PhpJava.java
Last active April 1, 2025 18:01
This snippet of code is syntactically valid in both PHP and Java, and produces the same output in both.
/*<?php
//*/public class PhpJava { public static void main(String[] args) { System.out.printf("/*%s",
//\u000A\u002F\u002A
class PhpJava {
static function main() {
echo(//\u000A\u002A\u002F
"Hello World!");
}}
//\u000A\u002F\u002A
PhpJava::main();
@lavalamp
lavalamp / The Three Go Landmines.markdown
Last active February 28, 2025 12:54
Golang landmines

There are three easy to make mistakes in go. I present them here in the way they are often found in the wild, not in the way that is easiest to understand.

All three of these mistakes have been made in Kubernetes code, getting past code review at least once each that I know of.

  1. Loop variables are scoped outside the loop.

What do these lines do? Make predictions and then scroll down.

func print(pi *int) { fmt.Println(*pi) }