Skip to content

Instantly share code, notes, and snippets.

View phosae's full-sized avatar
:octocat:
coffee ☕ , beer 🍺 and imagination 🧿

zengxu phosae

:octocat:
coffee ☕ , beer 🍺 and imagination 🧿
View GitHub Profile
@aojea
aojea / README.md
Created August 29, 2024 17:23
Running a Pod with A Predefined Mac Address

Running a Pod with a predefined MAC address

There are situation that, for reasons, you want your Pod to have a static MAC.

Since the Pod uses a veth pair, the application running inside the Pod sees the side of the veth that is on its network namespace.

Using an initContainer with enough privileges, we can change the MAC address before the application runs.

  initContainers:
@philipp-meier
philipp-meier / OpenAiFunctionCallingExample.md
Last active June 24, 2025 06:25
OpenAI function calling example

OpenAI function calling example

Example curl requests for OpenAI's function calling API using a local Ollama docker container with the llama3.1 model.

Step 1:
Ask the LLM a question and provide the function it can call to gather the required information.
In this case, we want to know the current weather and provide the get_current_weather function definition.

Note: If you use a local Ollama instance, you can remove the "Authorization"-header.

@dhh
dhh / linux-setup.sh
Last active October 30, 2025 22:31
linux-setup.sh
# THIS LINUX SETUP SCRIPT HAS MORPHED INTO A WHOLE PROJECT: HTTPS://OMAKUB.ORG
# PLEASE CHECKOUT THAT PROJECT INSTEAD OF THIS OUTDATED SETUP SCRIPT.
#
#
# Libraries and infrastructure
sudo apt update -y
sudo apt install -y \
docker.io docker-buildx \
build-essential pkg-config autoconf bison rustc cargo clang \
@lukasnellen
lukasnellen / README.md
Last active November 27, 2025 02:15
Connect host and VM when using MACVTAP instead of TAP interfaces

Connect host and VM when using a MACVTAP interface

NB: The following is only of interest if you want to share the host network with your virtual machine. The most common way this gets implemented is by setting up a bridge which includes the physical interface. Using a [MACVTAP] inerface is suposed to be more efficient, since it avoids the additional bridge in the network setup.

In this gist, we extend the information provided in the documenation on linux virtual interfaces.

In the following, we assume you host interface is eth0. IP addresses used:

  • host: 198.51.100.50/24
  • virtual machine: 198.51.100.198/24
  • default gateway: 198.51.100.254
@mcastelino
mcastelino / kcgroups.md
Last active July 5, 2024 11:53
Kubernetes and cgroups Resource Management/Static cpuManagerPolicy/Memory and Resource Isolation & Scheduling

Overview

The goal of this document to cover all aspects of Kubernetes management, including how resources are expressed, constrained and accounted for. This started a way to ensure that alternate container runtime implementation like Kata containers will behave from a resource accounting and consumption point of view in the same manner as runc.

Location of the latest version of this document: https://gist.github.com/mcastelino/b8ce9a70b00ee56036dadd70ded53e9f

If you do not understand cgroups please refer to a quick primer at the bottom of this document. This will help you understand how the resource enforcement actually works.

Kubernetes Resource Management

@fntlnz
fntlnz / self-signed-certificate-with-custom-ca.md
Last active December 10, 2025 16:14
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Last update: Nov 2025.

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl ecparam -genkey -name secp384r1 | openssl ec -aes256 -out rootCA.key
git config --global https.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080
git config --global --unset http.proxy
git config --global --unset https.proxy
npm config delete proxy
@denji
denji / http-benchmark.md
Last active November 26, 2025 20:18
HTTP(S) Benchmark Tools / Toolkit for testing/debugging HTTP(S) and restAPI (RESTful)