Skip to content

Instantly share code, notes, and snippets.

View dfinke's full-sized avatar

Doug Finke dfinke

View GitHub Profile
<#
.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
#>
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
@dfinke
dfinke / PS-CmdRunner.ps1
Created October 12, 2023 15:08
Used GPT4 Vision to take my sketch and create a WPF PS script
# 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"/>
function Get-ChatCompletion {
param(
$messages,
$model = "gpt-3.5-turbo",
$functions,
$function_call,
$temperature = 0.7,
$max_tokens,
$stop,
$top_p = 1.0,
$list1 = ConvertFrom-Csv @"
list1
Gigi
Jo
Chin
Phil
Jojo
"@
$list2 = ConvertFrom-Csv @"
role : system
content : Please respond with JSON. The JSON must always be an array of objects.
Have an entry for each task for each developer like this template:
{
ProjectManager: "Jane Doe",
Developer: "John Doe",
TaskName: "Create a new API",
StartDate: "2020-01-01",
Duration: 5
@dfinke
dfinke / grades-vlookup.ps1
Last active September 30, 2023 11:28
With PowerShell Excel - use VLOOKUP to explain data
$data = ConvertFrom-Csv @'
Name,Score,Grade
Ahmed,76
Bassam,91
Amira,42
Nadia,83
Joseph,36
Mary,45
Ashraf,81
Amal,56
@dfinke
dfinke / Clean-YouTubeTranscript.ps1
Last active September 17, 2023 12:43
This PowerShell script cleans up a YouTube transcript, from the Clipboard, for meeting notes
#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
@dfinke
dfinke / PSConvoBot.ps1
Created August 29, 2023 21:25
Simulates a conversation between two bots
class Bot {
[string] $Convo
[string] $Name
[string] $Context
[object] $Client
[object[]] $History
Bot([string] $convo, [string] $name, [string] $context, [object] $client, [object[]] $history) {
$this.Convo = $convo
$this.Name = $name
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.