Skip to content

Instantly share code, notes, and snippets.

View GuyPaddock's full-sized avatar

Guy Elsmore-Paddock GuyPaddock

View GitHub Profile
@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 / 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"
@GuyPaddock
GuyPaddock / LiveHome3dFbxCleanupAndExport.py
Last active March 18, 2024 01:47
Blender Script for Cleaning-up a Live Home 3D FBX for UE4
##
# This script can be run in Blender to re-arrange and clean-up an FBX model from
# Live Home 3D Pro so that it's more suitable for use in Unreal Engine 4/5.
#
# All objects in Live Home 3D should follow a naming convention similar to UE4
# naming conventions:
#
# SM_<Room Name>_<Element Type>
#
# For example:
@GuyPaddock
GuyPaddock / concave_object_to_convex_objects_by_face.py
Last active March 14, 2024 13:28
Blender 2.91 Script for Convex Hull Decomposition into Separate Shapes Using Blender's Convex using "Split Concave Faces"
##
# A script to split simple, architectural geometry into convex pieces.
#
# This script makes use of Blender's built-in "Split Concave Faces" clean-up
# algorithm to break-up the faces of an object into convex pieces. The script
# attempts to identify all the edges that represent convex boundaries, and then
# it splits objects up along those edges. Each resulting piece is then made into
# a closed object by converting it into a convex hull.
#
# Be sure to select the object you wish the split into convex pieces before
@GuyPaddock
GuyPaddock / RenewAzureAdProxyCert.ps1
Last active February 1, 2024 22:06
PowerShell Script to Renew the SSL Certificate Used by the Application Proxy for an Azure AD Enterprise Application
################################################################################
# Script that renews a Let's Encrypt certificate for the Application Proxy of an
# Enterprise Application.
################################################################################
# This script can be run standalone from your local machine to automate the
# steps of a specific ACME renewal for Azure AD App Proxy application.
#
# Prior to using this script, you will need to ensure you have a DNS zone setup
# that points to your Azure AD App Proxy deployment. Azure AD will give you a
# hostname that will need to be referenced by a CNAME record in the zone. So,
@GuyPaddock
GuyPaddock / instructions.md
Last active September 24, 2023 08:05
Creating default Windows Theme

Introduction

This is a brief snippet for Windows 10 admins that want to make a Windows theme the default for new users without enforcing it via Group Policy.

Instructions

  1. Download and install the desired theme from the Windows Store (or create your own).
  2. Find the theme under %USERPROFILE%\AppData\Local\Microsoft\Windows\Themes\.
  3. Move .theme file to %SystemRoot%\Resources\Themes.
  4. Move backgrounds into %SystemRoot%\Resources\Themes\THEME_NAME\DesktopBackground. Any other theme files (like sounds, etc) should be copied to appropriate folders under %SystemRoot%\Resources\Themes\THEME_NAME.
  5. Open .theme file up for editing.
  6. Remove ImagesRootPIDL setting under Slideshow section of the file.
@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 / NestedEntityReference.php
Created November 3, 2020 21:28
NestedEntityReference utility class for safely getting access to ER fields
<?php
namespace Drupal\my_utiilities\Utility;
use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\Plugin\DataType\EntityAdapter;
use Drupal\Core\Field\EntityReferenceFieldItemListInterface;
use Drupal\Core\Field\FieldItemInterface;
use Drupal\Core\TypedData\DataReferenceInterface;
@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.