Skip to content

Instantly share code, notes, and snippets.

View GeertHauwaerts's full-sized avatar

Geert Hauwaerts GeertHauwaerts

View GitHub Profile
@GeertHauwaerts
GeertHauwaerts / gist:2f9793c54ba95a44ff41
Last active September 8, 2015 22:54
PHP - Display an array as a formatted text table
<?php
/**
* Display an array as a formatted text table
*
* This class converts an array into a formatted table and supports dynamic column widths,
* text appending, typecasting and customer header naming.
*
* @author Geert Hauwaerts <[email protected]>
* @copyright Copyright (c) 2015, Geert Hauwaerts
#!/usr/bin/env php
<?php
/**
* team-reflex/discord-php example.
*
* This is a simple example use of team-reflex/discord-php :)
*
* @author Geert Hauwaerts <[email protected]>
* @copyright Copyright (c) Geert Hauwaerts
@GeertHauwaerts
GeertHauwaerts / spoof.diff
Created April 12, 2017 18:41
IRCnet IRCd spoof patch
diff --git a/common/struct_def.h b/common/struct_def.h
index 08a0bc6..dcca168 100644
--- a/common/struct_def.h
+++ b/common/struct_def.h
@@ -192,6 +192,7 @@ typedef enum Status {
#define FLAGS_RESTRICT 0x0010 /* restricted user */
#define FLAGS_AWAY 0x0020 /* user is away */
#define FLAGS_EXEMPT 0x0040 /* user is exempted from k-lines */
+#define FLAGS_SPOOFED 0x0080 /* user is spoofed */
#ifdef XLINE
@GeertHauwaerts
GeertHauwaerts / jpythonURL.py
Created May 11, 2018 09:20
Example Java.IO URL with JSON POST in jPython
import os
import json
from java.net import URL
from java.io import DataOutputStream
data = json.dumps({
'content': 'a test'
})
@GeertHauwaerts
GeertHauwaerts / discord_example.py
Last active May 11, 2018 09:30
Example Discord webhook in jPython
##
# This example is intented for jPython environments (like SikuliX) where you can't use
# requests or urllib2.
##
import os
import sys
import json
from java.net import URL
@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 = [
@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 / 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 / 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 / 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";