Skip to content

Instantly share code, notes, and snippets.

View tssujt's full-sized avatar
🎯
Focusing

tssujt tssujt

🎯
Focusing
View GitHub Profile
help:
@echo ''
@echo 'Usage:'
@echo ' make [target]'
@echo ''
@echo 'Targets:'
@awk '/^[a-zA-Z\-\_0-9]+:/ { \
helpMessage = match(lastLine, /^# (.*)/); \
if (helpMessage) { \
helpCommand = substr($$1, 0, index($$1, ":")-1); \

Claude Agent SDK Technical Specification

Version: 1.0.0 Protocol Version: 2024-11-05 Last Updated: 2026-01-10

Table of Contents

  1. Overview
  2. Architecture
@tssujt
tssujt / app.py
Last active November 12, 2023 14:34
Implement request timeout for Flask App
# Requirements: pip install flask gevent gunicorn requests structlog
# gunicorn -w 3 -t 5 -k gevent -b 0.0.0.0:11111 --keep-alive 10 app:app
import signal
import requests
import structlog
from flask import Flask
logger = structlog.get_logger()
#!/usr/bin/env zsh
typeset -a lines
typeset -i prev_time=0
typeset prev_command
while read line; do
if [[ $line =~ '^.*\+([0-9]{10})\.([0-9]{6})[0-9]* (.+)' ]]; then
integer this_time=$match[1]$match[2]
from bs4 import BeautifulSoup
def contains_html(s):
return bool(BeautifulSoup(s, "html.parser").find())
#![feature(core_intrinsics)]
fn print_type_of<T>(_: &T) {
println!("{}", unsafe { std::intrinsics::type_name::<T>() });
}
@tssujt
tssujt / delete-redis-keys-matching-a-pattern.sh
Last active March 22, 2018 07:32
Atomically delete keys matching a pattern using Redis
redis-cli KEYS "prefix:*" | xargs redis-cli DEL
@tssujt
tssujt / json_field.py
Created December 1, 2017 03:43 — forked from dukebody/json_field.py
JSON field for WTForms that converts between the form string data and a dictionary representation, with validation
from wtforms import fields
import json
class JSONField(fields.StringField):
def _value(self):
return json.dumps(self.data) if self.data else ''
def process_formdata(self, valuelist):
if valuelist:
def unique_pairs(n):
"""Produce pairs of indexes in range(n)"""
for i in range(n):
for j in range(i+1, n):
yield i, j
s = "a string to examine"
for i, j in unique_pairs(len(s)):
if s[i] == s[j]:
answer = (i, j)
@tssujt
tssujt / 0_reuse_code.js
Created November 8, 2016 02:36
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console