Skip to content

Instantly share code, notes, and snippets.

View kkroesch's full-sized avatar

Karsten Kroesch kkroesch

View GitHub Profile
@kkroesch
kkroesch / .alias
Created March 10, 2025 12:32
Useful aliases for Podman and Docker
alias pps='printf "%-12s %-25s %-12s %-30s %s\n" "ID" "NAME" "STATUS" "IMAGE" "PORTS"; podman ps --format "{{printf \"%.12s %-25s %-12s %.30s %s\" .ID .Names .Status .Image .Ports}}"'
# ... to be continued
@kkroesch
kkroesch / Justfile
Last active April 2, 2025 06:59
Certificate creation with OpenSSL for devices with Subject Alternative Names (SAN)
pkey:
# Create private key.
# Most certification authorities only support RSA alogrithm.
openssl genpkey -algorithm RSA -out device.key
pkeyec:
# Create private key with elliptic curve algorithm.
openssl ecparam -name prime256v1 -genkey -noout -out device.key
csr:
@kkroesch
kkroesch / uptime_panel.json
Last active February 24, 2025 19:06
Grafana Uptime Panel
{
"datasource": {
"uid": "bc2d6911-2640-41d7-a568-5cc56f6c2b37",
"type": "prometheus"
},
"fieldConfig": {
"defaults": {
"mappings": []
},
"overrides": []
@kkroesch
kkroesch / Justfile
Last active December 23, 2024 16:46
Provision QEMU Debian images.
image_name := "debian.qcow2"
set shell := ["bash", "-cu"]
ansible_password := `(openssl rand -base64 12)`
download:
@curl -Lo {{image_name}} https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-nocloud-amd64.qcow2
prepare:
@echo {{ansible_password}} > .password
@kkroesch
kkroesch / main.rs
Last active October 25, 2024 18:16
Rust Tracing
//! ## Dependencies
//! [dependencies]
//! tracing = "0.1"
//! tracing-subscriber = { version = "0.3", features = ["fmt", "env-filter"] }
use tracing::{debug, error, info, instrument, warn};
use tracing_subscriber::{fmt, EnvFilter};
#[instrument(level = "trace")]
@kkroesch
kkroesch / consumer.rs
Last active October 23, 2024 11:08
RabbitMQ Producer and Consumer with Tokio Runtime.
use futures_util::stream::StreamExt;
use lapin::{
options::{BasicAckOptions, BasicConsumeOptions, QueueDeclareOptions},
types::FieldTable,
Connection, ConnectionProperties,
};
use std::error::Error;
use tracing::{info, instrument};
use tracing_subscriber;
@kkroesch
kkroesch / sonntagsfrage.R
Last active September 12, 2024 14:33
Sonntagsfrage
# Installiere ggplot2 und scales, falls noch nicht installiert
# install.packages("ggplot2")
# install.packages("scales")
library(ggplot2)
library(scales)
# Erstelle den Datensatz
partei_list = c("SPD", "CDU", "Grüne", "FDP", "AfD", "Linke", "BSW", "Sonstige")
# Definiere die Parteifarben
@kkroesch
kkroesch / exif.sh
Last active May 17, 2024 11:21
Manipulate EXIF Headers
exif --ifd=0 --tag=0x8298 --set-value='(c) 2010 Karsten Kroesch' campground.jpg
exif --ifd=0 --tag=0x010e --set-value='Campground Mojave Desert' -o campground.jpg campground.jpg.modified.jpeg
**Copyright Watermark:**
convert desert.jpg -fill white  -undercolor '#00000080'  -gravity South -annotate +0+5 ' (c) 2010 Karsten Kroesch ' desert.jpg
**Border:**
@kkroesch
kkroesch / playbook.yaml
Created May 16, 2024 11:56
Template Ansible Playbook
---
- name: Example Ansible Playbook
hosts: all
become: true
vars:
paketname: "htop"
quellpfad: "/pfad/zur/datei"
zielpfad: "/pfad/zum/ziel"
tasks:
@kkroesch
kkroesch / pods.nsh
Created May 16, 2024 11:04
Kubectl in Nu Shell
def pods [] { kubectl get pods -o yaml | from yaml | get items }
pods | get metadata.name