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
Import-Module Polaris -Verbose | |
Import-Module PSHTML -Verbose | |
Add-Type -AssemblyName System.Web | |
New-PolarisGetRoute -Path "/Login" -Scriptblock { | |
$HTML = html { | |
head { | |
Title "Login Page" | |
} |
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
################################################# | |
# Terraform vs. Pulumi vs. Crossplane # | |
# Infrastructure as Code (IaC) Tools Comparison # | |
# https://youtu.be/RaoKcJGchKM # | |
################################################# | |
######### | |
# Setup # | |
######### |
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
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) | |
{ |
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
Get Permissions | |
# MS Graph Permissions | |
(Get-AzAdServicePrincipal -ApplicationId 00000003-0000-0000-c000-000000000000).AppRole | Select * | |
(Get-AzAdServicePrincipal -ApplicationId 00000003-0000-0000-c000-000000000000).Oauth2PermissionScope | Select * | |
# Azure AD Graph | |
(Get-AzAdServicePrincipal -ApplicationId 00000002-0000-0000-c000-000000000000).AppRole | Select * | |
(Get-AzAdServicePrincipal -ApplicationId 00000002-0000-0000-c000-000000000000).Oauth2PermissionScope | Select * |
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
# 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 |
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 system.collections.generic | |
function Get-ParamBlock ([String[]]$Name) { | |
[hashset[string]]$params = $PSCmdlet.MyInvocation.MyCommand.Parameters.Keys | |
$params.ExceptWith([string[]]([PSCmdlet]::CommonParameters + [PSCmdlet]::OptionalCommonParameters)) | |
$result = @{} | |
if ($Name) {$params = $params -in $Name} | |
foreach ($name in $params) { | |
$result.$name = $PSCmdlet.GetVariableValue($name) | |
} | |
return $result |
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 System.Threading.Tasks | |
using namespace System.Collections.Generic | |
filter Receive-Task { | |
#Wait on one or more tasks in a cancellable manner | |
[CmdletBinding()] | |
param( | |
[parameter(Mandatory, ValueFromPipeline)][Task]$Task, | |
#How long to wait before checking for a cancellation in milliseconds | |
[int]$WaitInterval = 500 | |
) |
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
$daysToExpire = 30 | |
$SoonToBeExpiredList = @() | |
$AlreadyExpiredList = @() | |
# Connect to AzureAD | |
Write-Output "Connecting to AzureAD..." | |
$connection = Get-AutomationConnection -Name AzureRunAsConnection | |
Connect-AzureAD -TenantId $connection.TenantID -ApplicationId $connection.ApplicationID -CertificateThumbprint $connection.CertificateThumbprint |
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 Prompt | |
{ | |
Write-Host "[" -NoNewline | |
Write-Host (Get-Date -Format "HH:mm:ss") -ForegroundColor Gray -NoNewline | |
try | |
{ | |
$history = Get-History -ErrorAction Ignore | |
if ($history) | |
{ |
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 -Version 5.0.9814.0 | |
if(!($PSVersionTable.PSVersion.Major -ge 5 -and $PSVersionTable.PSVersion.Build -ge 9814)) { | |
"Sorry you need PSVersion 5.0.9814.0 or newer" | |
$psversiontable | |
return | |
} | |
Add-Type -AssemblyName presentationframework |