my collection of code snippets
Execute a command for every line in a file:
while read in; do file "Camera/$in"; done < filtered.txt
Socks-Proxy:
ssh -N -D7070 [email protected]
du -sh --apparent-size .
git add ':(exclude)*.pdf'
git merge --allow-unrelated-histories project-a/master
Refresh KDE Desktop Icons: F5
Fix scaling issues:
QT_QPA_PLATFORM=xcb QT_SCALE_FACTOR=1 libreoffice
How to mount a qcow2 disk image:
This is a quick guide to mounting a qcow2 disk images on your host server. This is useful to reset passwords, edit files, or recover something without the virtual machine running.
Step 1 - Enable NBD on the Host
modprobe nbd max_part=8
Step 2 - Connect the QCOW2 as network block device
qemu-nbd --connect=/dev/nbd0 /var/lib/vz/images/100/vm-100-disk-1.qcow2
Step 3 - Find The Virtual Machine Partitions
fdisk /dev/nbd0 -l
Step 4 - Mount the partition from the VM
mount /dev/nbd0p1 /mnt/somepoint/
Step 5 - After you done, unmount and disconnect
umount /mnt/somepoint/
qemu-nbd --disconnect /dev/nbd0
rmmod nbd
cd $PREFIX
icinga2 feature enable debuglog
icinga2 feature disable debuglog
echo 256 > /proc/sys/fs/inotify/max_user_instances
aspell --lang=en --mode=tex check file.tex
Jump to next placeholder: Ctrl + RightArrow
Insert equation: Ctrl + Shift + N
Create movie from pictures:
mencoder "mf://*.jpg" -mf fps=10 -o fastoutput.avi -ovc copy
Execute:
let g:neovide_scale_factor = 0.9
Remove all *.pyc files:
find . -name '*.pyc' -delete
Search for pattern including all .gitignored and hidden files: rg -uu pattern
rsync -chavP -zz -e "ssh -p 8022" [email protected]:/storage/giantdisk/ targetdir/
Faster variant without checksum calculation and compression:
rsync -havP -e "ssh -p 8022" [email protected]:/storage/giantdisk/ targetdir/
See windows.md
sudo rcvboxdrv setup
Settings:
"workbench.editor.enablePreview": false,
Unmount stuck cifs mount:
sudo umount -a -t cifs -l
7z a -p -m0=lzma2 -mx=9 -mhe=on -ms=on -t7z something.7z something/
source $HOME/.cargo/env