Skip to content

Instantly share code, notes, and snippets.

View cablehead's full-sized avatar

Andy Gayton cablehead

View GitHub Profile
@cablehead
cablehead / index.html
Created August 6, 2025 18:48
ccto-wednesday-july-23-2025
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>reveal.js</title>
<link rel="stylesheet" href="dist/reset.css">
<link rel="stylesheet" href="dist/reveal.css">
keybinds clear-defaults=true {
locked {
bind "Ctrl g" { SwitchToMode "normal"; }
bind "Ctrl o" { SwitchToMode "pane"; ToggleFocusFullscreen; SwitchToMode "locked"; }
bind "Ctrl t" { SwitchToMode "tab"; }
}
pane {
bind "left" { MoveFocus "left"; }
bind "down" { MoveFocus "down"; }
bind "up" { MoveFocus "up"; }
use std-rfc/kv *
alias ept = each {|x| print ($x | table -e) }
$env.config.edit_mode = 'vi'
$env.config.table.header_on_separator = true
$env.config.table.trim = {
methodology: "truncating"
truncating_suffix: "..."
# Spawn xs serve in a temporary directory, run a closure, then cleanup
def .tmp-spawn [closure: closure] {
# Create a temporary directory
let tmp_dir = (mktemp -d)
print $"Created temp directory: ($tmp_dir)"
let store_path = ($tmp_dir | path join "store")
try {
# Create store directory
@cablehead
cablehead / spawn-xs-test.nu
Last active July 28, 2025 01:06
Nushell experiment for cross.stream
# Spawn xs serve in a temporary directory, run a closure, then cleanup
export def spawn-xs-test [closure: closure] {
# Create a temporary directory
let tmp_dir = (mktemp -d)
print $"Created temp directory: ($tmp_dir)"
let store_path = ($tmp_dir | path join "store")
try {
# Create store directory

Based on my analysis of the codebase, here's the updated spec for adding .cat -T <topic> / .cat --topic <topic> functionality:

Code Flow Analysis

The .cat command flows through these layers:

  1. xs.nu wrapper → calls xs cat CLI with flags
  2. src/main.rs CommandCat → parses CLI args, builds ReadOptions
  3. client/commands.rs cat() → makes HTTP GET to / with query params
  4. api.rs handle_stream_cat() → parses query into ReadOptions, calls Store::read
  5. store/mod.rs Store::read() → performs backlog scan + live subscription
# Create VPC
VPC_ID=$(aws ec2 create-vpc \
--cidr-block 10.0.0.0/28 \
--tag-specifications 'ResourceType=vpc,Tags=[{Key=Project,Value=vibenv}]' \
--query 'Vpc.VpcId' \
--output text)
# Disable DNS Support and Hostnames
aws ec2 modify-vpc-attribute --vpc-id $VPC_ID --enable-dns-support "{\"Value\": false}"
aws ec2 modify-vpc-attribute --vpc-id $VPC_ID --enable-dns-hostnames "{\"Value\": false}"

Spec: Command API Change – Use .response Frame with Collected Pipeline

Objective

  • Change command event output: Instead of streaming each output Value as a .recv event, collect the full pipeline, then append a single frame with topic <name>.response.
  • Apply return_options: The new .response event must respect the suffix and ttl from the command's return_options.
  • Remove .complete event: No .complete frame is emitted for these commands.
@cablehead
cablehead / aws.md
Last active January 16, 2025 10:31

AWS ECS/ELB Service Reference

meta: note that Nushell requires ( .. ) around multi-line commands, and it doesn't support trailing slashes for line continuation

Service Lifecycle

Task Definition Management

# Get clean task definition template (remove AWS-managed fields)
(aws ecs describe-task-definition --task-definition your-task-definition
# $env.OPENAI_API_KEY = (.head OPENAI_API_KEY | .cas $in.hash | str trim)
# $env.GPT2099_PROVIDER = { name: openai model: "gpt-4o-2024-11-20" }
$env.CEREBRAS_API_KEY = (.head CEREBRAS_API_KEY | .cas $in.hash | str trim)
$env.GPT2099_PROVIDER = { name: "cerebras" model: "llama-3.3-70b" }
$env.GPT2099_INTERACTIVE = false
$env.BOT_TOKEN = .head discord.ws.token | .cas $in.hash