Posts

Python Logger

a custom logger for Python let’s tune the default logger a bit so he write nice and colored messages. Screenshot config.py a little config File … cat <<'EOF'> config.py LOGGER_MAX_FILE_LENGTH = 10 EOF src/logger.py the logger code in the ‘src’ Folder mkdir src cat <<'EOF'> src/logger.py import logging import datetime import sys from config import * if isinstance(LOGGER_MAX_FILE_LENGTH, int): LOGGER_MAX_FILE_LENGTH = str(LOGGER_MAX_FILE_LENGTH) def get_now() -> str: # # choose your format # current_time = datetime.

Python - Build Executable

wanna convert a script to a executable ? Build a Sample Script cat << EOF > main.py a = "top" b = "secret" print("This is", a, b) EOF python3 main.py This is top secret update poetry ? doas poetry self update poetry self update or pip install poetry -U add pyinstaller poetry init poetry add pyinstaller build Binary poetry run pyinstaller main.py --onefile check Binary ls -la dist/ file dist/main ls -la dist/ 4735533 Jun 26 22:17 main ```.

Python Course

Title 1 Title 2 Title 3 Test Any Comments ? sha256: b9d70cb1f09e97aa8707c8a8b26e0fb0f599ec23d2eda337ba3899dfbc0c02c5

K8s - Hetzner

Source https://www.youtube.com/watch?v=dEAtD9PVr_Q get Host Build a VM on Hetzner, Ubuntu 22.04 Patch Patch the Box apt-get update apt-get --fix-broken install apt-get -y upgrade apt-get install lynx uptimed Kurl Small give a try with kurl. the Open Source Kubernetes Installer ;) time curl https://kurl.sh/ccedeec |bash |tee -a install.md real 4m5.149s user 1m26.425s sys 0m22.249s Kurl Full same as small, but with most options enabled curl https://kurl.sh/13609c3 | sudo bash Ressource Warning got a warning as i took a bit a small VM (CX21).

K8s on Debian12

Install Debian 12 or install Debian 11.7 and Upgrade to 12 Setup 3 Nodes 192.168.100.151 k8s-master 192.168.100.152 k8s-worker1 192.168.100.153 k8s-worker2 Locale export LC_CTYPE=en_US.UTF-8 export LC_ALL=en_US.UTF-8 Kubernetes https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/ curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" Swap Off swapoff -a sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab Install FW apt-get install ufw ufw enable Master ufw allow 22/tcp ufw allow 6443/tcp ufw allow 2379/tcp ufw allow 2380/tcp ufw allow 10250/tcp ufw allow 10251/tcp ufw allow 10252/tcp ufw allow 10255/tcp ufw reload Worker ufw allow 22/tcp ufw allow 10250/tcp ufw allow 30000:32767/tcp ufw reload Containerd cat << EOF >> /etc/modules-load.

MacOS - Kernel Extensions

see: https://nektony.com/how-to/remove-kext-on-mac System Extensions > ll /System/Library/Extensions/ |head total 0 drwxr-xr-x@ 3 root wheel 96 May 13 00:29 AFKACIPCKext.kext drwxr-xr-x@ 3 root wheel 96 May 13 00:29 AFTK_Kext.kext drwxr-xr-x@ 3 root wheel 96 May 13 00:29 AGXFirmwareKextG13GRTBuddy.kext drwxr-xr-x@ 3 root wheel 96 May 13 00:29 AGXFirmwareKextG13XRTBuddy.kext drwxr-xr-x@ 3 root wheel 96 May 13 00:29 AGXFirmwareKextG14GRTBuddy.kext drwxr-xr-x@ 3 root wheel 96 May 13 00:29 AGXFirmwareKextG14PRTBuddy.kext drwxr-xr-x@ 3 root wheel 96 May 13 00:29 AGXFirmwareKextG14XRTBuddy.

Vim

as i’m using vim almost every day, why not make some notes to improve the skillz ? Source: https://www.computerhope.com/unix/vim.htm and others … .vimrc my vim config file. do backup of the old file first! test -f ~/.vimrc && cp ~/.vimrc ~/.vimrc.bak-$(date "+%s") cat << 'EOF' > ~/.vimrc " sample .vimrc from https://blog.stoege.net/posts/vim/ " Use 2 spaces for tabs set shiftwidth=2 set tabstop=2 set expandtab set softtabstop=0 set ruler set mouse=r " Disable backup and swap files because they cause more problems than they solve set nobackup set noswapfile " Display line numbers set number " Color syntax on " colorscheme delek EOF show whitespaces :set list show numbers :set numbers ignore case :set ignorecase Convert File to xxd (hex editor) :%!

OpenBSD - Nornir

Build Nornir on OpenBSD - Failed :( Any Idea how to build it … ? (cisco-nornir-py3.11) puffy$ RUST_BACKTRACE=1 poetry add nornir-netmiko ... Compiling asn1 v0.13.0 Running `rustc --crate-name asn1 --edition=2018 /home/stoege/.cargo/registry/src/github.com-1ecc6299db9ec823/asn1-0.13.0/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C linker-plugin-lto -C overflow-checks=on -C metadata=e01d853059c772ba -C extra-filename=-e01d853059c772ba --out-dir /tmp/tmpyhzdyoqa/cryptography-40.0.2/src/rust/target/release/deps -L dependency=/tmp/tmpyhzdyoqa/cryptography-40.0.2/src/rust/target/release/deps --extern asn1_derive=/tmp/tmpyhzdyoqa/cryptography-40.0.2/src/rust/target/release/deps/libasn1_derive-dbeffd4d85568b7f.so --extern chrono=/tmp/tmpyhzdyoqa/cryptography-40.0.2/src/rust/target/release/deps/libchrono-994a1164a0b8cdf4.rmeta --cap-lints allow` Running `rustc --crate-name pyo3 --edition=2018 /home/stoege/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.15.2/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C linker-plugin-lto -C overflow-checks=on --cfg 'feature="abi3"' --cfg 'feature="abi3-py310"' --cfg 'feature="abi3-py36"' --cfg 'feature="abi3-py37"' --cfg 'feature="abi3-py38"' --cfg 'feature="abi3-py39"' --cfg 'feature="default"' --cfg 'feature="extension-module"' --cfg 'feature="indoc"' --cfg 'feature="macros"' --cfg 'feature="paste"' --cfg 'feature="pyo3-macros"' --cfg 'feature="unindent"' -C metadata=001198fe1619b05c -C extra-filename=-001198fe1619b05c --out-dir /tmp/tmpyhzdyoqa/cryptography-40.

iperf3 - rdomain

how do i run a iperf3 server in a rdomain ? if you don’t know what a rdomain is, just have a look at the man pages show interface with rdomain -> rdomain 1 show that this Interface is not running in the Default RDomain 0 ifconfig em3 em3: flags=808843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST,AUTOCONF4> rdomain 1 mtu 1500 lladdr de:ad:be:ef:be:ef description: connected to Switch (Gi0/1) index 4 priority 0 llprio 3 media: Ethernet autoselect (1000baseT full-duplex) status: active inet 192.

OpenBSD - ansible-pylibssh

wanna build ansible-pylibssh on OpenBSD 7.3 ? Build failed ? $ pip install ansible-pylibssh Defaulting to user installation because normal site-packages is not writeable Collecting ansible-pylibssh Using cached ansible-pylibssh-1.1.0.tar.gz (106 kB) Installing build dependencies ... done Getting requirements to build wheel ... done Installing backend dependencies ... done Preparing metadata (pyproject.toml) ... done Building wheels for collected packages: ansible-pylibssh Building wheel for ansible-pylibssh (pyproject.toml) ... error error: subprocess-exited-with-error × Building wheel for ansible-pylibssh (pyproject.