This gist contains some Advent of Code solutions for the 2021 season.
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
| # See: https://docs.google.com/document/d/18mxnyYSm39cbceA2FxFLiOfyyanaBY6ogG7oscgghxU/ for some documentation | |
| # and, for some context: https://github.com/cad0p/settleup-stripe/blob/master/functions/index.js | |
| param( | |
| [ValidateSet("settle-up-live", "settle-up-sandbox")] | |
| $script:FirebaseEnvironment = "settle-up-sandbox" | |
| ) | |
| enum currency { | |
| GBP | |
| USD |
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
| [ | |
| { | |
| "title": "Diablo III", | |
| "target": "/home/deck/.local/share/Steam/steamapps/compatdata/2880652453/pfx/drive_c/Program Files (x86)/Diablo III/Diablo III.exe", | |
| "startIn": "/home/deck/.local/share/Steam/steamapps/compatdata/2880652453/pfx/drive_c/Program Files (x86)/Diablo III/", | |
| "launchOptions": "-launch" | |
| } | |
| ] |
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 Find-FileInArchive { | |
| <# | |
| .Synopsis | |
| Finds files matching a pattern in an archive. | |
| .Example | |
| Find-FileInArchive -Path "C:\Archive.zip" -like "tools/files/*-x86.exe" | |
| .Example | |
| Find-FileInArchive -Path $Nupkg -match "tools/files/dotnetcore-sdk-(?<Version>\d+\.\d+\.\d+)-win-x86\.exe(\.ignore)?" |
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 Update-AWSSessionToken { | |
| [CmdletBinding()] | |
| param( | |
| # MFA Token IAM, e.g. arn:aws:iam::123456789012:mfa/james | |
| [string]$SerialNumber = "arn:aws:iam::...", | |
| # 6-digit output from your MFA token | |
| [ValidateLength(6,6)] | |
| [Parameter(Mandatory)] | |
| [string]$Token, |
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 SwapBytes { | |
| <# | |
| .SYNOPSIS | |
| Simply switches two bytes in an array of bytes | |
| #> | |
| param( | |
| [Parameter(Mandatory)] | |
| [byte[]]$Guid, | |
| [Parameter(Mandatory)] | |
| [int]$Left, |
Remove old releases from a Nexus3-repository
This Groovy-script will purge old versions (sorted by version-number) from a repository hosted on Nexus 3.x.
You can set the desired repository and a maximum amount of versions at the beginning of this script.
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-DeploymentTiming { | |
| param( | |
| [Parameter(Mandatory)] | |
| [string]$ResourceGroupName, | |
| [string]$DeploymentName | |
| ) | |
| begin { | |
| $Context = Get-AzContext | |
| if (-not $script:Token -or $Token.ExpiresOn.LocalDateTime -lt [DateTime]::Now) { | |
| $script:Token = Get-AzAccessToken |
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
| # WRANGLE ResourceGroup | |
| [CmdletBinding()] | |
| param( | |
| $ResourceGroupName = 'ade-test' | |
| ) | |
| <# Readd Public IP #> | |
| $mgtNic = Get-AzNetworkInterface -ResourceGroupName $ResourceGroupName -Name *-nic | |
| if (-not $mgtNic.IpConfigurations[0].PublicIpAddress.Id) { | |
| if (-not ($mgtPublicIp = Get-AzPublicIpAddress -ResourceGroupName $ResourceGroupName -Name 'tempip')) { |
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
| #requires -Modules Az.Accounts, Az.KeyVault | |
| using namespace Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters | |
| using namespace Microsoft.Azure.Commands.Common.Authentication.Abstractions | |
| # function Get-AzLabCredential { | |
| <# | |
| .Synopsis | |
| A function that returns a credential object, given a pair of secrets in a KeyVault | |
| .Example |
