Skip to content

Instantly share code, notes, and snippets.

View zerwes's full-sized avatar
🤯
I may be slow to respond.

Klaus Zerwes zerwes

🤯
I may be slow to respond.
View GitHub Profile
@zerwes
zerwes / rspamd.local.lua
Created May 11, 2022 03:05
Rspamd: Simple per user Whitelist / Blacklist
-- When using Whitelist and Blacklist last result wins!
-- So maybe redis latency will decide ;)
rspamd_config.PER_USER_WL = {
-- CAUTION: This will whitelist the mail for every recipient when there is
-- match for any recipient
-- ADD a WL entry with: SADD RS_UWL_recipient@address.com sender@example.net
-- This function searches redis like this:
-- "SSCAN" "RS_UWL_recipient@address.com" "0" "MATCH" "sender@example.net"
# urls
https://badgen.net/badge/support/UKRAINE/?color=0057B8&labelColor=FFD700
https://badgen.net/badge/stand%20with/UKRAINE/?color=0057B8&labelColor=FFD700
# embedded badge in github markdown
![stand with Ukraine](https://badgen.net/badge/support/UKRAINE/?color=0057B8&labelColor=FFD700)
![stand with Ukraine](https://badgen.net/badge/stand%20with/UKRAINE/?color=0057B8&labelColor=FFD700)
@zerwes
zerwes / sambadcrename.md
Last active February 19, 2022 18:06
rename the single DC in a samba domain

rename the single DC in a samba domain

samba backup and restore with new DC name

# service samba-ad-dc stop
# mkdir sambabackup-20220213-offline
# samba-tool domain backup offline --targetdir=/root/sambabackup-20220213-offline
# mv /var/lib/samba /var/lib/samba.bakup
# samba-tool domain backup restore --newservername=DC01 --backup-file=/root/sambabackup-20220213-offline/samba-backup-2022-02-13T19-38-42.702607.tar.bz2 --targetdir=/var/lib/samba
# vim /etc/samba/smb.conf # set new "netbios name"
@zerwes
zerwes / haproxy.cfg
Created January 19, 2022 15:27 — forked from jriguera/haproxy.cfg
Haproxy for Multimaster MySQL cluster
#---------------------------------------------------------------------
# Global settings
#---------------------------------------------------------------------
global
# to have these messages end up in /var/log/haproxy.log you will
# need to:
#
# 1) configure syslog to accept network log events. This is done
# by adding the '-r' option to the SYSLOGD_OPTIONS in
# /etc/sysconfig/syslog
@zerwes
zerwes / nmcli-vlan.md
Created November 18, 2021 08:39
nmcli vlan

add vlan interface

nmcli con add type vlan ifname VLAN1 dev enp0 id 1 where:

  • enp0 is the interface name
  • 1 the vlan ID

remove vlan interface

nmcli con del vlan-VLAN1
# alternative
ip link del
@zerwes
zerwes / nmcli find psk
Created October 1, 2021 07:51
linux networkmanager: find passwords of stored wifi connections
## list connections
nmcli c
## get the password of a specific connection
## where XXX is the NAME or UUID from the list above
nmcli --show-secrets c show XXX | grep psk
@zerwes
zerwes / opnsensefilterlogsplit.sh
Created June 8, 2021 03:23
opnsense filterlog split up in human readable format
#! /bin/sh
clog -f /var/log/filter.log | sed 's/ \+/,/g' | awk 'BEGIN { FS = "," } ; {print "iface:"$5" action:"$7" dir:"$8" proto:"$17" src:"$19" dst:"$20" sport:"$21" dport:"$22}'
@zerwes
zerwes / gnome-terminal-profiles.adoc
Created October 16, 2019 08:32
Export / Import Gnome Terminal Profiles

Export Gnome Terminal Profile

List profiles

dconf dump /org/gnome/terminal/legacy/profiles:/

Determine the terminal profile string for the profile you will need. This is the terminal profile that I will export:

@zerwes
zerwes / gist:b725b977b828c75736adf613dae695e8
Created March 14, 2018 13:16 — forked from CristinaSolana/gist:1885435
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@zerwes
zerwes / ipsec.pl
Created January 4, 2018 12:48 — forked from rlsit/ipsec.pl
sophos SG restart stalled ipsec tunnels
#! /usr/bin/perl -w
use strict;
use warnings;
use Astaro::ConfdPlRPC;
use Data::Dumper;
use Try::Tiny;
my $restartall = 0;