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
@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"
@sthaha
sthaha / renew-gpgkey.md
Created October 7, 2020 02:41 — forked from krisleech/renew-gpgkey.md
Renew Expired GPG key

Renew GPG key

Given that your key has expired.

$ gpg --list-keys
$ gpg --edit-key KEYID

Use the expire command to set a new expire date:

@sthaha
sthaha / remote_crc.md
Created March 5, 2020 15:16 — forked from tmckayus/remote_crc.md
Running 'crc' on a remote server

Overview: running crc on a remote server

This document shows how to deploy an OpenShift instance on a server using CodeReady Containers (crc) that can be accessed remotely from one or more client machines (sometimes called a "headless" instance). This provides a low-cost test and development platform that can be shared by developers. Deploying this way also allows a user to create an instance that uses more cpu and memory resources than may be available on his or her laptop.

While there are benefits to this type of deployment, please note that the primary use case for crc is to deploy a local OpenShift instance on a workstation or laptop and access it directly from the same machine. The headless setup is configured completely outside of crc itself, and supporting a headless setup is beyond the mission of the crc development team. Please do not ask for changes to crc to support this type of deployment, it will only cost the team time as they politely decline :)

The instructions here were tested with F

import subprocess
from elasticsearch import Elasticsearch, Transport
def execute(command):
return subprocess.run(
['/bin/sh', '-c', f"{command}"],
stdout=subprocess.PIPE)
@sthaha
sthaha / reup
Created August 22, 2018 12:14 — forked from chmouel/reup
#!/bin/bash
PATH=$PATH:/usr/local/bin
set -ex
DOMAIN=openshift3.chmouel.com
VERSION=3.10.0
OC_VERSION=oc-v${VERSION}
INSTALLPATH=/etc/origin
#!/bin/bash
set -e
# Your user name on OSIO
USER=${T-"SET YOUR USERNAME"}
# Get this from your Jenkins setting
API_TOKEN=${JENKINS_API_TOKEN:-"SET THIS"}
# You need to be login with oc or set this manually (but that may change on recration)