Skip to content

Instantly share code, notes, and snippets.

View dfinke's full-sized avatar

Doug Finke dfinke

View GitHub Profile

Cyclomatic Complexity Analysis

Cyclomatic Complexity is a software metric used to indicate the complexity of a program. The metric measures the number of linearly independent paths through a program's source code. A higher value means the code is more complex and potentially harder to test and maintain. Values above 10 are generally considered a warning sign.


Analysis of .\Samples\ComplexSample.ps1

  • Total Complexity: 11 (Threshold is typically 10)
  • File: .\Samples\ComplexSample.ps1
@dfinke
dfinke / Get-TimeLineMarkers.ps1
Created December 17, 2025 18:25
PowerShell scrript to extract Timeline Markers from Camtasia project - the tscproj JSON
# 1. Load the project file
$project = Get-Content "YourProject.tscproj" -Raw | ConvertFrom-Json
# 2. Set the frame rate (editRate) from the project settings
$fps = $project.editRate
# 3. Extract markers and convert frame locations to timestamps
$project.timeline.parameters.toc.keyframes | Select-Object `
@{Name="Timestamp"; Expression={"{0:hh\:mm\:ss}" -f [timespan]::fromseconds($_.time / $fps)}}, `
@{Name="MarkerText"; Expression={$_.value}} |
@dfinke
dfinke / Get-BootStrapPrompt.ps1
Created December 5, 2025 13:22
Generates prompt engineering best practices for specified AI models
#Requires -Modules PSAI
function Get-BootStrapPrompt {
<#
.SYNOPSIS
Generates prompt engineering best practices for specified AI models.
.DESCRIPTION
For each AI model in the FavoriteAI array, this function uses an agent to research and produce
#>
param(
@dfinke
dfinke / PSChatBot.ps1
Created December 2, 2025 20:19
Interactive PowerShell AI Chat Script
#Requires -Module PSAISuite
# Install-Module PSAISuite
$messages = @()
while ($true) {
$userQuery = Read-Host "User"
$messages += @{ role = "user"; content = $userQuery }
@dfinke
dfinke / New-JiraTicket.ps1
Last active September 28, 2025 22:03
One-Shot JIRA Ticket Generator with PowerShell and PSAISuite
#Requires -Module PSAISuite
$feature = 'Implement a GO program to chat with OpenAI models'
$prompt = @'
Based on this engineering spec for `{0}`, write a JIRA ticket that includes:
- problem statement
- context
- goals
@dfinke
dfinke / Find-Date.ps1
Last active August 9, 2025 17:13
A PowerShell function that uses GPT to parse questions like 'a week ago' or 'in July' into precise YYYY-MM-DD formats.
#Requires -Module PSAISuite
function Find-Date {
param(
[string]$question,
[string]$model = 'github:openai/gpt-4.1'
)
$instructions = @"
Current Date: $(Get-Date -Format "yyyy-MM-dd")
@dfinke
dfinke / cli.md
Last active August 1, 2025 17:20
AI CLI Tool Provider Open Source Key Features Cost/Access Unique Aspects Link
Gemini CLI Google Yes (Apache 2.0) Code generation, debugging, file system interaction, real-time web search, task automation, supports large codebases with 1M token context window. Free tier: 60 requests/min, 1,000/day with Google a
@dfinke
dfinke / Todo.ps1
Last active July 27, 2025 17:23
AI-Powered To-Do List in PowerShell
# using psaisuite
# Ensure PSAISuite is available
#Requires -Module PSAISuite
<#
.SYNOPSIS
Outputs text using the 'glow' markdown renderer if available, otherwise falls back to Write-Host.
.DESCRIPTION
This function checks if the 'glow' command is available. If so, it pipes the input to 'glow' for rich markdown rendering. Otherwise, it outputs the text using Write-Host.
# 📦 Install-Module: PSAISuite
# 🔗https://github.com/dfinke/psaisuite
# Get-ChatProviders
# PSAISuite supports 13 providers, and their models.
# $model = "github:openai/gpt-4.1"
$model = "anthropic:claude-opus-4-20250514"
param(
[int]$Year = (Get-Date).Year,
[int]$Month = (Get-Date).Month
)
# Set up day names
$days = @("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat")
# Print header
Write-Host ""