This gist contains some Advent of Code solutions for the 2021 season.
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 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 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 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 |
This file contains 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
using namespace Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters | |
function Invoke-AzVmScript { | |
<# | |
.Synopsis | |
Runs a script block or file on a given Azure VM | |
.Notes | |
This takes a surprisingly long time to run, and is a bit flaky. Any output past 4096 characters is not returned. |
This file contains 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 | |
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 file contains 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 | |
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) | |
This file contains 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 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( |