Skip to content

Instantly share code, notes, and snippets.

View wopfel's full-sized avatar

Bernd Arnold wopfel

  • Bavaria, Germany
View GitHub Profile
set HEUTE=%date:~6,4%-%date:~3,2%-%date:~0,2%
mkdir %HEUTE%
wopfel / check_pihole_updates
Created August 13, 2020 17:45
A check script for Icinga // checks for pihole updates
use strict;
use warnings;
# Sample output:
# pihole2# pihole -up --check-only
# [i] Checking for updates...
# [i] Pi-hole Core: update available
# [i] Web Interface: update available
wopfel /
Created September 28, 2019 15:17
Read a .js file from STDIN and write JSON-compatible output (suitable for jq)
# Description:
# Read a .js file from STDIN and write JSON-compatible output (suitable for jq)
# The input file in the format ...
# var data = { "run": [...
# cannot be read by jq directly. This script transforms a javascript file to json output.
use strict;
wopfel /
Last active September 28, 2019 17:19
Create lxc container on a Proxmox VE host
lvcreate -V8G -T vg_ssd_evo/vms3 -n vm-$NEXTID-disk-0
wopfel / test-image.php
Created November 27, 2018 19:45
Detect LED state from image created by Raspberry Pi (raspistill)
# PiCam is placed on Buderus control panel
# /opt/vc/bin/raspistill -ISO 200 -t 3000 -rot 270 -awb shade -o /tmp/test.jpg
# Sorry, this may be a poor description
$img = imagecreatefromjpeg( "/tmp/test.jpg" );
wopfel /
Last active November 17, 2018 17:53
Prepare SD card for Raspberry Pi / ArchLinuxARM
# Call: ./ /dev/sdX
# Danger! May wipe the wrong data...
exit 99
# This script also copies a public key to the SSH authorized_keys file for the root user (ansible, here)
set -e
wopfel /
Last active August 14, 2018 14:45
Show a=b data from text lines as grid / matrix

Show data as grid / matrix

Assuming you have an input file like this one ...

horse	green
horse	blue
dog	green
dog	red
dog	yellow
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
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 / 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