Skip to content

Instantly share code, notes, and snippets.

I did not load every email into the context window at once, and I did not use a literal sliding window over your entire inbox.

I treated Gmail more like a database that I could query repeatedly. The overall pattern was:

  1. Search narrowly for candidate travel emails. I queried Gmail by year and by travel-oriented terms/providers: Airbnb, Alaska, Delta, Southwest, Booking.com, Vrbo, Turo, Expedia, “check in,” “trip,” “reservation,” etc. That gives a relatively small candidate set rather than thousands of unrelated emails.

  2. Read only the promising messages. Search results usually give enough metadata/snippets to decide which emails matter. I then opened specific messages—receipts, boarding/check-in emails, hotel folios, post-stay reviews, rental confirmations—and extracted the useful facts:

    • dates
  • origin/destination

Safe Markdown Rendering in a Streaming Chat UI

Repository-neutral guide to rendering model-generated Markdown while a response is still arriving.

Outline

  1. Rendering contract
  2. Dependencies and parser configuration
  3. Safe rendering pipeline
import requests
import os
import json
TOOL_SPECS = [
{
"type": "function",
"function": {
"name": "read_file",
"description": "Read the contents of a file",
@theptrk
theptrk / aiagent.py
Last active September 2, 2025 07:48
import requests
import os
import json
TOOL_SPECS = [
{
"type": "function",
"function": {
"name": "read_file",
"description": "Read the contents of a file",

Secure Mini DOM Framework

A lightweight, secure alternative to building DOM elements without innerHTML security risks.

Overview

This framework provides a safe way to create DOM elements programmatically, avoiding XSS vulnerabilities common with string-based HTML generation.

Core Implementation

def mock_api_stream():
MESSAGE_CONTENTS = [
"mess",
"age",
" start",
":",
" This",
" is",
" a",
" nice ",
"""Example of a simple nurse scheduling problem."""
from ortools.sat.python import cp_model
class Nurse:
def __init__(self, name, start):
self.name = name
self.start = start
function get_git_repo_url() {
# Get the SSH URL from the current Git configuration
local ssh_url=$(git config remote.origin.url)
# Check if ssh_url is empty
if [ -z "$ssh_url" ]; then
echo "Not a git repository or no origin set"
return 1
fi
alias did='vim ~/did.txt'
alias todo='vim ~/todo.txt'
alias zrc='vim ~/.oh-my-zsh/custom/myaliases.zsh'
alias zs='exec zsh'
alias gotodidlist='cd ~/projamming/todidlistdjango/todidlist'
alias ls='ls -1p'
alias rm='rm -i'
alias ga='git add'
@theptrk
theptrk / note.txt
Last active December 27, 2023 05:39
Excerpt From
Deployment from Scratch
Josef Strzibny
This material may be protected by copyright.