Skip to content

Instantly share code, notes, and snippets.

View ekkinox's full-sized avatar
:octocat:

Jonathan Vuillemin ekkinox

:octocat:
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 July 3, 2026 10:28
Unmarshal JSON to specific interface implementation
package main
import (
"encoding/json"
"fmt"
"reflect"
)
type Something interface{}
@dollthing
dollthing / PhpJava.java
Last active November 17, 2026 12:37
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();

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) }