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
<# | |
Aims to grow the understanding of using OpenAI in PoweShell by providing an example of an implementation and references | |
#> | |
function Invoke-OpenAI { | |
<# | |
.SYNOPSIS | |
Convert natural language commands into commands in PowerShell | |
.EXAMPLE |
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 Invoke-Speak { | |
param($msg) | |
Add-Type -AssemblyName System.Speech | |
$speaker = New-Object System.Speech.Synthesis.SpeechSynthesizer | |
$speaker.Speak($msg) | |
} | |
function getmessage { |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 psncal { | |
<# | |
.SYNOPSIS | |
Print the calendar vertically i.e. the weekdays will be shown in a column, not in a row | |
.EXAMPLE | |
psncal | |
.EXAMPLE | |
psncal 1 |
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-GHIssueReport 'powershell/powershell','powershell/vscode-powershell','PowerShell/PowerShellEditorServices' -NumberOfPages 3 |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
# Install-Module -Name Profiler | |
# created by: @nohwnd - twitter - Jakub Jareš | |
$trace = Trace-Script { | |
Get-Process | | |
Select-Object -First 5 Company,Name,handles | | |
Export-Excel ./tempProfiler.xlsx | |
} | |
Remove-Item ./tempProfiler.xlsx -ErrorAction SilentlyContinue |
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
$data = ConvertFrom-Csv @" | |
Region,State,Units,Price | |
West,Texas,927,923.71 | |
North,Tennessee,466,770.67 | |
East,Florida,520,458.68 | |
East,Maine,828,661.24 | |
West,Virginia,465,053.58 | |
North,Missouri,436,235.67 | |
South,Kansas,214,992.47 | |
North,North Dakota,789,640.72 |
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 squeeze { | |
param($s) | |
$p = $s.IndexOf(' ') | |
while ($p -gt -1) { | |
$s = $s -replace ' ', ' ' | |
$p = $s.IndexOf(' ') | |
} |
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 add ($a, $b) { | |
$a + $b | |
} | |
function subtract ($a, $b) { | |
$a - $b | |
} | |
$a, $b = 4, 5 |