Skip to content

Instantly share code, notes, and snippets.

View StartAutomating's full-sized avatar

James Brundage StartAutomating

View GitHub Profile
@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.
@StartAutomating
StartAutomating / MovingAverage.ps1
Created March 30, 2025 23:28
Gist using the object pipeline to calculate a moving average
function Get-MovingAverage {
<#
.SYNOPSIS
Gets a moving average.
.DESCRIPTION
Gets a moving average of numbers passed to it.
#>
[Alias('MovingAverage')]
param(
# The number we're averaging.
@StartAutomating
StartAutomating / ThereIsNoRouteTable.ps1
Created March 22, 2025 16:13
Gist a web server without a route table
<#
.SYNOPSIS
A pure PowerShell web server
.DESCRIPTION
A pure PowerShell web server proof of concept.
This creates a simple web server that routes commands directly by their local path
That is `/hello` would run the function `/hello` if it exists.