Skip to content

Instantly share code, notes, and snippets.

View Jak12-3's full-sized avatar
πŸ’­
probably lollygagging

Jak12-3

πŸ’­
probably lollygagging
View GitHub Profile
@Jak12-3
Jak12-3 / README.openai-structured-output-demo.md
Created October 15, 2024 12:38 — forked from dannguyen/README.openai-structured-output-demo.md
A basic test of OpenAI's Structured Output feature against financial disclosure reports and a newspaper's police blotter. Code examples use the Python SDK and pydantic for the schema definition.

Extracting financial disclosure reports and police blotter narratives using OpenAI's Structured Output

tl;dr this demo shows how to call OpenAI's gpt-4o-mini model, provide it with URL of a screenshot of a document, and extract data that follows a schema you define. The results are pretty solid even with little effort in defining the data β€” and no effort doing data prep. OpenAI's API could be a cost-efficient tool for large scale data gathering projects involving public documents.

OpenAI announced Structured Outputs for its API, a feature that allows users to specify the fields and schema of extracted data, and guarantees that the JSON output will follow that specification.

For example, given a Congressional financial disclosure report, with assets defined in a table like this:

@dannguyen
dannguyen / README.openai-structured-output-demo.md
Last active October 2, 2025 18:53
A basic test of OpenAI's Structured Output feature against financial disclosure reports and a newspaper's police blotter. Code examples use the Python SDK and pydantic for the schema definition.

Extracting financial disclosure reports and police blotter narratives using OpenAI's Structured Output

tl;dr this demo shows how to call OpenAI's gpt-4o-mini model, provide it with URL of a screenshot of a document, and extract data that follows a schema you define. The results are pretty solid even with little effort in defining the data β€” and no effort doing data prep. OpenAI's API could be a cost-efficient tool for large scale data gathering projects involving public documents.

OpenAI announced Structured Outputs for its API, a feature that allows users to specify the fields and schema of extracted data, and guarantees that the JSON output will follow that specification.

For example, given a Congressional financial disclosure report, with assets defined in a table like this:

@ThioJoe
ThioJoe / cheat.bat
Last active November 20, 2025 22:12
"Cheat" Command Wrapper Script - Makes it easier to search specific terms with 'cheat' tool. Recommended to rename to "c.bat" for easy calling.
:: -----------------------------------------------------------------------------------------
:: Cheat Command Wrapper Script
:: -----------------------------------------------------------------------------------------
:: This batch script acts as a wrapper for 'cheat.exe', enhancing its functionality
:: by allowing more intuitive command-line interactions. Specifically, it:
::
:: 1. Directly accesses cheatsheets or tags with a single argument.
:: 2. Facilitates search within a cheatsheet using multiple arguments, treating them
:: as a single search query.
:: 3. Dynamically resolves the paths to the community and personal cheatsheets
@ThioJoe
ThioJoe / DisableUSBPowerManagement.ps1
Last active September 26, 2025 21:35
PowerShell script to disable Windows power management on all currently connected serial ports, including most (if not all) USB devices and adapters.
# PowerShell script to disable Windows power management on all currently connected serial ports, including USB adapters
# In simpler terms, it prevents Windows from turning off connected serial devices to save power.
# Equivalent to right-clicking on a serial port device in Device Manager > Properties > "Power Management" Tab > Unchecking "Allow the computer to turn off this device to save power."
$hubs = Get-CimInstance -ClassName Win32_SerialPort | Select-Object Name, DeviceID, Description
$powerMgmt = Get-CimInstance -ClassName MSPower_DeviceEnable -Namespace root\wmi
foreach ($p in $powerMgmt) {
$IN = $p.InstanceName.ToUpper()
foreach ($h in $hubs) {
@ThioJoe
ThioJoe / WhisperCPP-Transcribe.bat
Last active March 12, 2025 14:53
WhisperCPP Batch File Script
:: ---- Lines beginning with :: are comments ----
:: This script is meant to make it easy to transcribe a video file using WhisperCPP.
:: You can simply drag a video file into the cmd window, then it will use ffmpeg to extract the audio, then transcribe using WhisperCPP and output to a text file.
::
@echo off
set /p videopath="Enter the full path to the video file to transcribe: "
:: Remove quotes from the input path
set videopath=%videopath:"=%
@ThioJoe
ThioJoe / Allocate-GPUs-VM.ps1
Last active August 8, 2025 15:31
PowerShell script to allocate and pass through GPU to Hyper-V Virtual Machine
# Script to easily set resource allocation for GPUs to be passed through into a Hyper-V VM
#
# Author: ThioJoe / https://github.com/thiojoe
#
### Instructions for copying drivers to VM - Will likely need to do this before running this script
# NOTE: Instead of manually copying the files, if you have an Nvidia GPU you can use my other script called "Copy-GPU-Drivers-VM.ps1" to do it automatically
# 1. Open C:\Windows\System32 on host machine and copy any files beginning with "nv" (Except nvspinfo.exe and NvAgent.dll , which are unrelated)
# 2. Place those files into the System32 folder on the VM
# 3. On the VM, create the following directory: C:\Windows\System32\HostDriverStore\FileRepository
# 4. For Nvidia GPUs, open C:\Windows\System32\DriverStore\FileRepository, copy any folders beginning with "nv_" (The number of folders should match the number of GPUs, or at least number of different models of GPU)
@Blackshome
Blackshome / appliance-notifications.yaml
Last active December 10, 2025 19:53
appliance-notifications.yaml
blueprint:
name: Appliance Notifications & Actions
description: >
# πŸ“³ Appliance Notifications & Actions
**Version: 3.8**
πŸ€” Watts your appliance up to, you're always in the know from start to finish! πŸ›ŽοΈπŸ”ŒπŸ’Έ
@ThioJoe
ThioJoe / Error-Lookup-Tool-Friendly.bat
Last active November 20, 2025 22:12
Error Lookup Tool Friendly Output
@echo off
:: Note: Lines beginning with "REM" or :: are comments
:: Script by: https://github.com/thiojoe
:: Purpose: Creates a much more user friendly output for the Microsoft Error Lookup Tool (err.exe). It parses the original output and modifies the text.
:: Usage: Just call the batch file with command prompt along with the error code the same as you would with err.exe
:: Example: error.bat 50
:: Recommended to rename this script to something shorter like 'error.bat'. Must be next to the lookup tool exe file.
@HunterXProgrammer
HunterXProgrammer / extension_media_whatsmeow_main.go
Last active August 3, 2024 17:45
Adds support for sending videos/pdf/documents and voice messages via whatsmeow mdtest command in Termux/Tasker. Check this for info - https://www.reddit.com/r/tasker/comments/10wiahq/howto_send_imagesvideospdfdocuments_in_whatsapp/
case "senddoc":
if len(args) < 3 {
log.Errorf("Usage: senddoc <jid> <document path> <title> [mime-type]")
return
}
recipient, ok := parseJID(args[0])
if !ok {
return
}
data, err := os.ReadFile(args[1])