Skip to content

Instantly share code, notes, and snippets.

View GuyPaddock's full-sized avatar

Guy Elsmore-Paddock GuyPaddock

View GitHub Profile
@GuyPaddock
GuyPaddock / kube_delete_pv_by_substring.sh
Last active March 31, 2024 02:27
Delete Kubernetes PVs that Match Specific Naming Pattern
#!/usr/bin/env bash
set -uo pipefail
PATTERN="${1}"
echo "${PATTERN}"
echo kubectl delete pvc $(kubectl get pvc | grep "${PATTERN}" | awk '{ print $1 }')
echo kubectl delete pv $(kubectl get pv | grep "${PATTERN}" | awk '{ print $1 }')
@GuyPaddock
GuyPaddock / mount_encrypted_shares.sh
Created May 2, 2023 03:27
Mount encrypted Synology volumes using key files over SSH
#!/usr/bin/env bash
##
# @file
# Mount encrypted Synology shared folders on their NAS over SSH.
#
# As long as key files are being stored securely on the system from which this
# command is being run, this approach offers more security than the
# "Key Manager" functionality native to Synology NASes since it does not store
# the encryption keys for volumes on the NAS device itself. This is because
# Synology uses the same cypher/passphrase on all NASes to decrypt keys stored
@GuyPaddock
GuyPaddock / CheckAzureAdAppSecretExpiry.ps1
Last active September 25, 2024 00:34
Use the "Az" PowerShell module to export Azure AD secret expiration dates to CSV.
##
# @file
# Check the expiration dates for all Azure AD App Registration Secrets.
#
# All applications that have secrets that have expired or that will expire in
# the next 60 days are exported to CSV.
#
# Adapted from:
# https://learn.microsoft.com/en-us/azure/active-directory/manage-apps/scripts/powershell-export-apps-with-expriring-secrets
#
@GuyPaddock
GuyPaddock / azure_ad_stats.sh
Last active May 18, 2023 00:52
Benchmark Azure AD App Proxy using a session cookie acquired from Browser Developer Tools
#!/bin/bash
##
# @file
# A script to benchmark how Azure AD App Proxy performs across multiple
# requests.
#
# If you are using pre-authentication (as you usually will be), before using
# this script, you will need to sign in using your browser and then use
# developer tools to grab your session cookie so you can paste it below.
@GuyPaddock
GuyPaddock / list_sites.sh
Last active September 11, 2023 16:56
List the installation profile version of all Drupal sites on Pantheon that are tied to the Drupal 7 upstream. (Script authored by ChatGPT 3.5).
#!/bin/bash
# Define the Pantheon upstream ID
UPSTREAM_ID="21e1fada-199c-492b-97bd-0b36b53a9da0"
# Authenticate with Terminus (replace with your authentication method)
# terminus auth:login
# Initialize the CSV output with headers
echo "Site Name,Install Profile Version"
@GuyPaddock
GuyPaddock / convert_ue_gameplay_tags_to_native.py
Last active July 5, 2024 02:24
Python Script for Converting Gameplay Tags from INI to Native CPP
#!/usr/bin/env python3
##
# Copyright 2024, Guy Elsmore-Paddock. All Rights Reserved.
#
# This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not
# distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
#
# This script can be used to convert Unreal Engine gameplay tags in INI format into native tags. See the following
# article for an overview of native gameplay tags:
# https://unrealdirective.com/tips/declare-define-native-gameplay-tags
@GuyPaddock
GuyPaddock / index_data.py
Created August 8, 2024 03:31
Loading data into Elasticsearch
import json
from elasticsearch import Elasticsearch
# Load JSON data
with open("documents.json", "r") as file:
documents_raw = json.load(file)
# Flatten the documents structure
documents = []
for course in documents_raw: