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-TextToMorse { | |
param ( | |
[Parameter(Mandatory = $true)] | |
[string]$Text | |
) | |
$morseDict = @{ | |
'A' = '.-'; 'B' = '-...'; 'C' = '-.-.'; 'D' = '-..'; 'E' = '.'; 'F' = '..-.' | |
'G' = '--.'; 'H' = '....'; 'I' = '..'; 'J' = '.---'; 'K' = '-.-'; 'L' = '.-..' | |
'M' = '--'; 'N' = '-.'; 'O' = '---'; 'P' = '.--.'; 'Q' = '--.-'; 'R' = '.-.' |
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 Show-GridView { | |
param ( | |
[Parameter(Mandatory, ValueFromPipeline)] $InputObject | |
) | |
begin { | |
Add-Type -AssemblyName System.Windows.Forms | |
$data = New-Object 'System.Collections.Generic.List[Object]' | |
} | |
process { | |
$data.Add([PSCustomObject]$InputObject) |
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 Save-JsonToExcel { | |
<# | |
.SYNOPSIS | |
Saves a JSON string to an Excel file. | |
.PARAMETER Json | |
The JSON string to save. | |
.PARAMETER Path | |
The path to save the Excel file to. | |
#> | |
param( |
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
$config = @{ | |
Preferences = @{ | |
defaultAgent = "StockAgent" | |
} | |
WebSearchAgent = @{ | |
Name = "WebSearch" | |
LLM = New-OpenAIChat 'gpt-4o-mini' | |
Instructions = "Today is $(Get-Date)" |
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 map { | |
param( | |
$func, | |
[Parameter(ValueFromRemainingArguments = $true)] | |
$arrays | |
) | |
$arrays | ForEach-Object { | |
if ($arrays[0].Length -ne $_.Length) { | |
throw "All arrays must be of the same length" |
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
$text1 = Read-Host "Enter text" | |
Set-Clipboard -Value $text1 | |
$text2 = Get-Clipboard | |
$text2 |
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
$data = ConvertFrom-Csv @" | |
Name,UnitsSold | |
John,100 | |
Jane,200 | |
Tom,120 | |
Jane,300 | |
Jim,150 | |
Mary,250 | |
"@ |
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
$prompt = "capital of france?" | |
$model = "gpt-4o-mini" | |
# $model = "o1-preview" | |
$headers = @{ | |
"Content-Type" = "application/json" | |
"Authorization" = "Bearer $($env:GITHUB_TOKEN)" | |
} | |
$body = @{ |
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
param( | |
$daysOld = 7 | |
) | |
$targetDir = $( | |
'D:\mygit\GPTIdeas\Experiments\Livestream-GPT\' | |
'D:\mygit\PowerShellAIAssistant-ScratchPad' | |
'D:\mygit\PSAI' | |
'D:\mygit\PSAIAgent-Stealth-2\' | |
'D:\temp\Camtasia\scratch\' |
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
$sumData = ConvertFrom-Csv @" | |
ProductName, VendorName, TotalSales | |
Macbook, Apple | |
Desktop, DELL | |
RAM, Lenovo | |
HDD, HCL | |
Laptop, IBM | |
Mouse, Acer | |
"@ |
NewerOlder