Skip to content

Instantly share code, notes, and snippets.

View GuyPaddock's full-sized avatar

Guy Elsmore-Paddock GuyPaddock

View GitHub Profile
@GuyPaddock
GuyPaddock / watchdog.sh
Created April 12, 2022 14:28
Drupal Watchdog Queries via CLI
# BUGBUG: Putting "username" in the field list crashes Drush
terminus drush SITE_ID.ENVIRONMENT watchdog:show -- \
--format=csv \
--count=1000 \
--extended \
--type=taxonomy \
--fields=date,wid,message
@GuyPaddock
GuyPaddock / fpsync.sh
Created March 5, 2022 19:33
Using fpsync to sync two folders
#!/usr/bin/env bash
fpsync -E -vvvv -n 5 /path/to/src /path/to/dest
@GuyPaddock
GuyPaddock / PrettierConsideredHarmful.md
Last active January 31, 2022 21:15
Reconsider Prettier

Prettier Considered Harmful

This is about the Prettier code formatting tool.

  1. Prettier runs counter to the Agile Manifesto. Several key tenets of the agile manifesto are about empowering small teams to make decisions for themselves:
    • "Build projects around motivated individuals. Give them the environment and support they need, and trust them to get the job done."
    • "Continuous attention to technical excellence and good design enhances agility."
@GuyPaddock
GuyPaddock / encode_files.sh
Created June 12, 2021 02:43
Synology Encryption Key(s) to Base64-Encoded FIles
find . -name '*.key' | while read file; do
encoded=$(echo "${file}" | sed 's/\.key/\.b64/');
base64 -w0 "${file}" >"${encoded}";
done
@GuyPaddock
GuyPaddock / file_sizes_to_csv.sh
Last active December 14, 2021 16:01
Get sizes of files in a folder in CSV format
#!/usr/bin/env bash
echo "filename,size_bytes"
find "${1}" -type f | while read filename; do
stat --format="%n,%s" "${filename}";
done
@GuyPaddock
GuyPaddock / add_tiff_extension.sh
Created May 3, 2021 15:26
Add TIFF extension to all files
#!/usr/bin/env bash
find . -not -name '*.tiff' -type f -exec mv '{}' '{}.tiff' ';'
@GuyPaddock
GuyPaddock / git-transplant.sh
Created February 12, 2021 21:55
Transplant (rebase) a range of commits from one branch onto another
#!/usr/bin/env bash
# Stop on undefined variables and errors
set -u
set -e
get_commit_parent() {
local target_commit="$1";
local _parent_commit=`git log --pretty=%P -n 1 "${target_commit}"`;
@GuyPaddock
GuyPaddock / concave_object_to_convex_objects_by_face.py
Last active December 28, 2024 01:04
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 / LiveHome3dFbxCleanupAndExport.py
Last active November 28, 2024 06:24
Blender Script for Cleaning-up a Live Home 3D FBX for UE4
# This script has moved to:
# https://github.com/GuyPaddock/BlenderScripts/blob/main/LiveHome3dFbxCleanupAndExport.py
@GuyPaddock
GuyPaddock / RenewAzureAdProxyCert.ps1
Last active June 12, 2024 15:41
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,