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 / gitcheats.txt
Created November 21, 2022 19:03 — forked from mkhairi/gitcheats.txt
git cheats
# shortform git commands
alias g='git'
# push changes to an empty git repository for the first time
git push --set-upstream origin master
# Remove + and - from start of diff lines
git diff --color | sed "s/^\([^-+ ]*\)[-+ ]/\\1/" | less -r
# clear out git hooks

Horizontal Tab Menu Slider v0.2

Responsive Horizontal Tab Menu Slider with left and right arrow key navigation. Built with Stylus and jQuery.

Show case your content with this easy to implement presentation.

A Pen by Ettrics on CodePen.

License.

@zerwes
zerwes / orphaned_packages.py
Created September 1, 2022 06:47
find packages not distributed by the current distro - for example after doing what you should never do: a dist upgrade from ubuntu to debian :-)
#! /usr/bin/env python3
# apt install python3-apt
import apt
cache = apt.Cache()
for pkg in cache:
if cache[pkg.name].is_installed:
continue
if cache[pkg.name].candidate:
continue
print(pkg.name)
@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 [email protected] [email protected]
-- This function searches redis like this:
-- "SSCAN" "[email protected]" "0" "MATCH" "[email protected]"
# 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