Skip to content

Instantly share code, notes, and snippets.

@sthaha
sthaha / ebpf-overhead.py
Created September 23, 2024 02:42 — forked from dave-tucker/ebpf-overhead.py
Measuring eBPF program overhead per process
# perf script event handlers, generated by perf script -g python
# Licensed under the terms of the GNU GPL License version 2
# The common_* event handler fields are the most useful fields common to
# all events. They don't necessarily correspond to the 'common_*' fields
# in the format files. Those fields not available as handler params can
# be retrieved using Python functions of the form common_*(context).
# See the perf-script-python Documentation for the list of available functions.
import os
#!/usr/bin/env bash
set -eu -o pipefail
grafana() {
local endpoint="$1"
shift
http --auth admin:admin ":3000/api/$endpoint" "$@"
}
package debugutil
import (
"bufio"
"bytes"
"fmt"
"os"
"regexp"
"runtime/debug"
"strings"
#!/usr/bin/env bash
colorfg() {
for i in {0..255}; do
printf "\x1b[38;5;${i}m ▩▩▩ %-5i\x1b[0m" $i
if ! (( ($i + 1 ) % 8 )); then
echo
fi
@sthaha
sthaha / regenerate-kubeconfig.sh
Created May 18, 2021 06:06 — forked from rcarrata/regenerate-kubeconfig.sh
Script for regenerating the kubeconfig for system:admin user
#!/bin/bash
AUTH_NAME="auth2kube"
NEW_KUBECONFIG="newkubeconfig"
echo "create a certificate request for system:admin user"
openssl req -new -newkey rsa:4096 -nodes -keyout $AUTH_NAME.key -out $AUTH_NAME.csr -subj "/CN=system:admin/O=system:masters"
echo "create signing request resource definition"
---
apiVersion: v1
kind: Pod
metadata:
labels:
app: debug
name: debug
spec:
containers:
- name: debug
package main
import (
"encoding/json"
"fmt"
)
type valueStruct struct {
Value bool `json:"val,omitempty"`
}
[color]
ui = auto
[color "branch"]
current = 156 bold
local = green
remote = 179
[color "diff"]
meta = yellow bold
# # Colours
# ref: https://www.reddit.com/r/neovim/comments/825dj7/the_endless_litany_of_tmux_and_nvim_color_problems/dvc2boh/
set -s default-terminal tmux-256color
set -as terminal-overrides ",*:Tc"
# history
set -g history-limit 100000
# start counting from 1
set -g base-index 1
apiVersion: v1
kind: Pod
metadata:
labels:
run: debug
name: debug
namespace: debug
spec:
containers:
- args: