Skip to content

Instantly share code, notes, and snippets.

View techthoughts2's full-sized avatar
🕵️‍♂️
Investigating a better artifact workflow

Jake Morrison techthoughts2

🕵️‍♂️
Investigating a better artifact workflow
View GitHub Profile
@techthoughts2
techthoughts2 / git_commands
Last active September 25, 2023 03:13
A set of useful git commands I often use
git config --global -e
git config --list --show-origin
git config --global user.name
git config --global user.email
git config --global core.editor "code --wait"
Windows creds
git config --global credential.helper wincred
git clone
# 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
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()
@techthoughts2
techthoughts2 / cdk_pwsh_runtime_bootstrap.ps1
Last active September 30, 2022 14:30
## Synopsis This helper script can be used to bootstrap a CDK project for deploying PowerShell Lambdas using the custom PowerShell Runtime via Lambda Layers. ## Description - Quickly bootstraps a CDK project for deploying lambdas using the custom
#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'
@techthoughts2
techthoughts2 / typescript_notes.ts
Last active September 2, 2022 00:13
tbd - notes taken while learning Typescript
/*
- Static typing
- Code completion
- Refactoring
- Shorthand notations
transpilation
typescript -> javascript
*/
@techthoughts2
techthoughts2 / javascript_notes.js
Last active August 31, 2022 18:13
tbd - notes taken while learning Javascript
console.log('Hello World')
//#region variables
/*
Cannot be a reserved keyword
Cannot start with a number
Cannot contain space or hyphen
Are case sensitive
*/
@techthoughts2
techthoughts2 / cdk_custom_pwsh_layer
Last active August 29, 2022 15:54
Some notes on custom lambda layers and integrating with the AWS CDK
# CDK Custom pwsh
## Links
- [Introducing the PowerShell custom runtime for AWS Lambda](https://aws.amazon.com/blogs/compute/introducing-the-powershell-custom-runtime-for-aws-lambda/)
- [awslabs / aws-lambda-powershell-runtime](https://github.com/awslabs/aws-lambda-powershell-runtime)
- [Custom AWS Lambda runtimes](https://docs.aws.amazon.com/lambda/latest/dg/runtimes-custom.html)
- [How to use Lambda Layers in AWS CDK - Complete Guide](https://bobbyhadz.com/blog/aws-cdk-lambda-layers)
- [bobbyhadz / aws-cdk-lambda-layers](https://github.com/bobbyhadz/aws-cdk-lambda-layers)
- [KevinMarquette / PowerShell-Lambda-Runtime](https://github.com/KevinMarquette/PowerShell-Lambda-Runtime)
# AWS CDK Typescript setup on Windows
## Install Requirements
```bash
# install nodejs
winget install OpenJS.NodeJS
# if already installed upgrade
winget upgrade OpenJS.NodeJS
@techthoughts2
techthoughts2 / update_azure_components
Last active May 13, 2022 23:07
These few lines will quickly update your local development environment to the latest Azure components.
winget upgrade Microsoft.AzureStorageExplorer --silent --accept-package-agreements --accept-source-agreements
winget upgrade Microsoft.AzureCLI --silent --accept-package-agreements --accept-source-agreements
winget upgrade Microsoft.Bicep --silent --accept-package-agreements --accept-source-agreements
az bicep upgrade
Update-Module Az
# OFS - special variable that contains the string to be used as the output field seperator
$OFS = '...';$array = ('first','last');[string]$array; Remove-Variable OFS
$array = ('first','last');[string]$array;