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
# Registered an AAD group with Priviledged Identity Management (PIM) | |
function Get-PimToken { | |
<# | |
.SYNOPSIS | |
Gets the Azure auth token for PIM. | |
#> | |
[cmdletbinding()] | |
param() |
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
[cmdletbinding()] | |
param() | |
function Connect-SlackRtm { | |
[cmdletbinding()] | |
param( | |
[string]$Token | |
) | |
$loginData = @{} |
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
[cmdletbinding()] | |
param() | |
function Connect-SlackRtm { | |
[cmdletbinding()] | |
param( | |
[string]$Token | |
) | |
$loginData = @{} |
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
# azurerm_frontdoor.fd will be created | |
+ resource "azurerm_frontdoor" "fd" { | |
+ cname = (known after apply) | |
+ enforce_backend_pools_certificate_name_check = true | |
+ id = (known after apply) | |
+ load_balancer_enabled = true | |
+ location = "eastus" | |
+ name = "XXXXX-fd1" | |
+ resource_group_name = "tf_XXXXX" |
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
# Put these functions in the profile.ps1 to start and stop Chrome usage tracking. | |
# Display your Chrome usage by running "Show-ChromeUsage" | |
# Track Chrome usage | |
function Start-ChromeUsageTracking { | |
$job = Start-Job -Name ChromeTracker -ScriptBlock { | |
while ($true) { | |
$now = [datetime]::Now.ToString('s') | |
$tabs = (Get-Process chrome -ErrorAction SilentlyContinue).Count | |
$log = Join-Path ([IO.Path]::GetTempPath()) 'chrome_usage.csv' |
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
$tenant = '<tenant-id>' | |
$subscription = '<subscription-id>' | |
$clientId = '<client-id>' | |
$clientSecret = '<client-secret>' | |
# Log into Azure w/ Service Principal | |
$creds = [pscredential]::new($clientId, ($clientSecret | ConvertTo-SecureString -AsPlainText -Force)) | |
Connect-AzAccount -TenantId $tenant -SubscriptionId $subscription -Credential $creds -ServicePrincipal > $null | |
# Get auth token |
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
<# | |
.SYNOPSIS | |
Suggest Slack threads for talkative users. | |
.DESCRIPTION | |
This middleware tracks how many messages (x) users send per (y) amount of time. | |
If a user goes over the threshold, we'll send a message suggesting that Slack threads should be used. | |
.NOTES | |
Based on https://stackoverflow.com/questions/667508/whats-a-good-rate-limiting-algorithm | |
#> | |
param( |
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
# Put this code in your PowerShell profile script | |
# This requires the MSTerminalSettings module which you can download with: | |
# Install-Module MSTerminalSettings -Scope CurrentUser -Repository PSGallery | |
Import-Module MSTerminalSettings | |
$msTermProfileName = 'pwsh' # Replace with whatever Terminal profile name you're using | |
$msTermProfile = Get-MSTerminalProfile -Name $msTermProfileName | |
$script:bombThrown = $false | |
function prompt { | |
if ($? -eq $false) { |
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
$err=$null | |
[System.Management.Automation.PSParser]::Tokenize((Get-Content (Get-PSReadLineOption).HistorySavePath),[ref]$err) | | |
Where-Object {$_.type -eq 'command'} | | |
Select-Object Content | Group-Object Content | | |
Sort-Object Count, Name -Descending | Select-Object Count, Name -First 20 |
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 posh-git | |
function prompt { | |
# The status of the last command run | |
$lastSuccess = $? | |
# Colors for prompt | |
$color = @{ | |
Reset = "`e[0m" | |
Red = "`e[31;1m" | |
Green = "`e[32;1m" |
NewerOlder