Skip to content

Instantly share code, notes, and snippets.

View felixkrohn's full-sized avatar
🤖
doing a bit here, a byte there.

Felix Krohn felixkrohn

🤖
doing a bit here, a byte there.
  • Planet Earth (temporarily)
View GitHub Profile
@vjt
vjt / copy-from-time-machine.sh
Last active January 29, 2025 13:27
Copy data from a Time Machine volume mounted on a Linux box.
#!/bin/bash
#
# Copy data from a Time Machine volume mounted on a Linux box.
#
# Usage: copy-from-time-machine.sh <source> <target>
#
# source: the source directory inside a time machine backup
# target: the target directory in which to copy the reconstructed
# directory trees. Created if it does not exists.
#
@tuxfight3r
tuxfight3r / ipxe_with_dhcp.txt
Last active October 25, 2023 03:34
ipxe kickstart over http - dhcp and static configuration
#clone the repo
git clone http://git.ipxe.org/ipxe.git
cd ipxe/src
cat >ubuntu-amd64-installer.ipxe <<EOF
#!ipxe
dhcp
echo Starting Ubuntu x64 installer for ${hostname}
set base-url http://archive.ubuntu.com/ubuntu/dists/trusty/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64
kernel ${base-url}/linux
@so0k
so0k / kubectl.md
Last active February 4, 2025 17:16
Playing with kubectl output

Kubectl output options

Let's look at some basic kubectl output options.

Our intention is to list nodes (with their AWS InstanceId) and Pods (sorted by node).

We can start with:

kubectl get no
@mdo
mdo / 00-intro.md
Last active March 4, 2025 19:03
Instructions for how to affix an Ikea Gerton table top to the Ikea Bekant sit-stand desk frame.

Ikea Bekant standing desk with Gerton table top

groups:
- name: datetime
rules:
- record: daily_saving_time_belgium
expr: |
(vector(0) and (month() < 3 or month() > 10))
or
(vector(1) and (month() > 3 and month() < 10))
or
(
@felixkrohn
felixkrohn / openshift-notepad.md
Last active April 15, 2025 06:35
openshift notepad

node debug pod with custom image (tcpdump etc)

oc debug node/ip-1-2-3-4.internal --image=registry.tld/namespace/image:tag
echo '{ "propagationPolicy": "Background" }' | curl -k -X DELETE -d @-  -H "Authorization: Bearer $TOKEN" -H 'Accept: application/json' -H 'Content-Type: application/json'  https://openshift-master.$DOMAIN/api/v1/namespaces/$NAMESPACE/pods/$PODNAME

kill haproxy processes older than 12h

ps -eo pid,etimes,comm,user | awk '{if ($3 = /haproxy/ && $2>43200) print $1}' | xargs kill -15

add infra nodeselector to namespace with oc patch

oc patch namespace $NAMESPACE -p '{"metadata":{"annotations":{"openshift.io/node-selector":"region=infra"}}}'

get a table of canonical nodenames together with their name label:

oc get nodes -Lname --output=jsonpath='{range .items[*].metadata}{.name}{" "}{.labels.name}{"\n"}'

@dcode
dcode / README.md
Last active April 17, 2025 17:17
How to use CoreDNS w/ etcd backend

Setup CoreDNS w/ etcd backend

Why CoreDNS

[CoreDNS][coredns] was designed from the ground up to provide robust, plugin-based DNS server for use in cloud environments. Namely, it serves as the default primary service discovery mechanism for Kubernetes.

Using CoreDNS allows us to have a lightweight DNS server on RockNSM (11 Mb binary is all that's needed!) to facilitate multi-node service discovery. Alternatively, if another existing DNS service is available, this can be used instead. Aligning with the way the Kubernetes manages service discovery also allows us to build new RockNSM features in parallel with the coming Kubernetes support.

RockNSM Application

  • log into a router pod (oc rsh -n default router-YY-XXXXX)
  • confirm the socket used by haproxy is /var/lib/haproxy/run/haproxy.sock (using ps ax)
  • connect to the socket with socat socat /var/lib/haproxy/run/haproxy.sock stdio
  • use "prompt" and "help" for the corrsponding actions, or directly call echo "prompt" | socat /var/lib/haproxy/run/haproxy.sock stdio echo "help" | socat /var/lib/haproxy/run/haproxy.sock stdio
  • get raw stats in CSV format. note the "iid" value for the backend you're debugging echo "show stat" | socat /var/lib/haproxy/run/haproxy.sock stdio
  • get "typed" stats in the format [BS].IID.x.FIELD-ID.FIELD-Description with the value in the last column
# after an accidental "oc delete pv --all" all PVs on the cluster are marked as "Terminating".
# As a result all PV have to be re-created, which is done by the script.
# Before force-deleting the PV, all deployments accessing the PV via PVC are being scaled down, and scaled up again afterwards.
#
# (by the way, the "Terminating" status is not a real status, but is what oc/kubectl print out
# when an object has a DeletionTimestamp, which is immutable and cannot be deleted anymore. See
# https://github.com/kubernetes/kubernetes/blob/master/pkg/kubectl/describe/versioned/describe.go#L1374-L1378
# if pv.ObjectMeta.DeletionTimestamp != nil {
# w.Write(LEVEL_0, "Status:\tTerminating (lasts %s)\n", translateTimestampSince(*pv.ObjectMeta.DeletionTimestamp))
# } else {
@joaofl
joaofl / Clean Samsung Galaxy A40 bloatwares
Last active January 20, 2024 16:36
Script I used to clean preinstalled shit out of my brand new Samsung A40 (while there is still no LineageOS for it)
#!/bin/sh
# ref: https://piunikaweb.com/2019/03/25/samsung-galaxy-s10-remove-bundled-bloatwares-without-root/
# install the following app to see the packages names:
# use the following command to generate the unistall command, for easy copy and paste:
# adb shell 'pm list packages' | sed -e 's/^/adb uninstall --user 0 /' | grep FILTER_HERE | sort
#things to install if removing keyboard
# F-Droid
# APK Analyser