Skip to content

Instantly share code, notes, and snippets.

@omaclaren
omaclaren / ccc.sh
Created January 26, 2026 09:56
Minimal bash function (add to .bashrc) to generate executable shell commands from natural language. Uses claude code in non-interactive mode (with -p). Can be adapted to other clis easily
# uses claude code and haiku but can be adpated easily
ccc() {
local r=$(claude -p "Output a bash one-liner between <cmd> and </cmd> tags to: $*" --model haiku)
local cmd=$(echo "$r" | sed -n '/<cmd>/,/<\/cmd>/p' | sed 's/<cmd>//;s/<\/cmd>//' | tr -d '\n')
echo "> $cmd"
read -p "[e]xecute | [c]opy | [q]uit: " c
[[ $c == e ]] && eval "$cmd"
[[ $c == c ]] && echo -n "$cmd" | pbcopy && echo "Copied."
}
@omaclaren
omaclaren / psl.md
Last active May 5, 2025 21:47
A simple 'prompt script language' (PSL) specification, giving instructions for an llm to allow prompting in a pseudocode-like way

Prompt Script Language (PSL)

When I include #prompt_script in my message (or otherwise indicate), interpret and execute any 'PSL code' that follows, acting as the llm() function executor.

Syntax (allow similar variations)

variable_name <- llm('task description', input_1, input_2, ...)