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 / Rewrite-BitbucketRemotes.ps1
Created October 15, 2026 18:23
Recursively Rewrite Bitbucket Git Remotes
#Requires -Version 5.1
<#
.SYNOPSIS
Recursively finds git repositories under a given path and rewrites a
named SSH remote's host from one value to another (default: a Bitbucket
'bitbucket.org' -> 'ssh.bitbucket.org' rewrite on 'origin').
.DESCRIPTION
Walks the directory tree looking for .git folders, inspects the target
remote, and detects SSH URLs whose host matches -From. Both URL styles
@michaelsanford
michaelsanford / Start-QuickMaintenance.ps1
Last active October 13, 2026 02:23
Start-QuickMaintenance.ps1
#Requires -RunAsAdministrator
[CmdletBinding()]
param(
# Append DISM /ResetBase: reclaims more space but PERMANENTLY removes
# the ability to uninstall previously-installed Windows updates.
[switch]$ResetBase,
# Power off the machine when maintenance completes (shutdown /sg).
[switch]$Shutdown
@michaelsanford
michaelsanford / README.md
Last active May 22, 2026 19:20
Something cool to look at on a spare monitor

Start-BossKey

A small Windows-native PowerShell "boss key" terminal facade.

It is built around a mode registry so future modes can be added without changing the launcher behavior. If no mode is specified, the launcher randomly selects from the available modes.

Run

Write-Host -BackgroundColor Yellow -ForegroundColor Blue "Test-FromInternet executed successfully."
@michaelsanford
michaelsanford / $PROFILE.ps1
Last active September 17, 2026 15:28
My PowerShell 7 $profile
# PSReadLine configuration
# - Visual styling
# - Bash/zsh-style editing chords
# - History-based prediction tuning
# Guard: do nothing if PSReadLine is unavailable (e.g., non-interactive hosts)
if (-not (Get-Module -ListAvailable -Name PSReadLine)) { return }
# Base options: prompt + colours
$PSROptions = @{
@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 August 5, 2026 15:34
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;