Skip to content

Instantly share code, notes, and snippets.

View cablehead's full-sized avatar

Andy Gayton cablehead

View GitHub Profile
#!/usr/bin/env bash
# select a tmux window (ordered by recent used) with fzf and focus
tmux list-windows -F "#{window_activity} #{window_index} #{window_name}" |
sort -nrk 1 |
cut -d' ' -f2- |
fzf |
cut -d' ' -f1 |
xargs -I {} tmux select-window -t ':{}'
@cablehead
cablehead / pass-through.nu
Created June 6, 2024 01:09
pretty sure a failed experiment in passing through arguments to an internal command
alias and-then = if ($in | is-not-empty)
alias ? = if ($in | is-not-empty) { $in }
alias ?? = ? else { return }
def build-query [params] {
$params | columns | each { |x|
let value = ($params | get $x)
match ( $value | describe ) {
"string" => $"($x)=($value)",
"bool" => (if $value { $x }),
~/.s/sessions/03B982FI3LF406403X7R7HD9Z/nushell: "foo" | example echo
foo
~/.s/sessions/03B982FI3LF406403X7R7HD9Z/nushell: seq 1 5 | each { |n| sleep 1sec; $n } | example echo | first
1
Error: × Main thread panicked.
├─▶ at crates/nu-protocol/src/engine/stack.rs:88:13
╰─▶ More than one stack reference remaining!
0: 0x106fc4e54 - rust_begin_unwind
at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panicking.rs:647
1: 0x10704945c - core::panicking::panic_fmt::h1cb43b60f5788132
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" href="/icon.ico" type="image/x-icon">
{% if tld == "stacks" %}
@cablehead
cablehead / stream.out
Created February 29, 2024 20:37
stream-with-trace.out
2024-02-29 08:33:48.441 PM [TRACE] nu_cli::repl: [crates/nu-cli/src/repl.rs:776] eval source: http get https://ndyg.cross.stream/projects/chat-app/messages | from sse
2024-02-29 08:33:48.442 PM [TRACE] nu_parser::parser: [crates/nu-parser/src/parser.rs:5752] parsing block: LiteBlock { block: [LitePipeline { commands: [Command(None, LiteCommand { comments: [], parts: [Span { start: 125515, end: 125519 }, Span { start: 125520, end: 125523 }, Span { start: 125524, end: 125576 }] }), Command(Some(Span { start: 125578, end: 125579 }), LiteCommand { comments: [], parts: [Span { start: 125580, end: 125584 }, Span { start: 125585, end: 125588 }] })] }] }
2024-02-29 08:33:48.442 PM [TRACE] nu_parser::parser: [crates/nu-parser/src/parser.rs:5586] parsing: pipeline element: command
2024-02-29 08:33:48.442 PM [TRACE] nu_parser::parser: [crates/nu-parser/src/parser.rs:5065] parsing: expression
2024-02-29 08:33:48.442 PM [TRACE] nu_parser::parser: [crates/nu-parser/src/parser.rs:2303] parsing: filesize
2024-02-29 08:33:48
```
iter
and go
write: false
iter
write: Ok
want lock
have lock
process_value: []
iter
```
~/.s/sessions/03B982FI3LF406403X7R7HD9Z/nushell: http get https://ndyg.cross.stream/projects/chat-app/messages | from sse 02/29/2024 03:27:45 PM PM
want lock
have lock
ready to write
iter
and go
write: false
write: Ok
iter
@cablehead
cablehead / Cargo.toml
Last active November 19, 2023 03:06
example for UnexpectedEof error on successful HTTP/2 TLS requests with Hyper v1.0.1
[package]
name = "hv1-tls-eof"
version = "0.1.0"
edition = "2021"
[dependencies]
hyper = { version = "1.0.1", features = ["full"] }
tokio = { version = "1", features = ["full"] }
http-body-util = "0.1"
hyper-util = { version = "0.1.1", features = ["full"] }
@cablehead
cablehead / version.json
Last active May 26, 2023 20:09
Tauri updater
{
"version": "v0.3.3",
"notes": "Test version",
"pub_date": "2023-05-26T15:26:38-04:00",
"platforms": {
"darwin-aarch64": {
"signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVTTm5wRE5ISjZKcEFsWFluWEZVcEs3eVNUUGdWanNqTnBqNzB2SENXaGppaXdZVms3enhlVExtbythTTNHVGg2TVIzQ2ZNTjFWME9wWTJGNERQUkxOMVRIVXAyc2pVYkFBPQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNjg1MTI4OTgyCWZpbGU6U3RhY2tzLmFwcC50YXIuZ3oKUXVoK2wrZ052WjFYTzFoM2UxWHhCNnhaKzJnQ1lRODJ2YXVodk9QbzAyRnZ5VCt2eDNvdTFoNHdsbDZmS1RIUldIZEliZk9WWGhYZDd1UUl5WFVYQVE9PQo=",
"url": "https://github.com/cablehead/stacks/releases/download/v0.3.4/Stacks_0.3.4_aarch64.app.tar.gz"
}
}