Advent of Code
This gist contains my attempt(s) to solve the Advent of Code 2020 puzzles, in as many ways as I fancy.
#requires -Modules Az.Accounts | |
using namespace Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters | |
#function Add-JitAccess { | |
<# | |
.Synopsis | |
Adds a JIT exception to VMs in the provided Resource Group | |
.Notes | |
Until we have an Az.Accounts version that works with Az.Security, we cannot use the provided cmdlets to maintain JIT. This is a workaround. | |
.Example |
This gist contains my attempt(s) to solve the Advent of Code 2020 puzzles, in as many ways as I fancy.
<# | |
.Synopsis | |
Copies save data from the EGS version of Remedy's Control to Steam's save location. | |
.Description | |
Old save files appear to be in a file structure similar to: | |
%LocalAppData%\Remedy\Control\Default-Epic-User\savegame-slot-00\global.chunk | |
Save files for the Steam version seem to be in the format: | |
Steam\userdata\<user-id>\870780\remote\savegame-slot-00_global (no extension) | |
function Add-AzStorageAccount { | |
<# | |
.Synopsis | |
This function creates a standardised storage account in the ResourceGroupName | |
.Example | |
Add-QmAzStorageAccount -ResourceGroupName AUSC1-FRG -Name ausc1frgdiagag3249b -Location "uscentral" | |
#> | |
[CmdletBinding()] | |
param( |
@{ | |
ModuleVersion = '0.1.0' | |
# Modules that must be imported into the global environment prior to importing this module | |
RequiredModules = @( | |
) | |
# Exports. Populated by Optimize-Module during the build step. | |
# For best performance, do not use wildcards and do not delete these entry! |
function ConvertTo-ProductKey { | |
[CmdletBinding()] | |
param( | |
[byte[]]$Key, | |
[switch]$Validate | |
) | |
end { | |
$KeyOffset = 52 | |
[char[]]$Chars = "BCDFGHJKMPQRTVWXY2346789" | |
$KeyOutput = "" |
function Invoke-ModifiedTests { | |
<# | |
.Synopsis | |
Gets a list of changed files in a repository, and run every changed test and test matching a changed function/file | |
.Description | |
This assumes that each file has a matching .Tests.ps1 file, suited for running with Pester. It also ignores Integration tagged tests. | |
.Example | |
Invoke-ModifiedTests -Repository C:\Source\Module |
using namespace Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters | |
function Export-PfxFromAzureKeyVault { | |
<# | |
.Synopsis | |
Exports a PFX file from an Azure KeyVault Certificate | |
.Example | |
Export-PfxFromAzureKeyVault -VaultName TestVault -Name TestCert -Password $SecurePW -Path C:\Temp\TestCert.pfx | |
#> |
using namespace Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters | |
function Invoke-AzVMScript { | |
[CmdletBinding()] | |
param( | |
[Parameter(Mandatory)] | |
[ResourceGroupCompleter()] | |
[string]$ResourceGroupName, | |
[Parameter(Mandatory)] |
class fileregion { | |
hidden [string]$OriginalFilePath | |
[string]$RelativeFilePath | |
[int]$StartLine | |
[int]$EndLine | |
} | |
function Get-FileRegions { | |
param( | |
[string[]]$Path |