Skip to content

Instantly share code, notes, and snippets.

View hall757's full-sized avatar
🌎
Consuming oxygen... unless this is a simulation!

Randy Hall hall757

🌎
Consuming oxygen... unless this is a simulation!
View GitHub Profile
@hall757
hall757 / gist:19e5a0006198362db81d52cf24eb84e2
Created February 4, 2018 20:28
Enable Apple Superdrive on Google PIxelbook dev mode
# From my .bashrc
# Thanks to https://github.com/onmomo/superdrive-enabler
SDE=/usr/local/sbin/superdriveEnabler
if [ ! -f $SDE ]; then
curl -s -o $SDE https://raw.githubusercontent.com/onmomo/superdrive-enabler/master/dist/x86_64/superdriveEnabler_x86_64
chmod a+x $SDE
fi
SDERULES=/etc/udev/rules.d/99-superdrive.rules
if [ -f $SDE ]&&[ ! -f $SDERULES ]; then
@hall757
hall757 / s3_clean_path.sh
Created September 12, 2023 20:50
Remove folder objects from S3 bucket so that when files are removed, the containing folders disappear when empty.
#!/bin/bash
# $1 - BUCKET - The S3 bucket to scan
# $2 - PATH_TO_CLEAN - The base path to clean. This will
# select only subfolders of this path. No leading
# or trailing slash.
# $3 - DEPTH_TO_KEEP - The number of levels of folders
# to exclude from PATH_TO_CLEAN. All folder objects
# below this level will be removed. If files still
# exist in the folder, the folder will remain visable.
@hall757
hall757 / parse_yaml.sh
Created September 13, 2023 19:24
parse yaml file into bash env vars
#!/bin/bash
function parse_yaml {
local prefix=$2
local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034')
sed -ne "s|^\($s\):|\1|" \
-e "s|^\($s\)\($w\)$s:$s[\"']\(.*\)[\"']$s\$|\1$fs\2$fs\3|p" \
-e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 |
awk -F$fs '{
indent = length($1)/2;
vname[indent] = $2;
@hall757
hall757 / delete_old_mail.py
Created September 13, 2023 19:26 — forked from Rathgore/delete_old_mail.py
Simple script to delete old messages in an IMAP mailbox
MAIL_SERVER = ''
USERNAME = ''
PASSWORD = ''
MAILBOX = 'Spam'
MAX_DAYS = 7 # Deletes messages older than a week
import imaplib
import datetime
today = datetime.date.today()
@hall757
hall757 / VPNConfigurationProfiles.mobileconfig
Created September 13, 2023 19:26 — forked from thomaswitt/VPNConfigurationProfiles.mobileconfig
An OnDemand VPN iOS profile for iPad and iPhone that automatically connects you to different VPNs (e.g. Meraki, FRITZ!Box and Streisand) | Blog-Entry: https://thomas-witt.com/auto-connect-your-ios-device-to-a-vpn-when-joining-an-unknown-wifi-d1df8100c4ba
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PayloadContent</key>
<array>
<!-- Home: Manual -->
<dict>
<key>UserDefinedName</key>
@hall757
hall757 / aws-sigv4-ssm-get-parameter.sh
Created September 13, 2023 19:26 — forked from slawekzachcial/aws-sigv4-ssm-get-parameter.sh
Using CURL to call AWS ReST API, signing request with v4 signature
#!/bin/bash
# Source: https://docs.aws.amazon.com/general/latest/gr/sigv4-signed-request-examples.html
[[ -n "${AWS_ACCESS_KEY_ID}" ]] || { echo "AWS_ACCESS_KEY_ID required" >&2; exit 1; }
[[ -n "${AWS_SECRET_ACCESS_KEY}" ]] || { echo "AWS_SECRET_ACCESS_KEY required" >&2; exit 1; }
readonly parameterName="SlawekTestParam"
readonly method="POST"
@hall757
hall757 / aerohive.md
Created September 13, 2023 19:27 — forked from samdoran/aerohive.md
Configuring Aerohive access points using the CLI

Aerohive

Initial setup

  1. Reset to factory defaults

     reset config bootstrap
     reset config
    
  2. Configure interfaces

@hall757
hall757 / AP230 Client.md
Created September 13, 2023 19:27 — forked from atomspring/AP230 Client.md
Aerohive AP230 wireless client bridge

AP230 Wireless Client Bridge Setup

This is a quick guide to setting up your AP230 as a wireless client bridge, allowing any devices plugged in via eth0 to communicate with the network of the connected SSID. Note that this config uses NAT, and I cannot figure out how to set a static IP for the "WAN" interface, so DHCP it is.

Setup steps

  1. Connect a console cable to to the "console" port (or do step two, SSH into the address which appears on your network)
  2. After providing power to the AP (either with PoE or 12v/1a connector), hold the reset button for 30s (or login and execute reset config bootstrap, reset config)
  3. Default login: admin:aerohive
  4. Basic Administravia:
@hall757
hall757 / README.md
Created September 13, 2023 20:22 — forked from danielepolencic/README.md
Create 3 nodes Kubernetes cluster locally with Vagrant

3 Virtual Machines Kubernetes cluster

Dependencies

You should install VirtualBox and Vagrant before you start.

Creating the cluster

You should create a Vagrantfile in an empty directory with the following content:

@hall757
hall757 / make_exclusion_regexp.md
Created September 15, 2023 16:53
Combine one or more inclusion regex with one or more exclusion regex to form a single exclusion regex.

Make Exclusion Regular Expression

Combine one or more inclusion regex with one or more exclusion regex to form a single exclusion regex. This is based on a negative forward lookup to turn an inclusion into an exclusion.

  • ^((?!( regexp_to_invert )).)*$
 # takes single regexp as string or multiple as array, or nil