Skip to content

Instantly share code, notes, and snippets.

@Foolson
Foolson / openpgp.md
Created November 8, 2022 14:03
openpgp.md

openpgp4fpr:1fae94134b0c0dd84c02f4a365a765b2f2118faf

@Foolson
Foolson / pi-pwm-fan.py
Created November 12, 2021 17:08
pi-pwm-fan.py
#!/usr/bin/env python3
# Python modules
import time
import sys
import signal
import getopt
from rpi_hardware_pwm import HardwarePWM
# Configuration
@Foolson
Foolson / mrtg_bbk.sh
Created April 22, 2021 15:51
External monitoring scripts for MRTG using bbk_cli
#!/usr/bin/env bash
if ! command -v bbk_cli >/dev/null 2>&1
then
echo "ERROR: bbk_cli is not installed!"
echo "URL: https://github.com/dotse/bbk"
exit 1
fi
BBK_OUTPUT=$(bbk_cli --quiet)
@Foolson
Foolson / genieacs-install-debian-buster.sh
Last active May 16, 2025 08:40
Script that installs GenieACS on Debian Buster
#!/usr/bin/env bash
set -e
set -u
if [[ ! -f /etc/debian_version ]]
then
echo "Script only tested in Debian"
exit 1
else
@Foolson
Foolson / commands.cfg
Last active December 12, 2020 11:27
Nagios - Notify by Telegram
# 'notify-host-by-telegram' command definition
define command {
command_name notify-host-by-telegram
command_line notify-by-telegram -t"[TOKEN]" -c"[CHAT ID]" -m"***** Nagios Host *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n"
}
# 'notify-service-by-telegram' command definition
define command {
command_name notify-service-by-telegram
command_line notify-by-telegram -t"[TOKEN]" -c"[CHAT ID]" -m"***** Nagios Service *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n"
@Foolson
Foolson / init.vim
Created June 5, 2020 21:19
~/.config/nvim/init.vim
call plug#begin('~/.vim/plugged')
Plug 'ncm2/ncm2'
Plug 'roxma/nvim-yarp'
Plug 'ncm2/ncm2-bufword'
Plug 'ncm2/ncm2-path'
Plug 'ncm2/ncm2-jedi'
Plug 'Yggdroot/indentLine'
Plug 'dense-analysis/ale'
call plug#end()
autocmd BufEnter * call ncm2#enable_for_buffer()
import re
ipv4_pattern = re.compile(r'^1?[0-9]{1,2}\.1?[0-9]{1,2}\.1?[0-9]{1,2}\.1?[0-9]{1,2}|2[0-4][0-9]\.2[0-4][0-9]\.2[0-4][0-9]\.2[0-4][0-9]|25[0-5]\.25[0-5]\.25[0-5]\.25[0-5]$')
@Foolson
Foolson / router.md
Last active April 12, 2020 13:35
router.md

Work in progress!
I wanted to make a simple Firewall/Router setup with pure Debian and WireGuard remote access. This is what I came up with by creating a test setup with Debian 10 in VirtualBox.
It requires dnsmasq and WireGuard.

/etc/network/interfaces

enp0s3 is the WAN interface and enp0s8 is the LAN interface.
The WAN interface get's its IP from DHCP and the LAN interface has a static IP.

allow-hotplug enp0s3
iface enp0s3 inet dhcp
#!/usr/bin/env python3
import sms
import re
import sys
import argparse
import codecs
parser = argparse.ArgumentParser()
requiredNamed = parser.add_argument_group('required named arguments')
@Foolson
Foolson / chapters.py
Last active April 4, 2018 17:32
Script to add id3v2 chapters to .mp3 files
from mutagen.id3 import ID3, CTOC, CHAP, TIT2, CTOCFlags
import time
import datetime
audioFile = input("Audio file: ")
audio = ID3(audioFile)
numberOfChapters = int(input("Number of chapters: ")) + 1