Skip to content

Instantly share code, notes, and snippets.

View ayufan's full-sized avatar

Kamil Trzciński ayufan

View GitHub Profile
@ayufan
ayufan / rclone-cached-tmux.sh
Created June 22, 2025 07:03
Rclone copy via cache folder (with tmux): HDD > SSD (cache) > Target
#!/bin/bash
set -euo pipefail
if [[ "$1" == "--to-cache" ]]; then
if [[ -n "$(rclone lsf "$CACHE" --include-from="transfer_files.log" --files-only --recursive --min-size=0)" ]]; then
echo "Files present to transfer."
touch copied
exit 0
fi
@ayufan
ayufan / rclone-cached.sh
Created June 20, 2025 16:50
Rclone copy via cache folder: HDD > SSD (cache) > Target
#!/bin/bash
set -euo pipefail
if [[ "$1" == "--to-cache" ]]; then
echo "Copying file(s) to cache..."
if ! rclone -P copy "$SOURCE" "$CACHE" --max-transfer="$CACHE_SIZE" --exclude-from="transferred_files.log" --transfers="$MAX_TRANSFERS" --buffer-size=16M; then
echo "Some files were copied."
fi
@ayufan
ayufan / klippy-loader.py
Created March 2, 2025 16:37
Klipper Loader to allow extras out of box
#!/usr/bin/env python
import sys
import os
import fnmatch
import klippy
klippy_path = os.path.dirname(klippy.__file__)
matching_path = os.path.join(klippy_path, 'extras', '*.py')
@ayufan
ayufan / nordvpn.sh
Last active October 13, 2024 12:07
OpenWRT script to dynamically assign Wireguard NordVPN host based on closest or country
#!/bin/sh
#set -x
URL="https://api.nordvpn.com/v1/servers/recommendations?&filters\[servers_technologies\]\[identifier\]=wireguard_udp&limit=1"
if [[ -n "$DRY" ]]; then
uci() {
echo "uci: $@"
}
@ayufan
ayufan / klipper-make
Last active February 17, 2024 09:28
Easily manage many klipper configs
#!/bin/bash
case "$1" in
config-*)
CONFIG_NAME="$1"
;;
configs)
cd ~/klippy-configs
ls -1 klipper-config-*
@ayufan
ayufan / rpi-4b-sd-usb3.md
Last active February 6, 2023 17:58
RaspberryPI 4B SD card tests over USB3 card reader

Sandisk 32GB Ultra A1 (2022)

	Command line used: iozone -e -I -a -s 100M -r 16k -r 512k -r 1024k -i 0 -i 1 -i 2 -f test
  
                                                              random    random     bkwd    record    stride                                    
              kB  reclen    write  rewrite    read    reread    read     write     read   rewrite      read   fwrite frewrite    fread  freread
          102400      16     9133     8666    21972    20186    19566     9457                                                                
          102400     512    18792    18809    68554    73029    65743    19684                                                                
          102400    1024    18777    15908    60207    65950    70765    18875    
@ayufan
ayufan / bluetooth-copy.bash
Created October 14, 2022 15:08
Steam Deck dual-boot copy Windows Bluetooth Paring
#!/bin/bash
if [[ $# -ne 1 ]]; then
echo "usage: $0 <windows-partition>"
echo " ex.: $0 /dev/nvme0n1p10"
echo " ex.: $0 /dev/mmcblk0p3"
exit 1
fi
if [[ $(id -u) != 0 ]]; then
@ayufan
ayufan / rpi0-2w.md
Last active August 4, 2025 22:33
RPI0/2W optimisation + Hyperpixel/Fsytec CTP

/boot

cp /boot/bcm2710-rpi-3-b.dtb /boot/bcm2710-rpi-zero-2.dtb /boot/bcm2710-rpi-zero-2-w.dtb

/boot/config.txt append

dtoverlay=disable-bt
diff --git a/arch/arm64/boot/dts/rockchip/rk3399-device.dts b/arch/arm64/boot/dts/rockchip/rk3399-device.dts
index e4afa22cf658..3344ce45d5c8 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399-device.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3399-device.dts
@@ -658,6 +658,11 @@ accelerometer@68 {
interrupts = <RK_PC6 IRQ_TYPE_LEVEL_LOW>;
vdd-supply = <&vcc_1v8>;
vddio-supply = <&vcc_1v8>;
+
+ mount-matrix =
@ayufan
ayufan / run-omnibus.sh
Created March 5, 2020 17:52
Run Omnibus GitLab
#!/bin/bash
set -ex
IMAGE="${1:-gitlab/gitlab-ce:latest}"
shift
tmp_dir=$(mktemp -d -t ci-XXXXXXXXXX)
trap "rm -rf $tmp_dir" EXIT