Skip to content

Instantly share code, notes, and snippets.

View zish's full-sized avatar

Jeremy Melanson zish

View GitHub Profile
@zish
zish / uri_delay_throttle-irule.tcl
Created December 8, 2022 23:15
Greylisting iRule for F5 load-balancers, to incrementally throttle requests to matching URIs.
# Author: Jeremy Melanson <1080872+zish@users.noreply.github.com>
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
#
# This is an iRule for the F5 Big-IP family of load-balancers. It creates
# a "greylisting" mechanism for individual URIs, by incrementally delaying
# the time it # takes to send the backend's response.
#
# This can be particularly useful for API calls that might contain a higher
# potential for denial-of-service attacks, without restricting non-matching
@zish
zish / bash_crude_parallelization.sh
Last active December 21, 2018 19:16
Bash multi forking (not multithreading). Crude way of creating a limited number of child processes, while allowing to perform a set number of tasks.
#!/usr/bin/env bash
func () {
#-- These will make sense shortly.
local TMP_NAME="${1}-${2}"
local TMP_FILENAME="/tmp/Xout-${TMP_NAME}.tmp"
#-- We just assume that if it exists, it's there from a previous run.
# Se we just removw it.
if [ -e ${TMP_FILENAME} ]; then /bin/rm -f ${TMP_FILENAME}; fi
@zish
zish / vpnc-script
Last active June 13, 2022 18:47
OpenConnect vpnc-script for for MacOS High Sierra. Resolves problem with split DNS.
#!/bin/sh
#
# Originally part of vpnc source code:
# © 2005-2012 Maurice Massar, Jörg Mayer, Antonio Borneo et al.
# © 2009-2012 David Woodhouse <dwmw2@infradead.org>
#
# 2018-05-15 - Minor scutil updates for MacOS Split DNS added by Jeremy Melanson ( https://github.com/zish ).
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@zish
zish / terraform_bash_completion.sh
Last active December 7, 2023 09:24
Better Terraform Bash Completion
# Bash Terraform completion
#
# Originally adapted from
# https://gist.github.com/cornfeedhobo/8bc08747ec3add1fc5adb2edb7cd68d3
#
# Author: Jeremy Melanson
#
# Features of this version:
# - Uses built-in bash routines for text processing, instead of external tools
# (awk, sed, grep, ...).