Skip to content

Instantly share code, notes, and snippets.

View GuyPaddock's full-sized avatar

Guy Elsmore-Paddock GuyPaddock

View GitHub Profile
@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:
@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 / 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 / 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 / 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 / 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 / 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 / list-issues.sh
Last active January 17, 2023 19:22
Extract Issue Tags from Commit History in a Branch Based Off develop
#!/usr/bin/env bash
##
# @file
# Extracts all of the issue tags in commit messages of a branch_ref and lists them.
#
# Usage:
# list-issues.sh [branch_ref ref] [base branch_ref ref]
#
# - If [branch_ref ref] is not specified, it defaults to "HEAD" (whatever is
@GuyPaddock
GuyPaddock / wistia_starwars.html
Created July 13, 2022 19:45
Wistia's "Star Wars" Terms of Service
<html>
<body>
<iframe src="https://fast.wistia.net/embed/iframe/7epq4bhukx?videoFoam=true" title="Star Wars Terms of Service - July 2022 v2 Video" allow="autoplay; fullscreen" allowtransparency="true" frameborder="0" scrolling="no" class="wistia_embed" name="wistia_embed" msallowfullscreen="" width="633" height="356" data-dashlane-frameid="8008" style="width: 633px; height: 356px;"></iframe>
</body>
</html>
@GuyPaddock
GuyPaddock / cleanup_md.sh
Last active March 30, 2024 23:31
Clean-up Multidevs on Pantheon with Terminus
#!/usr/bin/env bash
set -euo pipefail
if [[ "$#" -eq 0 ]]; then
{
echo "Usage: ${0} <multi-dev 1> [multi-dev 2]... etc."
echo
echo "For example:"
echo " ${0} mr-819 mr-815 mr-814"