Skip to content

Instantly share code, notes, and snippets.

View dfinke's full-sized avatar

Doug Finke dfinke

View GitHub Profile
$list1 = ConvertFrom-Csv @"
list1
Gigi
Jo
Chin
Phil
Jojo
"@
$list2 = ConvertFrom-Csv @"
@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
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 / 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.
@dfinke
dfinke / prompt.ps1
Created July 1, 2023 13:55
PowerShell prompt to display a chat is in progress at the PS cli
function prompt {
if (Get-Command Test-ChatInProgress -ErrorAction SilentlyContinue) {
$filler = ''
if (Test-ChatInProgress) {
$Provider = Get-ChatAPIProvider
if ($Provider -eq 'AzureOpenAI') {
$model = (Get-AzureOpenAIOptions)['DeploymentName']
}
else {
$model = (Get-ChatSessionOptions)['model']
@dfinke
dfinke / Invoke-ExcelTemplate.ps1
Last active June 30, 2023 02:24
Generates an Excel spreadsheet based on a given query.
function Invoke-ExcelTemplate {
<#
.SYNOPSIS
Generates an Excel spreadsheet based on a given query.
.DESCRIPTION
The Invoke-ExcelTemplate function generates an Excel spreadsheet based on a given query. The function takes a single parameter, $q, which represents the query to be used for generating the spreadsheet.
.PARAMETER q
The query to be used for generating the spreadsheet.
@dfinke
dfinke / other.md
Last active May 2, 2023 11:03
PowerShell AI covered by others
Date Author Title Type Link
4/2023 Mikey Bronowski A Brief Introduction to PowerShellAI: An Intelligent Command Line Article https://www.sqlservercentral.com/articles/a-brief-introduction-to-powershellai-an-intelligent-command-line
4/2023 Darren J Robinson Generative AI ChatGPT with PowerShell Post https://blog.darrenjrobinson.com/generative-ai-chatgpt-with-powershell/
4/2023 Trond E Haavarstein Win32App, Intune Tweet https://twitter.com/xenappblog/status/1651893224171077632?s=20
5/2023 PowerShellMichael The PowerShellAI Module! Let's Automate! Tweet https://www.youtube.com/watch?v=UFY5Ynjqg2c
5/2023 Juergen Klaassen JumpCloud PowerShell Module and the PowerShellAI Module Post https://community.jumpcloud.com/t5/community-scripts/experimenting-with-the-jumpcloud-powershell-module-in/m-p/2777/highlight/true#M230
5/2023 Merlijn Van Waeyenberghe GPT - Your AI Scripting Buddy Conference https://mms2023atmoa.sched.com/event/1LS3Y/gpt-your-ai-scripting-buddy
5/2023 Use ChatGPT OpenAI
@dfinke
dfinke / cosine_similarity.ps1
Last active April 27, 2023 00:19
Calculates the cosine similarity between two vectors - All generated by ChatGPT at the command line
# Install-Module PowerShellAI
function cosine_similarity {
param(
[Parameter(Mandatory = $true)]
[double[]]$a,
[Parameter(Mandatory = $true)]
[double[]]$b
)
@dfinke
dfinke / PSSummit.ps1
Last active April 8, 2023 06:44
PowerShell GUI for viewing YouTube Videos of the PowerShell NA Summit 2015
Add-Type -AssemblyName PresentationFrameWork
$MainWindow=@'
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Topmost="True"
WindowStartupLocation="CenterScreen"
Title="PowerSHell Summit Videos" Height="850" Width="1200">
<Grid>
<Grid.RowDefinitions>