Skip to content

Instantly share code, notes, and snippets.

View florianbussmann's full-sized avatar
📚
💻

Florian Bussmann florianbussmann

📚
💻
View GitHub Profile
@florianbussmann
florianbussmann / build_clickhouse.sh
Created April 12, 2024 14:38
ClickHouse build with ccache
CMAKE_FLAGS='-DENABLE_THINLTO=' ./docker/packager/packager --cache ccache --package-type=deb --output-dir "./$(git rev-parse --show-cdup)/build_results"
@florianbussmann
florianbussmann / cleanup.sh
Created April 3, 2024 20:06
Cleanup synoreport
# Keep only one monthly datapoint generated from Storage Analyzer
## dry run to show remaining folders
find ./20*-* -maxdepth 0 -type d -regex './20[0-9][0-9]-[0-9][0-9]-12_00-00-[0-9][0-9]' -print
## perform cleanup
find ./20*-* -maxdepth 0 -type d ! -regex './20[0-9][0-9]-[0-9][0-9]-12_00-00-[0-9][0-9]' -exec rm -rfv {} +
@florianbussmann
florianbussmann / bliss.cd
Last active September 17, 2023 17:31
Backup Bliss
./adb -e shell
su -
tar --dereference --create /data/user/ 1> /sdcard/tmp/backup-data-$(date +%Y%m%d).tar 2> /sdcard/tmp/backup-data-$(date +%Y%m%d).err
./adb -e pull /sdcard/tmp/ "\\TARGET\Bliss OS"
@florianbussmann
florianbussmann / wsa.cmd
Last active August 31, 2023 16:42
Windows Subsystem for Android
# pull data
./adb -e pull /sdcard/ "\\TARGET\YYYY-MM_WSA\sdcard"
# userdata backup
copy %LOCALAPPDATA%\Packages\MicrosoftCorporationII.WindowsSubsystemForAndroid_8wekyb3d8bbwe\LocalCache\*.vhdx "\\TARGET\YYYYMMDD_WSA_%USERNAME%"
@florianbussmann
florianbussmann / debug.sh
Last active August 18, 2023 10:51
Enable ADB debugging
## Delete persist.sys.usb.config from /data/property/persistent_properties (defaults to none and overrides build.prop)
adb pull /data/property/persistent_properties
# modify as needed
adb push persistent_properties /data/property/persistent_properties
adb shell
raphael:/ # chmod 600 /data/property/persistent_properties
## Add persist.sys.usb.config to build.prop
raphael:/ # mount /dev/block/bootdevice/by-name/system
@florianbussmann
florianbussmann / pull.sh
Last active August 18, 2023 10:52
adb pull
adb pull /data/media/ "\\TARGET\data\media"
@florianbussmann
florianbussmann / plex_grants.sh
Created July 25, 2023 04:52
Grant Plex Media Server permissions to directory
setfacl -R -m u:plex:rwx <directory>
@florianbussmann
florianbussmann / ssh_tcp_forwarding.MD
Last active July 16, 2023 18:08
ssh_tcp_forwarding

e. g. for rclone config update on headless machine

requirements

In /etc/ssh/sshd_config set AllowTcpForwarding yes

systemctl restart sshd

forwarding

ssh -L 53682:127.0.0.1:53682 user@host -p -4 -g -N

@florianbussmann
florianbussmann / extract_large.sh
Created May 22, 2023 05:43
Move large files away
find "/media/pi/" -type f -name *.mp4 -size +3G -print0 | xargs -d '\n' -0 sh -c '
for file do
echo "$file"
destination="'"../large"'"
mkdir -p "$destination/${file%/*}"
mv -v "$file" "$destination/$file"
done'
@florianbussmann
florianbussmann / cleanup_shorts.sh
Last active May 21, 2023 21:28
Clean videos by duration threshold
find . -type f -name *.mp4 -size -10M -print0 | xargs -d '\n' -0 sh -c '
for file do
echo "$file"
duration=`/volume1/@appstore/ffmpeg/bin/ffprobe -i "$file" -show_entries format=duration -v quiet -of csv="p=0"`
echo $duration
if [ "${duration%.*}" -lt 10 ]; then
echo "Lower than threshold"
rm -v "$file"
fi
done'