Skip to content

Instantly share code, notes, and snippets.

@apfelchips
apfelchips / .stignore_synced
Last active August 21, 2024 13:22
Backup / Sync exclusion patterns
// https://docs.syncthing.net/users/ignoring
// (?d) prefix to allow deletion of ignored files
// (?i) prefix makes the matching case insensitive
// echo #include .stignore_synced >> .stignore
(?d)(?i).Trash
(?d).DS_Store
._*
(?d)(?i)Thumbs.db
@apfelchips
apfelchips / cdm_fio.sh
Last active February 5, 2024 23:48 — forked from snizovtsev/cdm_fio.sh
Reproducing CrystalDiskMark tests with fio - fixes for https://unix.stackexchange.com/revisions/480191/9
#!/usr/bin/env bash
## This script is based on https://unix.stackexchange.com/revisions/480191/9 and https://gist.github.com/snizovtsev/1e57da4bf1cdae16599d59619600ee07
LOOPS=1 #How many times to run each test
SIZE=32 #Size of each test, multiples of 32 recommended for Q32 tests to give the most accurate results.
WRITEZERO=0 #Set whether to write zeroes or randoms to testfile (random is the default for both fio and crystaldiskmark); dd benchmarks typically only write zeroes which is why there can be a speed difference.
QSIZE=$(($SIZE / 32)) #Size of Q32Seq tests
SIZE+=m
@apfelchips
apfelchips / keyremap.sh
Last active June 23, 2025 21:35
macOS US layout fix tick location on ISO Keyboards + Capslock --> LCtrl
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
if [ "$(id -u)" -ne 0 ]; then
echo "Script has to be run as root"
exit 1
fi
KEYMAP=$(cat << EOF | tr -d ' ' | grep -v '^#' | tr -d '\n'
@apfelchips
apfelchips / .lftp.mockup.rc
Created June 21, 2025 09:49 — forked from gaubert/.lftp.mockup.rc
~/.lftp.rc parameters detailed
########## SETTINGS
# On startup, lftp executes ~/.lftprc and ~/.lftp/rc. You can place aliases and 'set' commands
# there. Some people prefer to see full protocol debug, use 'debug' to turn the debug on.
# Certain commands and settings take a time interval parameter. It has the format Nx[Nx...], where N is time amount
# (floating point) and x is time unit: d - days, h - hours, m - minutes, s - seconds. Default unit is second. E.g.
# 5h30m or 5.5h. Also the interval can be 'infinity', 'inf', 'never', 'forever' - it means infinite interval. E.g.
# 'sleep forever' or 'set dns:cache-expire never'.