🕵️♂️
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
AWSTemplateFormatVersion: '2010-09-09' | |
Description: Creates an Amazon Route 53 hosted zone | |
Parameters: | |
DomainName: | |
Type: String | |
Description: The DNS name of an Amazon Route 53 hosted zone e.g. jevsejev.io | |
AllowedPattern: (?!-)[a-zA-Z0-9-.]{1,63}(?<!-) | |
ConstraintDescription: must be a valid DNS zone name. | |
Resources: | |
DNS: |
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
{ | |
"if": { | |
"prefix": "if", | |
"body": ["if ${1:expression}:", "\t${2:pass}"], | |
"description": "Code snippet for an if statement" | |
}, | |
"if/else": { | |
"prefix": "if/else", | |
"body": ["if ${1:condition}:", "\t${2:pass}", "else:", "\t${3:pass}"], | |
"description": "Code snippet for an if statement with else" |
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
# test a command that should be called with certain parameters | |
#------------------------------------------------------------------------------ | |
It 'should call the API with the expected parameters' { | |
Mock -CommandName Invoke-RestMethod { | |
} -Verifiable -ParameterFilter { $Uri -like 'https://api.telegram.org/bot*getStickerSet*' } | |
# "https://api.telegram.org/bot$BotToken/getStickerSet" | |
$getTelegramStickerPackInfoSplat = @{ | |
BotToken = $token | |
StickerSetName = 'STPicard' | |
} |
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
# https://learn.microsoft.com/en-us/powershell/scripting/learn/deep-dives/everything-about-shouldprocess?view=powershell-7.3 | |
[CmdletBinding(ConfirmImpact = 'Low', | |
SupportsShouldProcess = $true)] | |
# $PSCmdlet.ShouldProcess('TARGET') | |
# $PSCmdlet.ShouldProcess('TARGET','OPERATION') | |
# $PSCmdlet.ShouldProcess('MESSAGE','TARGET','OPERATION') | |
# -Confirm --> $ConfirmPreference = 'Low' | |
# ShouldProcess intercepts WhatIf* --> no need to pass it on |
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
DynamicParam { | |
if (-not [String]::IsNullOrWhiteSpace($CICDChoice) -and $script:repoToCICD.ContainsKey($CICDChoice) ) { | |
$attrRepo = [System.Management.Automation.ParameterAttribute]::new() | |
$attrRepo.ParameterSetName = 'Choice' | |
$attrRepo.Mandatory = $true | |
$attrRepo.HelpMessage = 'TBD' | |
$attrRepoValidation = [System.Management.Automation.ValidateSetAttribute]::new([String[]]$script:repoToCICD[$CICDChoice]) | |
$attributeCollection = [System.Collections.ObjectModel.Collection[System.Attribute]]::new() |
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
# use generic list to add objects in a performant way | |
$starTrekShowInfo = New-Object System.Collections.Generic.List[string] | |
$starTrekShowInfo.Add('Star Trek: The Next Generation') | |
# use custom objects for high performance adds of custom object | |
$choiceArray = New-Object System.Collections.Generic.List[PSCustomObject] | |
#------------------------------------------------------------------------------ | |
# old method which should no longer be used IAW: | |
# https://docs.microsoft.com/en-us/dotnet/api/system.collections.arraylist?view=net-6.0 | |
# adding stuff to emtpy array objects quickly |
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
<# | |
CoenraadS.bracket-pair-colorizer-2 | |
DanielThielking.aws-cloudformation-yaml | |
DavidAnson.vscode-markdownlint | |
DotJoshJohnson.xml | |
PKief.material-icon-theme | |
SirTori.indenticator | |
Tyriar.shell-launcher | |
aaron-bond.better-comments | |
almenon.arepl |
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
#region settings | |
#! Enter all required modules you want to bootstrap for use in your PowerShell lambda layers | |
$requiredModules = @( | |
@{ | |
ModuleName = 'AWS.Tools.Common' | |
ModuleVersion = '4.1.175' | |
}, | |
@{ | |
ModuleName = 'PoshGram' |
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
if (-not(Test-Path -Path $TargetDir -ErrorAction Stop )) { | |
Write-Verbose -Message ('Output directory {0} not found. Creating...' -f $TargetDir) | |
$newItemSplat = @{ | |
ItemType = 'Directory' | |
Path = $TargetDir | |
ErrorAction = 'Stop' | |
} | |
try { | |
New-Item @newItemSplat | |
Write-Verbose -Message 'Created.' |
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
# AWS CDK Typescript setup on Windows | |
## Install Requirements | |
```bash | |
# install nodejs | |
winget install OpenJS.NodeJS | |
# if already installed upgrade | |
winget upgrade OpenJS.NodeJS | |