Skip to content

Instantly share code, notes, and snippets.

View SpareSimian's full-sized avatar

SpareSimian

  • San Pablo, CA, US
View GitHub Profile
@SpareSimian
SpareSimian / BuildBoost.cmd
Created April 13, 2019 05:16
Build Boost binary libraries with several Visual Studio versions
@rem build all variants needed of Boost library
@rem debug/release, static/dynamic CRT linkage, 32/64 bit
@rem vc10/vc12/vc14/vc141/vc142
@rem run from %boost_root% directory
pushd %boost_root%
call .\bootstrap.bat --without-python
@rem Visual Studio 2019
@SpareSimian
SpareSimian / aws-ip-ranges-to-zones.py
Created June 6, 2019 17:32
Dump AWS netblocks into zone files for use as ipsets
#!/usr/bin/env python
# download the current Amazon AWS list of netblocks and dump it into
# two files, one each for IPv4 and IPv6. The result can be imported
# into firewalld ipsets using --add-entries-from-file
import requests
ipv4_filename = 'AmazonAWS_ipv4.zone'
ipv6_filename = 'AmazonAWS_ipv6.zone'
@SpareSimian
SpareSimian / ipdeny-to-NonUS.py
Created August 2, 2019 20:25
Non-US ipset from whois database via ipdeny website
#!/usr/bin/env python
# See http://www.ipdeny.com/ipblocks/
# allow function-like print when using Python 2
from __future__ import print_function
import argparse
import requests
import io
@SpareSimian
SpareSimian / BuildAllVC16.cmd
Created April 11, 2021 18:08
Build all variants of wxWidgets for Visual Studio 2019
@rem build all variations for VC16
@rem if running on 32 bit, we need to use the cross compiler for 64 bit
reg Query "HKLM\Hardware\Description\System\CentralProcessor\0" | find /i "x86" > NUL && set "OSWIDTH=32BIT" || set "OSWIDTH=64BIT"
if "%OSWIDTH%"=="32BIT" set VSAMD64=x86_amd64
if "%OSWIDTH%"=="64BIT" set VSAMD64=amd64
if "%OSWIDTH%"=="" exit /B 1
@echo using %VSAMD64% for 64 bit builds
@SpareSimian
SpareSimian / isc-leases-to-json.pl
Created March 7, 2022 03:57
Convert ISC dhcpd.leases file to JSON
#!/usr/bin/perl
use strict;
use warnings;
use JSON;
use experimental qw(switch);
my %leases;
my %current_lease;
my $current_lease_ip;
@SpareSimian
SpareSimian / dumpFail2bans.pl
Last active October 9, 2022 17:51
List bans in fail2ban database
#!/usr/bin/perl -T -w
# dump current fail2ban bans for all jails in jail order, for use in
# daily emailed reports
use strict;
use DBI;
sub formatBantime {
my $banDurationSeconds = $_[0];
@SpareSimian
SpareSimian / asntoipset.py
Created November 30, 2022 01:52
Convert a list of records from iptoasn.com to a firewalld ipset XML file.
#!/usr/bin/env python3
""" Convert a list of records from iptoasn.com to a firewalld ipset XML file.
Download https://iptoasn.com/data/ip2asn-v4.tsv.gz, uncompress, filter
with grep, and feed to this script to generate a file to place in
/etc/firewalld/ipsets for use in firewall rules.
Example:
wget -q -O - https://iptoasn.com/data/ip2asn-v4.tsv.gz | \
@SpareSimian
SpareSimian / netstats2lcd.py
Last active May 25, 2023 09:23
Display interface bit rates on Adafruit LCD display for eth0 and eth1
import copy
import time
import Adafruit_CharLCD as LCD
ifstats = {
"eth0": { "tx": 0, "rx": 0 },
"eth1": { "tx": 0, "rx": 0 }
}
ifnames = [ "eth0", "eth1" ]
@SpareSimian
SpareSimian / WoWAddonMinimalPackager
Last active April 7, 2024 00:07
WoW addon automatic release generation for WoWUp addon manager
Minimal steps to publish a World of Warcraft addon for use by multiple addon updaters.
Start by installing a simple GitHub "workflow". This describes a
GitHub action that will be invoked when you push an annotated tag to
your repository. The action will spawn a virtual machine and run a
script that checks out your addon, zips it up in a format suitable
for various addon updater programs, and creates a GitHub "Release".
You can grab a minimal version of this file here: