Skip to content

Instantly share code, notes, and snippets.

View oocx's full-sized avatar

Mathias Raacke oocx

  • Diamant Software GmbH
  • Halle (Westfalen), NRW, Germany
  • X @oocx
View GitHub Profile
@davidfowl
davidfowl / .NET6Migration.md
Last active July 19, 2024 22:48
.NET 6 ASP.NET Core Migration
@bitbonk
bitbonk / recordsanddiscriminatedunions.cs
Last active January 24, 2020 12:59
Record and discriminated unions in C# 9
public class Person
{
public initonly string Firstname { get; }
public initonly string Lastname { get; }
};
enum class ByteOrBool { byte Y; bool B;}
enum class MixedType
{
@max-rocket-internet
max-rocket-internet / prom-k8s-request-limits.md
Last active July 19, 2024 23:33
How to display Kubernetes request and limit in Grafana / Prometheus properly

CPU: percentage of limit

A lot of people land when trying to find out how to calculate CPU usage metric correctly in prometheus, myself included! So I'll post what I eventually ended up using as I think it's still a little difficult trying to tie together all the snippets of info here and elsewhere.

This is specific to k8s and containers that have CPU limits set.

To show CPU usage as a percentage of the limit given to the container, this is the Prometheus query we used to create nice graphs in Grafana:

sum(rate(container_cpu_usage_seconds_total{name!~".*prometheus.*", image!="", container_name!="POD"}[5m])) by (pod_name, container_name) /
@ibuildthecloud
ibuildthecloud / README.md
Last active May 14, 2024 21:29
k3s on WSL2

Instructions to hack up WSL2 on Windows 10 Build 18917 to run k3s (Kubernetes) and rio

Install WSL2

https://docs.microsoft.com/en-us/windows/wsl/wsl2-install

I already had Ubuntu-18.04 installed in wsl 1. So I just did wsl --set-version Ubuntu-18.04 2

Compile Kernel

Using Ubuntu 18.04 (I'm sure any distro will work), inside WSL2 download https://thirdpartysource.microsoft.com/download/Windows%20Subsystem%20for%20Linux%20v2/May%202019/WSLv2-Linux-Kernel-master.zip and extract to a folder. The latest version of the kernel source is available at (https://github.com/microsoft/WSL2-Linux-Kernel)

@kohlikohl
kohlikohl / script.js
Last active September 27, 2023 08:41
Fix VSTS code coverage reporting by inlining CSS
let fs = require("fs-jetpack"),
path = require("path"),
inline = require("inline-css");
// This inlines the css of the HTML coverage output as VSTS
// strips all external CSS files
const CODE_COVERAGE_DIRECTORY = "./coverage";
const files = fs.find(CODE_COVERAGE_DIRECTORY, { matching: "*.html" });