Skip to content

Instantly share code, notes, and snippets.

View FlorianHeigl's full-sized avatar

Florian Heigl FlorianHeigl

View GitHub Profile
#!/bin/sh
#
# This shell script if placed in /etc/apcupsd
# will be called by /etc/apcupsd/apccontrol when apcupsd
# loses contact with the UPS (i.e. the serial connection is not responding).
# We send an email message to root to notify him.
#
HOSTNAME=`hostname`
MSG="$HOSTNAME Communications with UPS $1 lost"
@FlorianHeigl
FlorianHeigl / hosts_synology_misc
Created January 8, 2024 21:51
pfSense rules for Synology NAS
gofile.me File Sharing
checkport.synology.com Connectivity Test 82/tcp
help.synology.com Online Help (needed from NAS?)
sns.synology.com Push notification
notification.synology.com Push notification
myds.synology.com Entry added Mon, 08 Jan 2024 21:43:51 +0000
database.clamav.net Antivirus - ClamAV
myds.synology.com Antivirus - ClamAV
update.nai.com Antivirus - McAfee
docker.io Containers und C2 ID Edge
@FlorianHeigl
FlorianHeigl / yum-upgrade-output
Created January 5, 2024 16:59
yum fastestmirror country bug russia
[root@gitlab ~]# yum upgrade
Loaded plugins: etckeeper, fastestmirror, fs-snapshot, keys, post-transaction-actions, ps, rpm-warm-cache
Determining fastest mirrors
epel/x86_64/metalink | 33 kB 00:00:00
Including mirror: centos.schlundtech.de
Including mirror: mirror.speedkom.de
Including mirror: de.mirrors.clouvider.net
Including mirror: centos.intergenia.de
Including mirror: mirror1.hs-esslingen.de
Including mirror: ftp.tu-chemnitz.de
@FlorianHeigl
FlorianHeigl / README.md
Last active November 22, 2023 19:40
pfSense IPSec VPN Status
@FlorianHeigl
FlorianHeigl / mix-qr.zpl
Created August 31, 2023 18:17
zpl tests
^XA
^FO20,10^BQ,2,4^FDMM,Ahttp://netbox.ifz-muenchen.de/obj-demo-url^FS
^FO145,10^BQ,2,3^FDMM,AHALLO ICH BIMS^FS
^CF0,20
^FO143,100^FDsw-demo^FS
^XZ
@FlorianHeigl
FlorianHeigl / match-cables.py
Last active August 29, 2023 17:58
cable barcode id matcher
$ cat gpt-matchcables.py
#!/usr/bin/python3
import re
import csv
# Initialize dictionaries to store data from both CSV files
switchports_data = {}
patch_panels_data = {}
@FlorianHeigl
FlorianHeigl / nagios-oxidized.rb
Created June 25, 2023 19:55
Oxidized nagios check
#!/usr/bin/env ruby
## contrib via https://github.com/ytti/oxidized/issues/67
require 'open-uri'
require 'json'
critical = false
pending = false
critical_nodes = []
@FlorianHeigl
FlorianHeigl / nc-update.sh
Created June 19, 2023 18:43
nextcloud upgrade script with collection of db fixes, some notes for fixing typical errors with nextcloud-docker
#!/bin/bash -u
occ_wrapper='docker exec -it -u 33 nextcloud-app /var/www/html/occ'
mysql_wrapper='docker exec nextcloud-db mysql nextcloud'
upgrades_db() {
_scmds="db:add-missing-columns
db:add-missing-indices
db:add-missing-primary-keys
db:convert-filecache-bigint
@FlorianHeigl
FlorianHeigl / CentOS-Stream-AppStream.repo
Created June 11, 2023 18:23
CentOS 8 / Stream Config with local country mirrors and selecting fastest of those.
[appstream]
name=CentOS Stream $releasever - AppStream
mirrorlist=http://mirrorlist.centos.org/?release=$stream&arch=$basearch&repo=AppStream&infra=$infra&cc=de
#baseurl=http://mirror.centos.org/$contentdir/$stream/AppStream/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
@FlorianHeigl
FlorianHeigl / delete-old-snaps.ps1
Last active May 10, 2023 16:09
powershell delete vss snapshots via wmi
# source: https://github.com/MSAdministrator/PoshCodeMarkDown/blob/master/docs/Delete-Old-Shadow-Copies.ps1.md
# modified...
# TODO: only handle c:
# TODO: Never delete the last snapshot, or even better the last two?
Get-WmiObject Win32_Shadowcopy | ForEach-Object {
.InstallDate $strShadowID = $.ID $dtmSnapShotDate = [management.managementDateTimeConverter]::ToDateTime($WmiSnapShotDate) $strClientAccessible = $_.ClientAccessible $dtmCurDate = Get-Date
$dtmTimeSpan = New-TimeSpan $dtmSnapShotDate $dtmCurDate $intNumberDays = $dtmTimeSpan.Days