Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
# bridger-roam-cleanup: removes stale bridger TC flower rules when
# a WiFi client roams between bands (e.g. 5GHz <-> 6GHz).
#
# Bridger creates TC flower rules with skip_sw (hardware-only) to
# accelerate bridge forwarding. When a client roams, bridger sometimes
# leaves stale rules pointing to the old WiFi interface, causing the
# PPE to redirect download traffic to the wrong radio (1 Mbit symptom).
### START THAT SCRIPT USING /etc/rc.local
[ 10.137543] input: Dell Computer Corp Dell Universal Receiver System Control as /devices/pci0000:00/0000:00:14.0/usb3/3-1/3-1.4/3-1.4.4/3-1.4.4.1/3-1.4.4.1.2/3-1.4.4.1.2:1.1/0003:413C:2514.0005/input/input16
[ 10.137842] hid-generic 0003:413C:2514.0005: input,hidraw4: USB HID v1.11 Mouse [Dell Computer Corp Dell Universal Receiver] on usb-0000:00:14.0-1.4.4.1.2/input1
[ 10.139497] hid-generic 0003:413C:2514.0006: hiddev98,hidraw5: USB HID v1.11 Device [Dell Computer Corp Dell Universal Receiver] on usb-0000:00:14.0-1.4.4.1.2/input2
[ 13.468861] EXT4-fs (dm-0): orphan cleanup on readonly fs
[ 13.469033] EXT4-fs (dm-0): mounted filesystem d9db6e39-e862-4472-bc3e-07760544c75e ro with ordered data mode. Quota mode: none.
[ 13.581056] typec port2: bound usb3-port2 (ops connector_ops)
[ 13.581064] typec port2: bound usb3-port5 (ops connector_ops)
[ 13.581067] typec port2: bound usb3-port7 (ops connector_ops)
[ 13.581069] typec port2: bound usb3-port8 (ops connector_ops)
[ 13.581071] typec port2
@danpawlik
danpawlik / replace-centos-stream-metalink.sh
Last active December 17, 2025 18:22
Replace sometimes broken metalink with baseurl
@danpawlik
danpawlik / set-iops.yaml
Created April 18, 2025 13:36
Set iops and read write limit using cgroup
---
- name: Set system-wide IOPS limitation via cgroups v2
hosts: all
become: true
vars:
main_blk_name: /dev/vda
iops_limit: 10000
rw_total_limit: 104857600 # 100mb in bytes
tasks:
- name: Get block device major:minor
@danpawlik
danpawlik / build image for BPI-R4 with Mediatek feed
Last active January 1, 2026 17:11
build image for BPI-R4 with Mediatek feed
#!/bin/bash
CURRENT_DIR=$(pwd)
# for 6.12 -> main, for 6.6 -> openwrt-24.10
# OPENWRT_BRANCH=openwrt-24.10
# If main, than: d6397aaf69fbb442f913b2853cac2991962ef905
OPENWRT_BRANCH=main
OPENWRT_DIR=$(pwd)/openwrt-mediatek
MEDIATEK_FEED_BRANCH=master
@danpawlik
danpawlik / modify-centos10.qcow2
Last active December 10, 2024 08:08
Inject user and key to the qcow2 image
# check file system which should be extended
virt-filesystems --long -h --all -a CentOS-Stream-GenericCloud-x86_64-10-20241204.0.x86_64.qcow2
# create new empty disk with desired size
qemu-img create -f qcow2 centos-stream-10.qcow2 100G ## Optionally add: -o preallocation=metadata
# expand root partition
virt-resize --expand /dev/sda3 CentOS-Stream-GenericCloud-x86_64-10-20241204.0.x86_64.qcow2 centos-stream-10.qcow2
# Modify image
@danpawlik
danpawlik / configure-monitoring.sh
Created August 8, 2024 13:57
Start Prometheus and Grafana localy and configure OpenWRT exporter
#!/bin/bash
MAIN_DIR=~/monitoring
ROUTER_NODE_EXPORTER_ADDRESS="192.168.88.1:9100"
if ! [ -d "$MAIN_DIR" ]; then
mkdir -p $MAIN_DIR
fi
# NOTE: https://grafana.com/blog/2021/02/09/how-i-monitor-my-openwrt-router-with-grafana-cloud-and-prometheus/
@danpawlik
danpawlik / dnsproxy.sh
Last active April 19, 2025 00:46
adguard dnsproxy on openwrt
opkg update
opkg install dnsproxy
# Ensure, that the NTP server can work without DNS
uci del system.ntp.server
uci add_list system.ntp.server='194.177.4.1' # 0.openwrt.pool.ntp.org
uci add_list system.ntp.server='213.222.217.11' # 1.openwrt.pool.ntp.org
uci add_list system.ntp.server='80.50.102.114' # 2.openwrt.pool.ntp.org
uci add_list system.ntp.server='193.219.28.60' # 3.openwrt.pool.ntp.org
uci commit system
@danpawlik
danpawlik / force-mcp-ocp-update
Created July 17, 2024 07:19 — forked from ikurni/force-mcp-ocp-update
How to force openshift MCP to update machine config
### Create file called machine-config-daemon-force in /run ###
ssh core@hostname.local sudo touch /run/machine-config-daemon-force
### Edit node annotations ###
oc edit node <node-name>
### Check Annotations, change like below sample ###
machineconfiguration.openshift.io/currentConfig: rendered-worker-ab4a1e7216bf3da2a5203f09c871b456
machineconfiguration.openshift.io/desiredConfig: rendered-worker-ab4a1e7216bf3da2a5203f09c871b456
machineconfiguration.openshift.io/reason: ""
@danpawlik
danpawlik / install-olm-microshift.sh
Last active September 29, 2024 20:20
Install OLM with Operatorhub.io support on MicroShift 4.14 and newer
#!/bin/bash
OPERATOR_SDK="v1.34.2"
OLM="0.27.0"
# Grant more permissions
oc patch scc restricted --type=merge -p '{"runAsUser": {"type": "RunAsAny"}}'
oc patch scc restricted-v2 --type=merge -p '{"runAsUser": {"type": "RunAsAny"}}'
# optional
oc adm policy add-scc-to-user privileged system:serviceaccount:olm:default