Skip to content

Instantly share code, notes, and snippets.

@marvin
marvin / pretty.go
Created November 9, 2022 15:20
golang json struct helper functions
// Prints objects into json pretty output
func PrettyStruct(data interface{}) (string, error) {
val, err := json.MarshalIndent(data, "", " ")
if err != nil {
return "", err
}
return string(val), nil
}
// pretty print coded byte in json format
@marvin
marvin / cidr2iplist.py
Created March 9, 2022 11:02
a script to convert a cidr/ip network list to a list of ip addresses
#!/usr/bin/python3
# writte by David "marvin" Nölte - 2022
# this script reads a file with a list of ip subnets/cirds and outputs it to a ip list
# input file can be a list of subnets/one per line
# check "./cidr2list.py -h"
import os
import ipaddress
import argparse
@marvin
marvin / install_duplicati_ubuntu20.sh
Created November 12, 2021 13:00
install duplicati in ubuntu 20
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb https://download.mono-project.com/repo/ubuntu stable-focal main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
sudo apt update
sudo apt install mono-devel gtk-sharp2 libappindicator0.1-cil libmono-2.0-1 -y
sudo apt install apt-transport-https nano git-core software-properties-common dirmngr -y
@marvin
marvin / upgrade_Proxmox_5.4_to_7_without_CEPH.sh
Created October 22, 2021 18:55
Upgrade list to upgrade proxmox 5.4 via version 6 to version 7
proxmox upgrade from 5.4 to 7 without CEPH
## 5to6
systemctl stop pve-ha-lrm
systemctl stop pve-ha-crm
echo "deb http://download.proxmox.com/debian/corosync-3/ stretch main" > /etc/apt/sources.list.d/corosync3.list
apt update
apt dist-upgrade --download-only
apt dist-upgrade
@marvin
marvin / update_hosts.sh
Last active October 19, 2021 10:53
update hosts file on ubuntu with StevenBlack Hosts-List for porn+gamblin
#!/bin/bash
# uses gambling+porn from https://github.com/StevenBlack/hosts
# can be ran via cron
cd ~
wget https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/gambling-porn/hosts -O /tmp/hosts
sudo sed -i '/#DELETE/Q' /etc/hosts
echo '#DELETE' | sudo tee -a /etc/hosts
cat /tmp/hosts |sudo tee -a /etc/hosts
@marvin
marvin / zabbix_agent2.service
Last active October 4, 2021 10:42
centos7 Zabbix_agent2 Systemd Service Config
# install under /etc/systemd/system/zabbix_agent2.service
[Unit]
Description=Zabbix Agent 2
After=syslog.target
After=network.target
[Service]
Environment="CONFFILE=/etc/zabbix/zabbix_agentd.conf"
EnvironmentFile=-/etc/sysconfig/zabbix-agent
Type=simple
#!/bin/bash
# _ __ _
# ((-)).--.((-))
# / '' \
# ( \______/ )
# \ ( ) /
# / /~~~~~~~~\ \
# /~~\/ / \ \/~~\
# ( ( ( ) ) )
# \ \ \ \ / / / /
# nixos config for camus thinkpad T430s Laptop
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
];
@marvin
marvin / kevin_configuration.nix
Last active January 18, 2020 15:55
nixos - kevin config (work pc)
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
/ip firewall filter
add action=reject chain=forward comment="DROP DDOS-TCP ACCESS LIST" log-prefix=BLACKLIST reject-with=icmp-port-unreachable src-address-list=DDOSER-UDP
add action=add-src-to-address-list address-list=DDOSER-TCP address-list-timeout=1w chain=forward connection-limit=50,32 dst-address-list=MISAXNET protocol=tcp
add action=add-src-to-address-list address-list=DDOSER-TCP address-list-timeout=1h chain=forward dst-address-list=MISAXNET dst-limit=50,32,src-and-dst-addresses/1h \
protocol=tcp dst-port=587