Skip to content

Instantly share code, notes, and snippets.

View GeertHauwaerts's full-sized avatar

Geert Hauwaerts GeertHauwaerts

View GitHub Profile
<?php
new IdelonAnvilMaterials([
'Bullfrog Horn',
'Frog Leg',
'Frog Leg',
'Bullfrog Horn',
'Spore Cap',
'Spore Cap',
'Spore Cap',
@GeertHauwaerts
GeertHauwaerts / README.md
Created February 15, 2023 18:04
Wireguard on AWS - Out-Of-Order Packets

If you setup a Wireguard on AWS, the tunnel MTU is set inherited from the AWS primary NIC, which is set to 9000 and Wireguard will set the tunnel MTU to 8921.

On your Wireguard server, set the MTU size of the AWS primary interface to 1500 to resolve the issue.

@GeertHauwaerts
GeertHauwaerts / add_remove_dns_hosts.bat
Created December 15, 2021 21:22
Windows Batch: Add and Remove from Hosts
@REM ==
@REM Windows Batch: Add and Remove from Hosts
@REM ==
@ECHO OFF
SETLOCAL EnableDelayedExpansion
SET HOSTS=C:\Windows\System32\drivers\etc\hosts
SET DNS[0]=1.1.1.1 cat.example.com x-cat.example.com
SET DNS[1]=2.2.2.2 dog.example.com x-dog.example.com
@GeertHauwaerts
GeertHauwaerts / check_mx.php
Created March 11, 2021 12:46
PHP - Check MX Records Against IP Bans
<?php
$domain = 'spamdomain.com';
function banMxServer($domain) {
$banlist = [
'1.2.3.4',
'2.3.4.5',
];
@GeertHauwaerts
GeertHauwaerts / dns_route53.py.diff
Created July 30, 2020 10:10
Add support for AWS profiles in certbot-dns-route53
diff -Naur certbot_dns_route53.old/dns_route53.py certbot_dns_route53/dns_route53.py
--- certbot_dns_route53.old/dns_route53.py 2018-04-04 21:56:02.000000000 +0000
+++ certbot_dns_route53/dns_route53.py 2020-07-30 09:48:12.413712711 +0000
@@ -33,9 +33,15 @@
def __init__(self, *args, **kwargs):
super(Authenticator, self).__init__(*args, **kwargs)
- self.r53 = boto3.client("route53")
+ session = boto3.Session(profile_name=self.conf('profile-name'))
+ self.r53 = session.client("route53")
@GeertHauwaerts
GeertHauwaerts / matomo.vcl
Created February 5, 2020 08:54
Matomo - Varnish Configuration - VCL
probe matomo_health {
.url = "/";
.interval = 5s;
.timeout = 3s;
.window = 5;
.threshold =3;
}
backend matomo_1 {
.host = "10.0.0.1";
@GeertHauwaerts
GeertHauwaerts / CLI
Last active July 29, 2019 13:14
Slim3 - PHP sessions with Eloquent backend
$ composer require slim/slim
$ composer require nesbot/carbon
$ composer require illuminate/database
$ composer require andrewdyer/slim3-session-middleware
@GeertHauwaerts
GeertHauwaerts / voipbl.sh
Last active March 6, 2019 12:31
Fast VoIPBL implementation with iptables-restore
#!/bin/bash
##
# Fast VoIPBL implementation with iptables-restore.
#
# This is a very fast method (3-5 seconds) to apply and refresh the VoIPBL
# blacklist by using iptables-restore.
#
# The default wget/awk method takes between 30-60 minutes to apply, and
# leaves the server exposed during the process.
@GeertHauwaerts
GeertHauwaerts / removeDuplicates.php
Created November 29, 2018 22:05
PHP - MonogoDB - Remove duplicates
<?php
/**
* This example assumes:
* _id: entry unique key
* field: a field that is not unique, but you want to remove all
* entries that have the same value while keeping the first entry.
*/
$duplicates = $collection->aggregate([
@GeertHauwaerts
GeertHauwaerts / ping-report.php
Created August 21, 2018 11:49
Create an outage report based on a ping log file
<?php
/**
* Create an outage report based on a ping log file.
*
* Command: ping <target> -DO >> ping.log
*/
$report = [