Skip to content

Instantly share code, notes, and snippets.

View jonathan-s's full-sized avatar
🍵
Constantly drinking tea.

Jonathan Sundqvist jonathan-s

🍵
Constantly drinking tea.
View GitHub Profile
@dannguyen
dannguyen / README.openai-structured-output-demo.md
Last active January 3, 2025 19:55
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:

@veekaybee
veekaybee / normcore-llm.md
Last active March 1, 2025 11:12
Normcore LLM Reads

Anti-hype LLM reading list

Goals: Add links that are reasonable and good explanations of how stuff works. No hype and no vendor content if possible. Practical first-hand accounts of models in prod eagerly sought.

Foundational Concepts

Screenshot 2023-12-18 at 10 40 27 PM

Pre-Transformer Models

@hyperupcall
hyperupcall / settings.jsonc
Last active January 8, 2025 13:29
VSCode config to disable popular extensions' annoyances (telemetry, notifications, welcome pages, etc.)
// I'm tired of extensions that automatically:
// - show welcome pages / walkthroughs
// - show release notes
// - send telemetry
// - recommend things
//
// This disables all of that stuff.
// If you have more config, leave a comment so I can add it!!
{
@cxmeel
cxmeel / README.md
Last active June 27, 2022 10:08
ES6 Extended DOM Traversal

ES6 HTMLElement Extensions

This is a small library for extending HTMLElement methods.

Element.descendant()

Returns the first descendant of the element which matches the given selector. This is identical to Element.querySelector().

Syntax

<HTMLElement> HTMLElement.descendant(<String> selector)

Element.ancestor()

@dobesv
dobesv / dev_signed_cert.sh
Last active October 14, 2024 08:30
Script to create (1) a local certificate authority, (2) a host certificate signed by that authority for the hostname of your choice
#!/usr/bin/env bash
#
# Usage: dev_signed_cert.sh HOSTNAME
#
# Creates a CA cert and then generates an SSL certificate signed by that CA for the
# given hostname.
#
# After running this, add the generated dev_cert_ca.cert.pem to the trusted root
# authorities in your browser / client system.
#
from django.contrib.admin import ModelAdmin
class MyTableAdmin(ModelAdmin):
...
paginator = LargeTablePaginator
...
@bvaughn
bvaughn / react-lifecycle-cheatsheet.md
Last active October 8, 2024 15:46
React lifecycle cheatsheet

React lifecycle cheatsheet

Method Side effects1 State updates2 Example uses
Mounting
componentWillMount Constructor equivalent for createClass
render Create and return element(s)
componentDidMount DOM manipulations, network requests, etc.
Updating
componentWillReceiveProps Update state based on changed props

This document has moved!

It's now here, in The Programmer's Compendium. The content is the same as before, but being part of the compendium means that it's actively maintained.