Skip to content

Instantly share code, notes, and snippets.

@erikson1970
erikson1970 / tweak_fail2ban_for_escalating_bans.sh
Last active November 9, 2025 18:27
shell script to enhance fail2ban by creating 4 jails with escalating duration bans for repeat offenders
#!/bin/bash
# creates 4 jails with escalating bans for repeat offenders
# 10min --> 1 hr --> 3 hrs --> 1 day --> 1 week
# creates a filter file and jail definition file
# credit goes to https://blog.shanock.com/fail2ban-increased-ban-times-for-repeat-offenders/
# run from /etc/fail2ban
cd /etc/fail2ban
cat <<\EOF | base64 -d | tar xfvz -
H4sIAMKNrV8AA+2UUU/bMBDH++xPYalvTGscxzEMrUhsBbEJbQ9Q7aH0wWmd1Ftid44zwbfnUiCK
JjQUqdqYdL8X6+zz/e3k/s5NGbSfrKOcZ29L57aTlbP5aK8wQAqxG4HfR5aIw1GcHIqUxyyVkBcn
import socket
import argparse
from time import sleep
from datetime import datetime
import sys
wordsStore = []
try:
from essential_generators import DocumentGenerator
/*
* NAME: Arduino Mouse Jiggler
* DATE: 2020-09-17
* DESC: Arduino based mouse emulator
* VERSION: 1.0
*/
#include <Mouse.h>
//#define debug true
@erikson1970
erikson1970 / usefulPythonFuncs.py
Last active October 24, 2020 02:52
Random Useful Python one-to-two-liners
# pretty print string as Hex
pphex = lambda data:"0x0000 " + ''.join("{}{}{}".format("{0:#0{1}x}".format(ord(xxx),4)[2:] , " " if (1+i) % 8 == 0 else ":", "\t{} {}\n{} ".format(data[i-15:i-7],data[i-7:i+1],"{0:#0{1}x}".format(i,6)) if (1+i) % 16 == 0 else "") for i,xxx in enumerate(data)) + (" " if len(data) % 16 < 8 else "").join((lambda ii:[":".join([" "] *((8-ii) % 8 if ii<8 else 0)) , ":".join([" "] * (0 if ii==0 else (8-ii) % 8 if ii>8 else 8))]) (len(data) % 16)) + ("\t{} {}".format(data[-(len(data) % 16):][:8],data[-(len(data) % 16):][8:16]) if (len(data) % 16) != 0 else "")
data=b'Once upon a time in a land called Xanth, there was a king who was sad because his queen had died in childbirth of their only daughter. The princess was the \x02apple of the King\'s eye.'
#
print(pphex(data[:-5].decode("utf-8")))
#
#0x0000 4f:6e:63:65:20:75:70:6f 6e:20:61:20:74:69:6d:65 Once upo n a time
#0x000f 20:69:6e:20:61:20:6c:61 6e:64:20:63:61:6c:6c:65 in a la nd calle
#0x001f 64:20:58:61:6e:74
@erikson1970
erikson1970 / # qucs - 2020-04-10_19-25-49.txt
Created April 11, 2020 00:10
qucs (guitorri/tap/qucs) on macOS 10.15.3 - Homebrew build logs
Homebrew build logs for guitorri/tap/qucs on macOS 10.15.3
Build date: 2020-04-10 19:25:49
@erikson1970
erikson1970 / putGnuradioOnMacOSX.md
Created September 2, 2019 15:47
Compile & Install GnuRadio on MacOS-X

conda install pyyaml conda install PYGI conda install pygi conda install numpy conda install gtk2 conda install -c anaconda gtk2-cos6-x86_64

@erikson1970
erikson1970 / piAwareConfig.md
Last active May 2, 2019 19:28
Notes For configuring piaware for Portsmouth

Setup

Instruction

  • Build Instructions on [piAware website: link][1]

Download Image:

  1. Download Image: [piAware Disk Image version 3.6.3: link][2]

writing Image:

sudo dd if=piaware-sd-card-3.6.3.img of=/dev/disk3 bs=1m

@erikson1970
erikson1970 / treenode.py
Created October 11, 2018 22:07
Convert words into a searchable n-ary tree
class Node():
def __init__(self):
# Note that using dictionary for children (as in this implementation) would not allow lexicographic sorting mentioned in the next section (Sorting),
# because ordinary dictionary would not preserve the order of the keys
self.children = {} # mapping from character ==> Node
self.parent = None
self.name = ""
self.value = -1
def __str__(self):
#!/usr/bin/env python
# -*- coding: utf-8 -*- (because 0xFF, even : "Yucatán")
import os, re, sys, getopt
_words = [
["aardvark", "adroitness"], ["absurd", "adviser"], ["accrue", "aftermath"], ["acme", "aggregate"], ["adrift", "alkali"], ["adult", "almighty"],
["afflict", "amulet"], ["ahead", "amusement"], ["aimless", "antenna"], ["Algol", "applicant"], ["allow", "Apollo"], ["alone", "armistice"],
["ammo", "article"], ["ancient", "asteroid"], ["apple", "Atlantic"], ["artist", "atmosphere"], ["assume", "autopsy"], ["Athens", "Babylon"],
["atlas", "backwater"], ["Aztec", "barbecue"], ["baboon", "belowground"], ["backfield", "bifocals"], ["backward", "bodyguard"],
def gen_nonce(length):
""" Generates a random string of bytes, base64 encoded """
if length < 1:
return ''
string=base64.b64encode(os.urandom(length),altchars=b'-_')
b64len=4*floor(length,3)
if length%3 == 1:
b64len+=2
elif length%3 == 2:
b64len+=3