Skip to content

Instantly share code, notes, and snippets.

@Seekatar
Seekatar / Switch-Branch.ps1
Created September 5, 2023 22:36
Script to checkout main branch, deleting current one
<#
.SYNOPSIS
Delete current branch and switch to another one
.DESCRIPTION
This will pull latest from new branch
.PARAMETER NewBranch
Branch to switch to
@Seekatar
Seekatar / run.ps1
Created August 26, 2023 12:56
A template run.ps1 to run various tasks for a project, such as build, run, pack, etc. This version is for basic dotnet apps.
#! pwsh
<#
.SYNOPSIS
Helper for running various tasks
.DESCRIPTION
This script is a wrapper for snippets of dot net commands. It is useful to keep in the root of a project for running various tasks.
.PARAMETER Tasks
One or more tasks to run. Use tab completion to see available tasks.
@Seekatar
Seekatar / Add-Annotations.ps1
Last active July 16, 2023 20:44
Add annotations to manifests in Kubernetes
<#
.SYNOPSIS
Add or update an annotation to a Kubernetes resource
.PARAMETER ResourceName
Kind of Kubernetes resource to add annotation to, e.g. ingress, service, deployment, etc.
.PARAMETER AnnotationName
Name of annotation to add or update
@Seekatar
Seekatar / Start-Watch.ps1
Created August 4, 2022 00:44
PowerShell functions for watching for file changes
<#
.SYNOPSIS
Watch a file for changes
.PARAMETER File
File to watch, may be a folder with a mask
.EXAMPLE
$watch = Start-WatchFile .\src\test\hras\hra-heart-health.json -ChangeScript {param($ChangeType,$FullPath) Write-Host "$FullPath Changed" }
# do something else
@Seekatar
Seekatar / Microsoft.PowerShell_profile.ps1
Created February 13, 2022 00:53
PowerShell $Profile file for Window/Mac
Import-Module ZLocation
Import-Module posh-git
Import-Module posh-git
if ($PSVersionTable.PSVersion.Major -lt 6) {
Import-Module Jump.Location
}
# Set up a simple prompt, adding the git prompt parts inside git repos
function global:prompt {
@Seekatar
Seekatar / iTerm2-PowerShell.json
Last active February 13, 2022 00:51
iTerm2 PowerShell Profile configuration. Import this via the iTerm app for macOS. See https://iterm2.com/
{
"Ansi 5 Color" : {
"Green Component" : 0,
"Red Component" : 0.73333334922790527,
"Blue Component" : 0.73333334922790527
},
"Tags" : [
],
"Ansi 12 Color" : {
@Seekatar
Seekatar / New-AzDoPR.ps1
Created January 25, 2022 21:53
PowerShell script for creating a new PR in Azure DevOps
<#
.SYNOPSIS
Create a new PR
.DESCRIPTION
Long description
.PARAMETER Directory
Source directory of the PR, defaults to current directory
@Seekatar
Seekatar / ForEach-Git.ps1
Last active July 23, 2023 20:01
PowerShell script to run commands on git repo folders
<#
.SYNOPSIS
Run a scriptblock for all sub folders that are Git repos. Supports -WhatIf, -Confirm
.PARAMETER ScriptBlock
Scriptblock to run for each git Folder. Defaults to $defaultFegScriptBlock which shows status. See Notes for parameters
.PARAMETER HasWorking
Set to true to only run on folders that have 'working' git flag set
@Seekatar
Seekatar / base64.ps1
Last active March 7, 2021 11:26
PowerShell base64 encode decode
<#
.SYNOPSIS
base64 conversion function
.DESCRIPTION
Convert to and from base64 like Linux base64 utility
.PARAMETER s
File name or string
@Seekatar
Seekatar / Split-HelmDryRun.ps1
Created February 6, 2021 15:33
Split up Helm dry-run output into separate files to match the template folder
<#
.SYNOPSIS
Split out the manifest files from a helm dryrun for comparing against one another or the Helm /template folder
.PARAMETER line
Lines from --dry-run output
.PARAMETER OutputPath
Existing folder where to put the files