spacestr

🔔 This profile hasn't been claimed yet. If this is your Nostr profile, you can claim it.

Edit
Rusty Russell
Member since: 2024-05-21
Rusty Russell
Rusty Russell 4d

Paused my reading of The Mandibles for Xmas day: It's not exactly holiday reading. It's one thing to know nothing stops this train. It's another thing to read through a detailed description of what the slow inevitable crash looks like: It's like the right brain equivalent of When Money Dies.

Rusty Russell
Rusty Russell 2h

Seems similar! Mine is for my specific setup: I have different machines on home vs work, so I wanted it to Just Work. And it's one file: #! /bin/sh -e REMOTES="workserver:22 homeserver:22 bouncehost:2222" # Figure out likely remotes by looking for ssh ControlPath vars, as # per this cantrip in ssh_config: # # Reuse ssh tunnels if possible. # Host * # ControlMaster auto # ControlPath ~/.cache/ssh-%r@%h:%p # ControlPersist 10m find_remote() { for r in $REMOTES; do if [ -S ~/.cache/ssh-`whoami`@$r ]; then echo $r return fi done # Nothing cached, try ping. for r in $REMOTES; do host=$(echo $r | cut -d: -f1) if ping -c 1 $host > /dev/null 2>&1; then echo $r return fi done echo "No reachable remote" >&2 exit 1 } # Make sure we're in a git dir! [ -d .git ] || (echo "Not a git dir!"; exit 1) PWD=$(pwd -P) REMOTE=$(find_remote) echo "rcargo: remote $REMOTE" HOST=$(echo $REMOTE | cut -d: -f1) PORT=$(echo $REMOTE | cut -d: -f2) # Make sure directory exists ssh "$HOST" -p $PORT "mkdir -p '$PWD'" # Sync source (exclude junk) rsync -az --delete \ -e "ssh -p $PORT" \ --exclude .git \ --exclude target \ "$PWD/" "$HOST:$PWD/" ssh $HOST -p $PORT ". ~/.profile && cd '$PWD' && cargo $*" rsync -az --delete \ -e "ssh -p $PORT" \ "$HOST:$PWD/target/" "$PWD/target/"

Rusty Russell
Rusty Russell 3d

WMD is also interesting for *when it was written*: the US had just gone off the gold standard so there was interest in such a cautionary tale.

Rusty Russell
Rusty Russell 5d

Hmm, I did a histogram mode, but it sucked if one value dominated. Percentiles a good idea though!

Rusty Russell
Rusty Russell 12d

I love this pattern: excellent advice. I asked ChatGPT how to do this in Rust, and it suggested a template using a phantom type was idiomatic Rust: pub struct ReadOnly; pub struct Writable; pub struct Store { file: File, _mode: PhantomData, } Then implement write() only in the writable specialization. I've deferred this change for now, but congratulations: you are responsible for my first refactoring (once the implementation is complete!) 🧡

Rusty Russell
Rusty Russell 12d

Leaning into the type system is one of the distinctive traits of my C code, too (and something which I really miss in Python, with its tacked-on type annotations). But Rust certainly lends itself well to this style!

Rusty Russell
Rusty Russell 14d

Since I'm taking a few weeks vacation, I've decided to seriously try to learn rust. My method in this case is to ask ChatGPT to guide me (but not write for me!) a library ("crate") that I've always wanted to write and never got around to. Of course, I get a lot of feedback on appropriate rust styling, but some of it veers into things I feel are deeper constraints. In this case, I had an open function, which took a struct containing some flags, such as "writeable", "create if didn't exist". It didn't like the fact that I asserted if you set create and didn't set writeable. Here is my response: --- Re: assert!(). I dislike APIs which allow misuse. Callers of a library should not rely on such checks in the library, in fact the concept of adding an InvalidOptions error type is offensive. A recoverable error is strictly a worse api than an unignorable error. But a compile time error is better. We should use an enum READONLY, WRITE_MUST_EXIST, WRITE_MAY_CREATE. --- Of course, it's a waste of time for me to lecture it on style, but I can't help myself!!

Rusty Russell
Rusty Russell 19d

Happy VPN-day Australia, to those kids who celebrate!

Rusty Russell
Rusty Russell 22d

Keep being genuine. You might not win, but you'll have a much better time! ❤️

Rusty Russell
Rusty Russell 22d

Good coffee can be expensive!

Rusty Russell
Rusty Russell 2d

"and see" - > "in C". Voice dictation good, not prefect, and I missed this on re-reading!

Rusty Russell
Rusty Russell 8d

Yes, it's a technical distinction, not an ethical one.

Rusty Russell
Rusty Russell 9d

You're perfectly good.

Welcome to Rusty Russell spacestr profile!

About Me

Lead Core Lightning, Standards Wrangler, Bitcoin Script Restoration ponderer, coder. Full time employed on Free and Open Source Software since 1998. Joyous hacking with others for over 25 years.

Interests

  • No interests listed.

Videos

Music

My store is coming soon!

Friends