Skip to content

Instantly share code, notes, and snippets.

View marzocchi's full-sized avatar

Federico Marzocchi marzocchi

View GitHub Profile
@marzocchi
marzocchi / query.txt
Created February 15, 2024 12:45
MetricsQL/PromQL to enhance pod/container metrics with the deployment name
sum by (namespace, pod) ( container_memory_working_set_bytes{image!="", container!="POD", container!="", source!="cadvisor", namespace="SOME_NAMESPACE"} )
* on (namespace, pod) group_left(deployment)
(
label_copy(kube_replicaset_owner{namespace="SOME_NAMESPACE", owner_kind="Deployment"}, "owner_name", "deployment")
* on (namespace, replicaset) group_left(pod)
(
label_copy(kube_pod_info{namespace="SOME_NAMESPACE", created_by_kind="ReplicaSet"}, "created_by_name", "replicaset")
* on (namespace, replicaset, pod)
@marzocchi
marzocchi / Dockerfile
Created August 1, 2023 08:46
nginx container with files of different size and random content
FROM nginx:latest
RUN for size in 1K 2K 10K 20K 512K 1M; do \
dd if=/dev/urandom of=/usr/share/nginx/html/${size}.dat bs=${size} count=1; \
done
@marzocchi
marzocchi / vault-list-recursive.sh
Last active July 7, 2023 14:19
List Vault Secrets Recursively with vault CLI
#!/usr/bin/env bash
#
# Usage:
#
# vault-list-recurive.sh START_PATH
set -euo pipefail
to_lines() {
sed "s/{}//g" \
@marzocchi
marzocchi / race-on-start.txt
Last active March 28, 2021 22:01
data races @ hc
==================
WARNING: DATA RACE
Write at 0x00c00062e050 by goroutine 32:
github.com/brutella/hc/hap.(*session).SetCryptographer()
/Users/marzocchi/projects/hc/hap/session.go:100 +0x3e
github.com/brutella/hc/hap/endpoint.(*PairVerify).ServeHTTP()
/Users/marzocchi/projects/hc/hap/endpoint/pair-verify.go:71 +0x7d6
net/http.(*ServeMux).ServeHTTP()
/nix/store/1kxvwk77952rppirjn258z7s3i3680zx-go-1.16/share/go/src/net/http/server.go:2448 +0xaf
net/http.serverHandler.ServeHTTP()
@marzocchi
marzocchi / Dockerfile
Last active October 11, 2023 11:12
Connect to a gRPC server with TLS (without a certificate, key pair)
FROM golang:alpine AS builder
RUN apk --no-cache add build-base git mercurial gcc
ADD . /go/src/grpc-client-test
RUN cd /go/src/grpc-client-test && go build -o grpc-client-test main.go
FROM alpine
COPY --from=builder /go/src/grpc-client-test /grpc-client-test
ENV GRPC_GO_LOG_SEVERITY_LEVEL=info
ENV GRPC_GO_LOG_VERBOSITY_LEVEL=6
@marzocchi
marzocchi / config.nix
Last active June 23, 2021 21:44
.config/nixpkgs/config.nix
# - list packages
# nix-env -qaP
#
# - install packages in this file, or update packages after channel update:
# nix-env -iA nixpkgs.myPackages
#
# - update package list
# nix-channel --update
{
allowUnfree = true;

Keybase proof

I hereby claim:

  • I am marzocchi on github.
  • I am fmarzocchi (https://keybase.io/fmarzocchi) on keybase.
  • I have a public key whose fingerprint is B9CE 00EE E0CB 4929 F75B 2DFE 3DD2 6755 9C50 26A6

To claim this, I am signing this object:

@marzocchi
marzocchi / zshrc
Last active November 27, 2022 17:32
zshrc
# vim: se filetype=zsh
# zmodload zsh/zprof
autoload -U add-zsh-hook
export LANG=en_US.UTF-8
TZ="Europe/Berlin"
HISTFILE=$HOME/.zhistory
HISTSIZE=3000
SAVEHIST=3000
@marzocchi
marzocchi / config.fish
Last active November 26, 2019 22:47
config.fish
if status is-interactive > /dev/null
function fish_vi_cursor; end
fish_vi_key_bindings
function fish_greeting
end
function first_prompt_line --on-event fish_prompt
set_color red
iterm-notify config-set failure-icon "https://media3.giphy.com/media/10ECejNtM1GyRy/200_s.gif"
iterm-notify config-set failure-title "wow such #fail"
iterm-notify config-set success-icon "https://s-media-cache-ak0.pinimg.com/564x/b5/5a/18/b55a1805f5650495a74202279036ecd2.jpg"
iterm-notify config-set success-title "very #success. wow"