Skip to content

Instantly share code, notes, and snippets.

@stefanstranger
stefanstranger / parallel-pester-tests.ps1
Last active May 16, 2021 19:58
Run Pester Tests parallel
# Example code of running multiple Pester test in parallel and merging the result into one NUnitReport Test Report file
#region Run Pester Test scripts in parallel
$job = Get-ChildItem -Path "./tests" -Filter "Demo*"
| ForEach-Object -Parallel {
Invoke-Pester -Path $_ -PassThru
} -ThrottleLimit 10 -AsJob
$Results = ($job | Wait-Job | Receive-Job -Keep)
#endregion
#################################################
# Terraform vs. Pulumi vs. Crossplane #
# Infrastructure as Code (IaC) Tools Comparison #
# https://youtu.be/RaoKcJGchKM    #
#################################################
#########
# Setup #
#########
@JustinGrote
JustinGrote / Get-AzRetailPrice.ps1
Created November 2, 2020 01:45
Azure Retail Pricing API Proof of Concept
function Get-AzSpotPrice {
[CmdletBinding()]
param (
#VM SKU (e.g. Standard_F8s)
[String]$Sku,
#Azure Region (e.g. brazilsouth)
[String]$Region,
#ODATA filter to use on the data
[String]$Filter,
#Maximum number of records to retrieve, or specify 'Unlimited' for all records. Defaults to 100. This behaves like the Exchange Cmdlets
@rchaganti
rchaganti / downloadTerraform.ps1
Created October 13, 2020 09:18
Download and Install Terraform - Windows (PowerShell)
[CmdletBinding(DefaultParameterSetName='Version')]
param
(
[Parameter(ParameterSetName='Latest', Mandatory = $true)]
[Parameter(ParameterSetName='Version', Mandatory = $true)]
[String]
$SaveToPath,
[Parameter(ParameterSetName='Version', Mandatory = $true)]
[String]
@brettmillerb
brettmillerb / zshrc-theme
Last active August 25, 2022 06:09
.zshrc | macOs
# Path to your oh-my-zsh installation.
export ZSH="/Users/brett.miller/.oh-my-zsh"
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
# Set name of the theme to load
ZSH_THEME="powerlevel9k/powerlevel9k"
DISABLE_AUTO_TITLE="true"
# Plugins
@JustinGrote
JustinGrote / ModuleFast.ps1
Last active July 24, 2023 16:26
Bootstrap Script for a High Performance Module Installer
using namespace System.Net.Http
#requires -version 7.2
# This is the bootstrap script for Modules
[CmdletBinding(PositionalBinding = $false)]
param (
#Specify a specific release to use, otherwise 'latest' is used
[string]$Release = 'latest',
#Specify the user
[string]$User = 'JustinGrote',
#Specify the repo
@ChendrayanV
ChendrayanV / server.ps1
Created November 17, 2018 03:12
Simple Login Page Demo Using PSHTML and Polaris (PowerShell Modules)
Import-Module Polaris -Verbose
Import-Module PSHTML -Verbose
Add-Type -AssemblyName System.Web
New-PolarisGetRoute -Path "/Login" -Scriptblock {
$HTML = html {
head {
Title "Login Page"
}
@markekraus
markekraus / ConvertKMSEncryptedStrings.ps1
Created February 18, 2018 19:41
PowerShell Functions to convert a string to a base64 representation of the KMS encryoted string and to convert back to an unencrypted string
function ConvertTo-Base64KMSEncryptedString {
[CmdletBinding()]
param (
[Parameter(
Mandatory = $true,
ValueFromPipeline = $true
)]
[String[]]
$String,
@Staggerlee011
Staggerlee011 / pre-commit PowerShell git Hook
Created January 1, 2018 21:54
Example of a pre-commit hook using powershell used in Blog post:
write-output "This is a pre-commit powershell call"
write-output "======================================="
Import-Module -Name PSScriptAnalyzer
$changes = git diff --name-only
$output = @()
foreach ($change in $changes)
{
@potatoqualitee
potatoqualitee / profile.ps1
Last active November 4, 2022 19:37
prompt
function Prompt
{
Write-Host "[" -NoNewline
Write-Host (Get-Date -Format "HH:mm:ss") -ForegroundColor Gray -NoNewline
try
{
$history = Get-History -ErrorAction Ignore
if ($history)
{