This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.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'", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param( | |
[string] | |
$Message = "Coming at you live from the uncanny valley" | |
) | |
if ($IsUnix -or $IsMacOS) { | |
throw "SAPI not available on Unix/MacOS" | |
} | |
Start-ThreadJob -ScriptBlock { | |
$sapi = New-Object -ComObject Sapi.SpVoice |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Start-ThreadJob {param($V) | |
foreach ($kv in $v.GetEnumerator()) { | |
$ExecutionContext.SessionState.PSVariable.Set($kv.Key, $kv.Value) | |
} | |
testing | |
} -Arg @{'function:testing' = {1..3}} | Wait-Job | Receive-Job |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$JobName = "http://localhost:$(Get-Random -Min 4200 -Max 42000)/" | |
$httpListener = [Net.HttpListener]::new() | |
$httpListener.Prefixes.Add($JobName) | |
$httpListener.Start() | |
Start-ThreadJob -ScriptBlock { | |
param($MainRunspace, $httpListener, $SourceIdentifier = 'http') | |
while ($httpListener.IsListening) { | |
$contextAsync = $httpListener.GetContextAsync() | |
while (-not ($contextAsync.IsCompleted -or $contextAsync.IsFaulted -or $contextAsync.IsCanceled)) {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"#$('{0:x6}' -f (Get-Random -Maximum 0xFFFFFF))" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function f13($n=13) { | |
$day, $f13 = (Get-Date).Date, @() | |
do { | |
if ($day.DayOfWeek * $day.Day -eq 65) { | |
$f13 += $day | |
} | |
$day = $day.AddDays(1) | |
} while ($f13.Count -lt $n) | |
$f13 | |
} |
NewerOlder