Skip to content

Instantly share code, notes, and snippets.

@disler
disler / README.md
Created March 31, 2024 14:34
Use these Prompt Chains to build HIGH QUALITY AI Agents (Agentic Building Blocks)

Setup

  1. Create a new directory with these three files (requirements.txt, main.py, README.md)
  2. python -m venv venv
  3. source venv/bin/activate
  4. pip install -r requirements.txt
  5. python main.py
  6. Update main() to run the example prompt chains
@Konfekt
Konfekt / chatgpt-write-msg.py
Last active May 4, 2024 00:02
let ChatGPT write a sensible commit message using an adaptable Python script
#!/usr/bin/env python3
# Adaption of https://github.com/tom-doerr/chatgpt_commit_message_hook/main/prepare-commit-msg
#
# Mark this file as executable and add it into the global hooks folder
# whose path is given by the core.hooksPath configuration variable
# skip during rebase
import sys
if len(sys.argv) > 2:
@jdhitsolutions
jdhitsolutions / Get-GHIssueStats.ps1
Created March 7, 2024 17:59
My solution for the PowerShell Podcast scripting challenge to write PowerShell code to get GitHub issue statistics.
#requires -version 7.4
<#
This function requires the gh.exe command line tool.
You many encounter API rate restrictions under heavy use.
#>
#load the custom formatting file
Update-FormatData $PSScriptRoot\ghLabelStatus.format.ps1xml
@alainQtec
alainQtec / BuildHelper_Functions.ps1
Last active February 21, 2024 22:39
Basic build helper functions
function Set-BuildVariables {
# .SYNOPSIS
# Prepares build env variables
# .DESCRIPTION
# sets unique build env variables, and auto Cleans Last Builds's Env~ variables when on local pc
# good for cleaning leftover variables when last build fails
[CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Low')]
param(
[Parameter(Position = 0)]
[ValidateNotNullOrEmpty()]
@JustinGrote
JustinGrote / Get-OpenApiDefinition.ps1
Created February 15, 2024 02:40
Download multiple parts of an OpenAPI spec
using namespace System.Collections.Generic
function Get-OpenApiDefinition {
<#
Fetches the OpenAPI definition from the specified URI and for every ref, downloads the relative file to the destination folder. Currently only works with relative refs
#>
param (
#The source
[Parameter(Mandatory)]
[Uri]$Uri,
@jimbrig
jimbrig / PSWakeOnLan.psm1
Created February 8, 2024 21:40
[PowerShell] Wake on LAN (WOL) and Packet Broadcast to Remote Machine
Function Get-MACAddress {
Param(
[Switch]$Local,
[String]$ComputerName
)
if ($Local) {
$MACAddress = Get-WmiObject -Class Win32_NetworkAdapterConfiguration -Filter "IPEnabled = 'True'" | Select-Object -ExpandProperty MACAddress
} else {
$MACAddress = Get-WmiObject -Class Win32_NetworkAdapterConfiguration -Filter "IPEnabled = 'True'" -ComputerName $ComputerName | Select-Object -ExpandProperty MACAddress
@JustinGrote
JustinGrote / ConvertTo-Markdown.ps1
Created January 27, 2024 00:25
Convert PowerShell Objects to Markdown Display by screen-scraping Format-Table
using namespace System.Collections.Generic
using namespace Microsoft.PowerShell.Commands.Internal.Format
#Inspired by: https://gist.github.com/aaroncalderon/09a2833831c0f3a3bb57fe2224963942
<#
.Synopsis
Converts PowerShell Objects or Format-Table output to Markdown
#>
Function ConvertTo-Markdown {
[CmdletBinding()]
@JustinGrote
JustinGrote / Update-HelpFast.ps1
Last active March 9, 2024 14:37
Update Help More Quickly using ThreadJob
#Requires -module ThreadJob
param(
#Filter modules to update by name, otherwise will update all modules
[string[]]$Name = @(),
[ValidateSet('AllUsers', 'CurrentUser')]
$Scope = 'CurrentUser',
$ThrottleLimit = 30
)
try {
@JBGruber
JBGruber / docker-compose.yml
Last active May 25, 2024 17:59
My compose file to run ollama and ollama-webui
services:
# ollama and API
ollama:
image: ollama/ollama:latest
container_name: ollama
pull_policy: missing
tty: true
restart: unless-stopped
# Expose Ollama API outside the container stack
@business24ai
business24ai / save_note_to_obsidian.py
Created December 31, 2023 11:29
An AutoGen Studio skill to store markdown content to our second brain obsidian
# A skill to store markdown content to our second brain obsidian
import os
def store_note_to_obsidian(filename, content):
"""
Store markdown content to our second brain in a local Obsidian vault
:param filename: str, filename of the note
:param content: str, content of the note as markdown