Skip to content

Instantly share code, notes, and snippets.

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.
import json
import time
import whisper
MODEL_TYPE = "large"
model = whisper.load_model(MODEL_TYPE)
start = time.time()
file_name = "video"
@theptrk
theptrk / react-typescript-form-onsubmit.tsx
Created June 8, 2023 18:48
react-typescript-form-onsubmit
const TagSearchPage: NextPage<{ query: string }> = ({ query }) => {
const router = useRouter();
const [input, setInput] = useState(query);
const newPath = `/search/${input}`;
const title = `Search: ${query}`;
const { data, isLoading } = api.search.getAll.useQuery({
query,
});