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
$Inst = @" | |
You are powershell expert and an Excel expert and a ImportExcel expert. | |
I want to create an Excel template. I'll provide you with all the options to | |
include in the template, and when I have finished, | |
you'll format it as an .xlsx file to be saved in the current directory. | |
just the code, no explanation, no comments, no markdown, no fence blocks | |
"@ |
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
#Requires -Module PSAISuite | |
# Step 1: Generate PowerShell function from a prompt (Model A - GPT-4) | |
$genPrompt = @" | |
You're a PowerShell expert. | |
Write a function that takes a CSV file and creates an Excel file using ImportExcel module. | |
Return only the code. | |
"@ |
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 = @{ |
NewerOlder