Skip to content

Instantly share code, notes, and snippets.

View wopfel's full-sized avatar

Bernd Arnold wopfel

  • Bavaria, Germany
View GitHub Profile
wopfel / copy-loop.cmd
Created June 1, 2014 11:46
Copy a file inside a diretory to a new file with a random name to fill (almost) all space
cd /d F:\DCIM\100EOS7D
copy IMG_5239.CR2 %RANDOM%.DAT
goto beginn
wopfel / sync-wedding-pictures.cmd
Created June 1, 2014 11:50
Synchronize (make a backup of) a folder in a loop; used during photographing a wedding ceremony; a backup is automatically created after importing the photos into the Lightroom catalog
ping -n 3600 localhost
robocopy M:\Lightroom-Bilder\2013\2013-06-15 E:\kopie_hochzeit\ /e
ping -n 30 localhost
goto beginn
wopfel / backup-mysql-db
Created July 13, 2014 11:23
Backup script for MariaDB (or MySQL). Placed in /etc/cron.hourly/. Creates a backup of all databases every hour and keeps the current plus nine previous versions.
rm "$BASENAME.$x"
while [ $x -gt 1 ]
y=$(( $x - 1 ))
wopfel / gist:3ef099fef3687d010255
Last active August 29, 2015 14:10
Raspberry Pi timelapse video (create pictures and create video). Sample values can/must be replaced.
# Create pictures ...
DESTDIR=/mnt/timelapse/series_$RANDOM && mkdir $DESTDIR && /opt/vc/bin/raspistill -o $DESTDIR/`date '+%Y-%m-%d'`_pic_%04d.jpg -t 7999000 -tl 15000
# Sample picture name including path is:
# /mnt/timelapse/series_15554/2014-12-02_pic_0001.jpg
# Create video ...
cd /mnt/timelapse/series_15554
ffmpeg -n -pattern_type glob -r 15 -i "2014-12-02_pic_*.jpg" -r 15 -vcodec libx264 -crf 25 -g 15 -vf crop=2592:1458,scale=1280:720 timelapse_2014-12-02.mp4
wopfel / gist:6150628
Last active December 20, 2015 14:59
My steps for creating an encrypted ArchLinux installation based on LVM inside a virtual machine. Meine Schritte zum Erstellen einer verschlüsselten, auf LVM basierenden ArchLinux-Installation innerhalb einer virtuellen Maschine.
Boot: archlinux-2012.10.06-dual.iso
Boot: archlinux-2012.11.01-dual.iso
Boot: archlinux-2013.01.04-dual.iso
Netzwerkkarte auf Bridge stellen, dann mit Putty einwählen
passwd ; /etc/rc.d/sshd start
loadkeys de-latin1 (loadkezs deßlatin1)
cfdisk /dev/sda
wopfel /
Last active December 28, 2015 11:59
A tiny backup script using CloneZilla Live 2.1.2.-43. The output directory is named dynamically (YYYY-MM-DD_HHMMSS-img-...) and created under /home/partimag by ocs-sr. The first three partitions are backed up (sda1, sda2, and sda3).


  • Boot from Clonezilla Live CD
  • Select "Clonezilla live" (default entry in boot menu)
  • Choose keyboard language
  • Select "Enter shell"
  • Choose "cmd" mode
  • If the script resides on /dev/sdb1, then "mount /dev/sdb1 /home/partimag" now (the mount inside the script will fail, but that doesn't matter)
  • Run script ("sudo ...")
wopfel / gist:8071781
Created December 21, 2013 16:42
Wait until a process ends (Linux, /proc filesystem, PID subdirectory, 14989 is the process ID in this example)
while [[ -d /proc/14989/ ]] ; do sleep 1 ; done
wopfel / basic-setup-archlinux-vm
Last active September 3, 2017 09:03
Basic setup for an Arch Linux VM
# Basic setup for an Arch Linux VM
# Usage in a fresh VM (example):
# # script -c 'bash basic-setup-archlinux-vm' --timing=/tmp/capture-timing /tmp/capture
# # cp /tmp/capture /mnt/root/script-installation-recording
# # cp /tmp/capture-timing /mnt/root/script-installation-recording-timing
# Exit script on any error
set -e
wopfel / delete-old-hourly-backups
Created June 16, 2018 13:17
Delete old backups
use strict;
use warnings;
use File::Path qw( remove_tree );
# Call it by ./delete-old-hourly-backups DIRNAME
# Keeps exactly 1 backup directory per day
# Assumes the following directory structure below DIRNAME/:
# back-2018-01-15T13_15_00
wopfel /
Last active July 4, 2018 15:21
Software updates

Updating my Icinga 2 VM

pacman -Syu

cd ~/icinga2
git pull
cd build
cmake -DICINGA2_WITH_PGSQL=OFF -DUSE_SYSTEMD=ON -DCMAKE_INSTALL_PREFIX=/usr/local/icinga2 -DICINGA2_PLUGINDIR=/usr/local/icinga/libexec -DCMAKE_INSTALL_LOCALSTATEDIR=/usr/local/icinga2/var ..
make -j2