Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
# based on https://www.procustodibus.com/blog/2022/12/limit-wireguard-bandwidth/
# wireguard setup and peers setup done by script: https://openwrt.org/docs/guide-user/services/vpn/wireguard/automated
# Show traffic control classes for the device wg_lan - should be empty
tc class show dev wg_lan
# Add HFSC qdisc to wg_lan (root queueing, handle 1, default class 1)
[ 0.000000] Booting Linux on physical CPU 0x0000000000 [0x411fd090]
[ 0.000000] Linux version 6.6.22 (user@b23256e80eba) (aarch64-openwrt-linux-musl-gcc (OpenWrt GCC 12.3.0 r25530+1-51752fa14b) 12.3.0, GNU ld (GNU Binutils) 2.40.0) #0 SMP Sat Mar 16 19:37:37 2024
[ 0.000000] Machine model: Bananapi BPI-R4
[ 0.000000] OF: reserved mem: 0x0000000042ff0000..0x0000000042ffffff (64 KiB) map non-reusable ramoops@42ff0000
[ 0.000000] OF: reserved mem: 0x0000000043000000..0x000000004304ffff (320 KiB) nomap non-reusable secmon@43000000
[ 0.000000] Zone ranges:
[ 0.000000] DMA [mem 0x0000000040000000-0x00000000ffffffff]
[ 0.000000] DMA32 empty
[ 0.000000] Normal [mem 0x0000000100000000-0x000000013fffffff]
[ 0.000000] Movable zone start for each node
@danpawlik
danpawlik / fix-failed-verification.md
Last active March 9, 2024 16:58
Huawei fix "Your device has failed verification and may not work property." on Huawei P20 Pro

How to restore back Huawei P20 Pro after downgrade and "Your device has failed verification and may not work property."

This manual was created using my own example how to resurrect Huawei P20 Pro. I am not responsible for your device. The following description was made for scientific and passion purposes.

NOTE: This guide require to unlock the phone via testpoint. NOTE: Some part of that guide require to do steps on Windows, some other on Linux (I did not test script on Windows)

Preparation

  1. Download the unlock tool https://github.com/werasik2aa/Huawei-Unlock-Tool/releases and unpack
  2. Download the testpoint driver https://github.com/mashed-potatoes/PotatoNV?tab=readme-ov-file#unlocking-the-bootloader
@danpawlik
danpawlik / cloud-init-tmate
Last active January 29, 2024 13:51
Simply cloud init config to enable tmate
#cloud-config
# user: test password: test
users:
- default
- name: test
sudo: ALL=(ALL) NOPASSWD:ALL
groups: users, admin
ssh_authorized_keys:
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOKLl0NYKwoZ/JY5KeZU8VwRAggeOxqQJeoqp3dsAaY9 dpawlik@x1
Network:
root@BPI-R4:~# uci export network
package network
config interface 'loopback'
option device 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
@danpawlik
danpawlik / xiaomi_4c_debrick.md
Last active January 10, 2024 13:51 — forked from Reeywhaar/xiaomi_4c_debrick.md
Debrick Xiaomi 4c router on MacOs

Debricking Xiaomi 4c / Xiaomi AX3200 router on MacOs / Linux

Moved to https://reeywhaar.github.io/posts/debricking-xiaomi_4c/

A short preamble. If you don't want to read how i've bricked my router go to the next chapter "Debricking".

I've bought a Xiaomi 4c router on my trip so I can make it work in hotspot mode. Router connects to hotel wifi and then I connect to its private network, so all my devices are not reachable from the hotel network. Even though I saw that the router supports such mode in reality there was none. So I decided to install OpenWrt. Long story short I've installed it and made it work. My verdict is that though theoretically OpenWrt works practically, it works unstable. After some time the router just stops to respond, either via ssh, web front, wifi connection, etc... When my hotel days were over I decided to restore the original MiWifi firmware. I downloaded one on official website: https://miuirom.org/miwifi/mi-router-

collectd collectd-mod-sensors collectd-mod-dns collectd-mod-wireless luci-app-statistics luci luci-i18n-base-pl vim htop curl iperf3 luci-app-attendedsysupgrade auc bmon irqbalance rsync dawn luci-app-dawn https-dns-proxy luci-app-https-dns-proxy luci-i18n-https-dns-proxy-pl libcurl4 libnghttp3 libngtcp2 luci-app-sqm
@danpawlik
danpawlik / debloat-huawei.sh
Last active November 28, 2023 07:50
Debloat Huawei P30 Pro apps
#!/bin/bash
sudo adb shell pm list packages -u | cut -f2 -d: | sort > ~/huawei-dump-packages
for app in $(grep -E 'com.amazon.mShop.android.shopping|com.amazon.appmanager|com.booking|com.facebook.appmanager|com.facebook.katana|com.facebook.services|com.facebook.system|com.huawei.browser|com.huawei.browserhomepage|com.huawei.hwread.dz|com.huawei.ohos.inputmethod|com.google.android.apps.docs|com.google.android.apps.docs.editors.docs|com.google.android.apps.docs.editors.sheets|com.google.android.apps.docs.editors.slides|com.huawei.gamebox|com.google.android.videos|com.google.android.music|com.huawei.health|com.huawei.meetime|com.example.android.notepad|com.huawei.maps.app|com.huawei.hwsearch|com.huawei.mycenter|com.huawei.tips$|com.google.android.apps.tachyon|com.huawei.videoeditor|com.huawei.himovie.overseas|com.huawei.phoneservice' ~/huawei-dump-packages); do sudo adb shell pm uninstall --user 0 "${app}"; sudo adb shell pm disable-user --user 0 "${app}"; done
# to install
# Google dialer
# Google keep
#!/bin/bash
DOCKER_USER=${DOCKER_USER:-$1}
DOCKER_PASSWORD=${DOCKER_PASSWORD:-$2}
export DOCKER_USER=dpawlik;
export DOCKER_PASSWORD=''
if [ -z "$DOCKER_USER" ] || [ -z "$DOCKER_PASSWORD" ]; then
@danpawlik
danpawlik / minikube-podman.sh
Created October 17, 2023 06:58
Install minikube with a podman driver
#!/bin/bash
MINIKUBE_VERSION=${MINIKUBE_VERSION:-'latest'}
echo "$USER ALL=(ALL) ALL" | sudo tee -a /etc/sudoers
echo "%$USER ALL=(ALL) NOPASSWD: ALL" | sudo tee -a /etc/sudoers
# install crio
CRIO_VERSION=1.24
OS="xUbuntu_$(lsb_release -r -s)"