Skip to content

Instantly share code, notes, and snippets.

View michaelsanford's full-sized avatar
🛟
...and now I am future me

Michael Sanford michaelsanford

🛟
...and now I am future me
View GitHub Profile
@michaelsanford
michaelsanford / install-docker-extensions.ps1
Created January 23, 2026 19:07
Install 'missing' Docker Desktop for Windows extensions when provisioned by InTune, etc.
Start-Transcript -Path "$env:TEMP\docker-plugin-install.log"
$pluginDir = "$env:USERPROFILE\.docker\cli-plugins"
New-Item -ItemType Directory -Force -Path $pluginDir
try {
# Compose
Invoke-WebRequest -Uri "https://github.com/docker/compose/releases/latest/download/docker-compose-windows-x86_64.exe" -OutFile "$pluginDir\docker-compose.exe"
# Scout
@michaelsanford
michaelsanford / flux-pills.json
Last active January 27, 2026 02:50
Terminal Settings
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"secondary_prompt": {
"template": "❯❯ ",
"foreground": "#16c60c"
},
"transient_prompt": {
"template": "❯ ",
"foreground": "#16c60c"
},
@michaelsanford
michaelsanford / Check-DigiCertSSL.ps1
Created January 9, 2026 17:02
For a list of DNS entries, is the certificate issued by DigiCert?
param(
[string]$DomainsFile = "dns.txt",
[int]$TimeoutMs = 10000,
[switch]$SkipDomainKeyRecords
)
# Configure SSL/TLS settings
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 -bor [System.Net.SecurityProtocolType]::Tls13
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"secondary_prompt": {
"template": "❯❯ ",
"foreground": "#16c60c"
},
"transient_prompt": {
"template": "❯ ",
"foreground": "#16c60c"
},
@michaelsanford
michaelsanford / AwsSecretsManagerProvider.java
Created August 12, 2025 19:17
Keycloak SPI to AWS Secrets Manager with Rotation Detection
package com.example.keycloak.aws;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.keycloak.models.KeycloakSession;
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.secretsmanager.SecretsManagerClient;
import software.amazon.awssdk.services.secretsmanager.model.GetSecretValueRequest;
import software.amazon.awssdk.services.secretsmanager.model.GetSecretValueResponse;
@michaelsanford
michaelsanford / count-fargate-vcpus.ps1
Created June 20, 2025 13:32
AWS CLI to count ECS Fargate vCPUs in the account
$totalVcpus = 0
# Get all ECS clusters
$clusters = aws ecs list-clusters --query 'clusterArns[]' --output text
foreach ($cluster in $clusters -split "`t") {
if ([string]::IsNullOrWhiteSpace($cluster)) { continue }
# Get all services in the cluster
$services = aws ecs list-services --cluster $cluster --query 'serviceArns[]' --output text
@michaelsanford
michaelsanford / Start-Maintenance.ps1
Last active June 20, 2025 22:12
Windows 11 Maintenance (DISM, SFC, compact VM disks)
#Requires -RunAsAdministrator
$logFile = "$env:USERPROFILE\Desktop\WindowsMaintenance_$(Get-Date -Format 'yyyyMMdd_HHmmss').log"
Start-Transcript -Path $logFile -Append
"Starting Windows maintenance routine..."
if ($wslFeature.State -eq 'Enabled') {
"Shutting down WSL..."
wsl --shutdown
@michaelsanford
michaelsanford / batch-delete-github-workflow-runs.ps1
Created October 13, 2021 04:16
Batch Delete GitHub Workflow Runs
$user = "your user/org"
$repo = "repo"
(gh api repos/$user/$repo/actions/runs | ConvertFrom-Json).workflow_runs |
%{ $_.id } |
%{ gh api repos/$user/$repo/actions/runs/$_ -X DELETE }
@michaelsanford
michaelsanford / show-dead-path-folders.ps1
Created September 23, 2021 21:18
Show Directories in $Env:Path that no longer exist
$Env:Path -Split ";" | ForEach-Object { if ($false -eq (Test-Path $_)) { Write-Output $_} }
@michaelsanford
michaelsanford / Facebook.js
Created August 15, 2021 04:28
Clean up your online life
// https://www.facebook.com/pages/?category=liked&ref=bookmarks
// Scroll down to load all the items
[...document.querySelectorAll("[aria-label=Liked]")].forEach(e => e.click())