This file contains hidden or 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 Import-GitConfig { | |
| <# | |
| .SYNOPSIS | |
| Restores git configuration from a CliXml file created by Save-GitConfig. | |
| .DESCRIPTION | |
| Reads a CliXml file produced by Save-GitConfig and applies each | |
| key-value pair using 'git config'. Global settings are applied with | |
| '--global' and all other settings with '--local'. The 'Global' | |
| property on each object is used only to determine scope and is not |
This file contains hidden or 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
| class MeetingIdTransform : System.Management.Automation.ArgumentTransformationAttribute { | |
| [object] Transform([System.Management.Automation.EngineIntrinsics]$engineIntrinsics, [object]$inputData) { | |
| $nospaces = $inputData -replace ' ','' | |
| return $nospaces | |
| } | |
| } | |
| function Update-ZoomMeetingSurvey { | |
| <# | |
| .SYNOPSIS |
This file contains hidden or 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 Wait-File { | |
| <# | |
| .SYNOPSIS | |
| Monitors a file system path for changes and executes a script block in response to specified events. | |
| .DESCRIPTION | |
| The Wait-File function creates a FileSystemWatcher to monitor a specified directory for file system changes. | |
| It registers event handlers for specified events (Created, Changed, Deleted, Renamed) and executes a | |
| custom action when those events occur. The function runs continuously until manually stopped (Ctrl+C) | |
| or until an exit condition is satisfied (see -ExitCondition or -Once). |
This file contains hidden or 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 Merge-Csv { | |
| <# | |
| .SYNOPSIS | |
| Merge the data from multiple csv files into one | |
| .DESCRIPTION | |
| Merge data from multiple csv files into one. Data from each file should be the same shape | |
| .PARAMETER CsvFile | |
| The path to two or more csv files to combine |
This file contains hidden or 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 WinUIShell | |
| [CmdletBinding()] | |
| Param() | |
| begin {} | |
| process { | |
| if (-not (Get-Module WinUIShell)) { | |
| Import-Module WinUIShell | |
| } |
This file contains hidden or 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 Test-SqlConnectionString { | |
| <# | |
| .SYNOPSIS | |
| Tests establishing a connection to SQL instance usese provided ConnectionString | |
| .DESCRIPTION | |
| Long description | |
| .PARAMETER ConnectionString | |
| The ConnectionString attempting to make a connection |
This file contains hidden or 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 New-UserPrompt { | |
| <# | |
| .SYNOPSIS | |
| Generate a simple user prompt | |
| .DESCRIPTION | |
| Long description | |
| .PARAMETER Options | |
| An array of choices a user can select from |
This file contains hidden or 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
| class SteviecoasterException : System.Exception { # create a new exception called SteviecoasterException that inherits all of its magic from System.Exception | |
| SteviecoaserException([string]$message) : base($message) {} # message is the text you wish to display as your exception | |
| } | |
| # Use your new class | |
| throw [SteviecoasterException]::new('Welp, I ded') |
This file contains hidden or 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 Convert-GitRemote { | |
| <# | |
| .SYNOPSIS | |
| Converts the output of 'git remote -v' to a PowerShell object | |
| .EXAMPLE | |
| Convert-GitRemote | |
| #> | |
| [CmdletBinding()] |
This file contains hidden or 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
| $var = @{A = 10; B = 'abc'} | |
| foreach ($key in $var.Keys) { | |
| switch ($var[$key].GetType()) { | |
| { $_ -eq [int32] } { "$key + 10 = $($var[$key] + 10)" } | |
| { $_ -eq [string] } { "$key = $($var[$key])" } | |
| } | |
| } | |
| # Output |
NewerOlder