My Personal Cheat Sheet
A collection of commands, scripts and other snippets that I frequently or infrequently need.
First published:
19 September 2025.
This is my personal collection of notes, commands, and snippets that I often reach for (and sometimes forget). It’s a living document — a mix of quick references, gotchas, and practical examples across tools I use.
Ansible: Start at Task or Tag
Start at a specific task (by name):
Start at a specific task (by tag):
Gentoo: Entering chroot
It is assumed that the root is already mounted in /mnt/chroot
.
export MOUNTPOINT=/mnt/chroot
mount --types proc /proc "${MOUNTPOINT}/proc"
mount --rbind /sys "${MOUNTPOINT}/sys"
mount --make-rslave "${MOUNTPOINT}/sys"
mount --rbind /dev "${MOUNTPOINT}/dev"
mount --make-rslave "${MOUNTPOINT}/dev"
mount --bind /run "${MOUNTPOINT}/run"
mount --make-slave "${MOUNTPOINT}/run"
chroot "${MOUNTPOINT}"
Source: Gentoo AMD64 Handbook - Installing the Gentoo base system
Gentoo: Exiting chroot
The chroot
can obviously be left by typing exit
. This snippet does the cleanup afterwards.
It is assumed that the root is already mounted in /mnt/chroot
. Remember to leave the mountpoint first.
export MOUNTPOINT=/mnt/chroot
umount -l "${MOUNTPOINT}/run"
umount -l "${MOUNTPOINT}/dev"
umount -l "${MOUNTPOINT}/sys"
umount -l "${MOUNTPOINT}/proc"
umount -R "${MOUNTPOINT}"
Source: Gentoo AMD64 Handbook - Configuring the bootloader
libvirt: 4K Resolution with QEMU QXL
To enable 4K resolution with QXL graphics the video memory needs to be increased. The following snippet can be used as an example.
<video>
<model type='qxl' ram='262144' vram='524288' vgamem='65536' heads='1' primary='yes'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
</video>
macOS: Flush DNS Cache
When debugging DNS-related issues it may be useful to clear the DNS cache.
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
rsync: Trailing Slash Caveat
rsync
follows the convention of BSD cp, which gives special treatment to source directories with a trailing slash /
.
The following command creates a directory destination/source
with the contents of source
:
The following command copies all files in source/
directly into destination
.
Source: Arch Linux Wiki - Rsync