Skip to content

Instantly share code, notes, and snippets.

@dstoc
dstoc / harmony.gbnf
Last active September 6, 2025 06:03
guided generation for openai/harmony - improve precision of tool call generation
root ::= harmony-default # or prefill- as needed
harmony-default ::= thinking (content | preamble? tool-call)
harmony-prefill-thinking ::= not-end* "<|end|><|start|>assistant" (content | preamble? tool-call)
harmony-prefill-content ::= not-return*
thinking ::= "<|channel|>analysis<|message|>" not-end* "<|end|><|start|>assistant"
preamble ::= "<|channel|>commentary<|message|>" not-end* "<|end|><|start|>assistant"
content ::= "<|channel|>final<|message|>" not-return*
Affordance vs Formfactor
particle
must consume root
formfactor big
provide action
formfactor small
@dstoc
dstoc / feed.sh
Created January 16, 2016 09:57
Feed rtsp to ffserver as webm via mpegts
ffmpeg -i rtsp://${SOURCE} -vcodec copy -f mpegts -\
| ffmpeg -i pipe:0 -crf 10 -b:v 2M -c:v libvpx -g 25 http://${TARGET}
@dstoc
dstoc / stream.sh
Created January 16, 2016 09:56
Streaming h264 rtsp to youtube
ffmpeg -i rtsp://${SOURCE} -vcodec copy -f flv\
-acodec libmp3lame -ar 44100 -threads 6 -qscale 3 -b:a 712000 -bufsize 512k\
rtmp://a.rtmp.youtube.com/live2/${KEY}
<body>
<script>
onclick = function() {
document.body.animate([{background: 'black'}, {background: 'white'}], 1000);
}
</script>