Skip to content

Instantly share code, notes, and snippets.

View slok's full-sized avatar
⚙️
Building reliable solutions

Xabier Larrakoetxea Gallego slok

⚙️
Building reliable solutions
View GitHub Profile
@slok
slok / k8s-port-forward.go
Created August 31, 2024 16:09
Kubernetes port forward example in go (without kubectl) using official K8s Go libs.
package main
import (
"context"
"fmt"
"log/slog"
"net/http"
"net/url"
"os"
"os/signal"
@slok
slok / pprof.md
Last active February 20, 2025 05:08
Go pprof cheat sheet

Enable profiling

Default http server

import (
    _ "net/http/pprof"
    "net/http"
)
@slok
slok / amfirer.go
Last active November 11, 2021 06:10
Alertmanager alarm tester. Fire a custom alert to your alertmanager: https://github.com/prometheus/alertmanager
package main
import (
"bytes"
"encoding/json"
"flag"
"fmt"
"log"
"net/http"
"net/url"
@elegos
elegos / install-rainbow-bash.sh
Created May 6, 2017 21:48
Rainbow bash install script
#!/usr/bin/env bash
FONTAWESOME_DOWNLOAD_URL="https://github.com/FortAwesome/Font-Awesome/archive/v4.7.0.zip"
POWERLINE_DOWNLOAD_URL="https://github.com/powerline/powerline/raw/develop/font/PowerlineSymbols.otf"
TMP=`mktemp -d`
cd $TMP
mkdir -p ~/.fonts
@sj26
sj26 / LICENSE.md
Last active December 10, 2024 08:27
Bash retry function

This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit

@wsargent
wsargent / docker_cheat.md
Last active June 29, 2024 19:32
Docker cheat sheet
@aras-p
aras-p / preprocessor_fun.h
Last active February 25, 2025 08:07
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
@jboner
jboner / latency.txt
Last active February 28, 2025 08:13
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@jcartledge
jcartledge / ~_.config_terminator_config
Created April 27, 2011 04:31
terminator config solarized
[global_config]
title_transmit_bg_color = "#839496"
title_inactive_fg_color = "#93a1a1"
title_transmit_fg_color = "#eee8d5"
title_inactive_bg_color = "#586e75"
[keybindings]
[profiles]
[[default]]
palette = "#073642:#d30102:#859900:#b58900:#6c71c4:#d33682:#2aa198:#839496:#586e75:#cb4b16:#859900:#b58900:#268bd2:#d33682:#2aa198:#93a1a1"
login_shell = True
@endolith
endolith / Has weird right-to-left characters.txt
Last active January 22, 2025 22:03
Unicode kaomoji smileys emoticons emoji
ּ_בּ
בּ_בּ
טּ_טּ
כּ‗כּ
לּ_לּ
מּ_מּ
סּ_סּ
תּ_תּ
٩(×̯×)۶
٩(̾●̮̮̃̾•̃̾)۶