Skip to content

Instantly share code, notes, and snippets.

View cablehead's full-sized avatar

Andy Gayton cablehead

View GitHub Profile
Analysis Complete
I've reviewed the http-nu repository and found the key insights for fixing the Darwin build failure in nixpkgs.
Root Cause
The libproc v0.14.11 crate (a transitive dependency via nu-system → part of Nushell) uses bindgen to generate Rust bindings from C code. Bindgen requires libclang to compile, but the current nixpkgs package
definition doesn't provide it for Darwin builds.
How http-nu Successfully Builds on Darwin
@cablehead
cablehead / xs.nu
Created October 20, 2025 21:22
xs.nu - Nushell wrapper for cross.stream using http builtins with Unix socket and TCP support
export const XS_CONTEXT_SYSTEM = "0000000000000000000000000"
def and-then [next: closure --else: closure] {
if ($in | is-not-empty) { do $next } else {
if $else != null { do $else }
}
}
def or-else [or_else: closure] {
if ($in | is-not-empty) { $in } else { do $or_else }
@cablehead
cablehead / todomvc.stream
Created September 3, 2025 12:13
example stream for the datastar todomvc guide: https://data-star.dev/examples/todomvc
event: datastar-patch-elements
data: elements <section id="todomvc" data-on-load="@get('/examples/todomvc/updates')"><header id="todo-header"><input type="checkbox" data-on-click__prevent="@post('/examples/todomvc/-1/toggle')" data-on-load="el.checked = false"> <input id="new-todo" type="text" placeholder="What needs to be done?" data-signals-input data-bind-input data-on-keydown="
data: elements evt.key === 'Enter' && $input.trim() && @patch('/examples/todomvc/-1') && ($input = '');
data: elements "></header><ul id="todo-list"><li role="button" tabindex="0" data-on-dblclick="evt.target === el &amp;&amp; @get(&#39;/examples/todomvc/0&#39;)"><input id="todo-checkbox-0" type="checkbox" data-on-load="el.checked = true" data-on-click__prevent="@post(&#39;/examples/todomvc/0/toggle&#39;)"> <label for="todo-checkbox-0">Learn any backend language</label> <button class="error small" data-on-click="@delete(&#39;/examples/todomvc/0&#39;)"><iconify-icon icon="pixelarticons:close" noobserver=""></iconify-icon>
@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}"