Skip to content

Instantly share code, notes, and snippets.

View StartAutomating's full-sized avatar

James Brundage StartAutomating

View GitHub Profile
@StartAutomating
StartAutomating / MissingFromChangelog.ps1
Created October 13, 2025 21:34
Gist tell me what is missing from the CHANGELOG
#requires -Module ugit
# https://github.com/StartAutomating/ugit
$changelog = Get-Content ./CHANGELOG.md -Raw
$issuesNumbers = git log -CurrentBranch | Select-Object -ExpandProperty ReferenceNumbers -Unique
$issuesNumbers | Where-Object { $changelog -notmatch "$_"}
@StartAutomating
StartAutomating / LooksLikeMarkdown.ps1
Created October 5, 2025 21:39
Gist tell me if it looks like Markdown
filter looksLikeMarkdown {
if (
# If it's got a markdown-like link
$_ -match '\[[^\]]+\]\(' -or
# Or any of the lines start with markdown special characters
$_ -split '(?>\r\n|\n)' -match '\s{0,3}[\#*~`]'
) {
# it's probably markdown
$_
}
@StartAutomating
StartAutomating / GetSVGElements.ps1
Created September 26, 2025 19:09
Gist Get the SVG Elements
<#
.SYNOPSIS
Get the SVG Elements
.DESCRIPTION
Get the SVG Elements, as defined by the Mozilla Developer Network
.LINK
https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element
#>
$elementRoot = "https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element"
Invoke-WebRequest $elementRoot |
@StartAutomating
StartAutomating / LittleFileServer.ps1
Created September 10, 2025 19:25
Gist a little file server
<#
.SYNOPSIS
Small file server
.DESCRIPTION
A small file server to help test this website.
.NOTES
This will only serve get requests for existing files.
This is also not anywhere near the fastest static server in existence.
@StartAutomating
StartAutomating / TinyHandlebars.ps1
Created September 5, 2025 21:30
Gist tiny handlebars
function handlebars {
$input -replace '\{\{(?<m>.+?)\}\}', {
$m = $_.Groups['m'].Value
if ($m -match '(?>Key|Token|Password)$') { return '' }
return $ExecutionContext.SessionState.PSVariable.Get($m).Value
}
}
'{{pid}}' | handlebars
@StartAutomating
StartAutomating / TinyTurtle.html.ps1
Created August 17, 2025 03:17
Gist a tiny turtle
<#
.SYNOPSIS
A Tiny Turtle
.DESCRIPTION
A minimal implementation of Turtle graphics in PowerShell and JavaScript, with and a speed test.
.EXAMPLE
./TinyTurtle.html.ps1 > ./TinyTurtle.html
#>
"<div>"
"<svg width='100%' height='100%' id='stage'>"
@StartAutomating
StartAutomating / prime.ps1
Created August 15, 2025 18:47
Gist get me primes
# Calculate primes reasonably quickly with the Sieve of Eratosthenes
# Pipe in any positive whole number to see if it is prime.
filter prime {
$in = $_
if ($in -isnot [int]) { return }
if ($in -eq 1) { return $in }
if ($in -lt 1) { return}
if (-not $script:PrimeSieve) {
$script:PrimeSieve = [Collections.Queue]::new()
$script:PrimeSieve.Enqueue(2)
@StartAutomating
StartAutomating / GetMyPowerShellGallery.ps1
Created June 19, 2025 01:44
Gist get My PowerShell Gallery
<#
.SYNOPSIS
Gets my module metadata from the PowerShell Gallery.
.DESCRIPTION
Gets my module metadata from the PowerShell Gallery, without using any modules.
#>
param(
[string[]]
$Conditions = @(
"CompanyName eq 'Start-Automating'",
@StartAutomating
StartAutomating / SparseCloneLexicons.ps1
Created May 23, 2025 01:31
Gist Sparsely Clone AtProto
git clone --depth 1 --no-checkout --sparse --filter=tree:0 https://github.com/bluesky-social/atproto/
Push-Location ./atproto
git sparse-checkout set --no-cone lexicons/**/**.json
git checkout
Pop-Location
@StartAutomating
StartAutomating / FindChromium.ps1
Created May 11, 2025 00:35
Gist Find Chromium
#region Find Chromium
if (-not $script:chromium) {
# Find the chromium executable or alias, pick the first one
$chromium = Get-Command -Name chromium -CommandType Application, Alias -ErrorAction Ignore |
Select-Object -First 1
# If we don't have a chromium alias, we'll try to find the chrome or edge executable.
if ($chromium) {
$script:chromium = $chromium
} else {
# If there's no running instance of chrome, we'll try to find it.