Skip to content

Instantly share code, notes, and snippets.

View GuyPaddock's full-sized avatar

Guy Elsmore-Paddock GuyPaddock

View GitHub Profile
@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,
@GuyPaddock
GuyPaddock / smpte.sh
Last active January 17, 2021 17:11
Adding SMPTE timecode to video recorded on Pixel 3
ffmpeg \
-i INPUT_FILE.mp4 \
-vf drawtext="fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf: fontsize=96: box=1: [email protected]: boxborderw=5: fontcolor=white: x=(w-text_w)/2: y=((h-text_h)/2)-(3*((h-text_h)/8)):timecode='00\:00\:00\:00':rate=28.09" \
OUTPUT_FILE.mp4
@GuyPaddock
GuyPaddock / Getting Started with UE4 Infographic.svg
Last active December 14, 2020 12:49
Notes and Tips on Getting Started with Unreal Engine (my notes follow after my infographic)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@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 / console.js
Created October 27, 2020 13:18
Extract Titles of Confluence Spaces from the Spaces Page
$('.space-name').each(function () { console.log($(this).text()); });
@GuyPaddock
GuyPaddock / modulename.install.php
Created October 19, 2020 15:19 — forked from crittermike/modulename.install.php
Uninstall Multiversion and Workspace from Drupal 8. This is an update hook which successfully uninstalled the module from our fairly complicated site.
<?php
/**
* Uninstall Multiversion and related modules.
*/
function modulename_update_8000() {
// !!! IMPORTANT !!!
// First, make sure to check and see if any of the below entities have a
// value of NULL in "_deleted" or "workspace" columns, because if so,
// you'll want to update that. See this issue for more information:
@GuyPaddock
GuyPaddock / calc_similarity.sh
Created August 5, 2020 20:27
Convert images to PNG, resize them, and then compute dissimilarity
#!/usr/bin/env bash
mogrify -format png *.jpg
mogrify \
-resize 4096x4096 \
-background black \
-gravity center \
-extent 4096x4096 \
-format png \
@GuyPaddock
GuyPaddock / update_aks_node_key.sh
Created July 28, 2020 16:05
Azure Kubernetes Service (AKS) reset SSH key of azureuser account on nodes
#!/usr/bin/env bash
##
# Update the SSH key for the azureuser account on the specified AKS node.
#
cluster_resource_group="${1:-}"
node="${2:-}"
public_key_path="${3:-}"
AZURE_USER="azureuser"
@GuyPaddock
GuyPaddock / kubectl_timeout_evade_trick.sh
Created June 17, 2020 12:41
Keeping a long-running command going without interruption through kubectl exec through timeouts
# This trick keeps the kubectl session active by printing the current time every 10 seconds
#
# Run commands like this
(while true; do sleep 10; date; done) & <YOUR LONG RUNNING COMMAND GOES HERE>
# For example:
(while true; do sleep 10; date; done) & sha512sum my_super_large_file.dat | tee checksum.sha512
# When done, to get control back, run this command:
fg
@GuyPaddock
GuyPaddock / password.txt
Created May 16, 2020 20:23
Technicolor CGA4234 VGW Default Password
The default username and password for a Technicolor CGA4234 VGW from AtlanticBBInc is "user" with no password.