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
$xlfile = "$env:TEMP\PSreports.xlsx" | |
Remove-Item $xlfile -ErrorAction SilentlyContinue | |
# Get-Process | |
$ecd = New-ExcelChartDefinition -XRange "A3:A7" -YRange "C3:C7" -Row 30 -Column 1 -Title "Report Process`nTotal Handles" -NoLegend | |
Get-Process | Select -First 5 | | |
Export-Excel $xlfile -AutoSize -StartRow 2 -TableName ReportProcess -ExcelChartDefinition $ecd | |
# Get-Service | |
Get-Service | Select -First 5 | |
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
<# | |
.EXAMPLE | |
llm "what is the capital of spain" -provider openai | |
.EXAMPLE | |
llm "what is the capital of spain" -provider anthropic | |
.EXAMPLE | |
llm "what is the capital of spain" -provider gemini | |
#> |
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
$CountryLookup = [ordered]@{ | |
"AD"="ANDORRA" | |
"AE"="UNITED ARAB EMIRATES" | |
"AF"="AFGHANISTAN" | |
"AG"="ANTIGUA AND BARBUDA" | |
"AI"="ANGUILLA" | |
"AL"="ALBANIA" | |
"AM"="ARMENIA" | |
"AO"="ANGOLA" | |
"AQ"="ANTARCTICA" |
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
param( | |
$Alive = 'O', | |
$Dead = ' ', | |
$SleepInSeconds = .5 | |
) | |
<# | |
Conway's Game of Life | |
The classic cellular automata simulation. Press Ctrl-C to stop. | |
More info at: https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life |
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
# Set up the constants: | |
$ObjectPronouns = 'Her', 'Him', 'Them' | |
$PossesivePronouns = 'Her', 'His', 'Their' | |
$PersonalPronouns = 'She', 'He', 'They' | |
$States = 'California', 'Texas', 'Florida', 'New York', 'Pennsylvania', 'Illinois', 'Ohio', 'Georgia', 'North Carolina', 'Michigan' | |
$Nouns = 'Athlete', 'Clown', 'Shovel', 'Paleo Diet', 'Doctor', 'Parent', 'Cat', 'Dog', 'Chicken', 'Robot', 'Video Game', 'Avocado', 'Plastic Straw', 'Serial Killer', 'Telephone Psychic' | |
$Places = 'House', 'Attic', 'Bank Deposit Box', 'School', 'Basement', 'Workplace', 'Donut Shop', 'Apocalypse Bunker' | |
$When = 'Soon', 'This Year', 'Later Today', 'RIGHT NOW', 'Next Week' | |
function generateAreMillennialsKillingHeadline { |
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
# Load necessary .NET libraries | |
Add-Type -AssemblyName PresentationFramework, WindowsBase | |
# XAML definition | |
[xml]$xaml = @" | |
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
Title="Posh Runner" Height="300" Width="400"> | |
<Grid> | |
<Label Content="PS Cmd:" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top"/> |
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 Get-ChatCompletion { | |
param( | |
$messages, | |
$model = "gpt-3.5-turbo", | |
$functions, | |
$function_call, | |
$temperature = 0.7, | |
$max_tokens, | |
$stop, | |
$top_p = 1.0, |
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 @' | |
Name,Score,Grade | |
Ahmed,76 | |
Bassam,91 | |
Amira,42 | |
Nadia,83 | |
Joseph,36 | |
Mary,45 | |
Ashraf,81 | |
Amal,56 |
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
$list1 = ConvertFrom-Csv @" | |
list1 | |
Gigi | |
Jo | |
Chin | |
Phil | |
Jojo | |
"@ | |
$list2 = ConvertFrom-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
#Requires -Modules PowerShellAI | |
$str = Get-Clipboard | |
$prompt = " | |
Clean up this copy-paste from YouTube and make it suitable for pasting into Notion as meeting notes. | |
- Remove time stamps | |
- Remove line breaks | |
- Grammar, spell check and proper punctuation | |
$str |
NewerOlder