Busride-rs

Feb. 14th, 2024 02:42 pm
roadrunnertwice: Dialogue: "Craigslist is killing mothra." (Craigslist is killing Mothra (C&G))

Okay, so I know this is going to shock you, but I've been working on something arcane and impractical.

I'm in a new band called Kuwait Grips

I made a wrapper for normal HTTP-speaking Rust web apps so their traffic can take an extra round trip through a totally different protocol, before being translated back into HTTP for the outside world. Specifically, I plan to serve Axum-based apps via FastCGI, a protocol that went out of fashion in the mid '00s.

This probably sounds dubiously useful, but, man, listen,

Or don't! Contents: historical background and some technical exegesis. )

Anyway, I Did It!

Here's a little 3m demo I recorded when I got my initial proof-of-concept working. If you know anything about deploying a self-hosted app in the 2020s, it will shock and scandalize you.

And, here's the code itself, including a demo project:

I found a FastCGI server library for Rust (I'm SO curious about why the author made this, but yeah it's very precisely what I needed) and put together a server loop that translates between the normal HTTP that an inner app understands and the FastCGI protocol that Apache is willing to accept. As long the binary you build knows how to start up in the weird environment that classic FastCGI provides, you can just install it, drop in an .htaccess file, and wander off to go do something else.

At the moment, it's Axum-specific and has to be built into your app as an alternate server mode. In theory it ought to be possible to make a fully generalized wrapper that can spawn any program as a child process and proxy real-actual HTTP to it, but that's more work than I want to do on this; at the moment, this should work fine for me.

So... Why??

Here's another interesting point about apps that run in this mode: anyone else can install them on their shared hosting just as easily, if I give them a build and a README.

In the last few years, there's been a medium amount of big talk about how we need to re-wild the interwebs; bring back some spirit of curiosity and generosity and chaos that we thought we perceived in the '90s and the '00s.

In a recent thread that rolled across my Mastodon feed (wish I could remember and link it, but it took a while to percolate before I took it to heart), someone pointed out the short version of what I described above — that hosting has gotten better for pros at the expense of amateurs — and then said: if we think there's a connection between self-hosting and re-wilding the web, then we're going to have to reverse that, because getting out of a tech-dominated world of walled gardens is going to require empowering the type of normal users who could kinda-sorta keep a Wordpress installation afloat back in the day but who have no hope of, say, sysadmining a Mastodon instance.

I've been thinking about that in the background, a bit.

roadrunnertwice: DTWOF's Lois in drag. Dialogue: "Dude, just rub a little Castrol 30 weight into it. Works for me." (Castrol (Lois))

Julia Evans’ StrangeLoop 2023 keynote was about digging into the different reasons a tool can be hard to learn, and it was a real good talk! At the end, as a tossed-off addendum to a conclusion about continuing to learn things, she said “I still don’t know why Git is hard.”

I happen to have thoughts about that one!

I have had to teach a fair number of (generally clever and persistent) people how to get around in Git or how to use its more advanced features. While doing so, I have often failed to get the basics to stick, which is incredibly aggravating to someone who prides themselves on explaining things. Sometimes this devolves into me talking about wave/particle duality as a crucial metaphor for getting through a rebase intact, and everyone in the room looking at me like my second head just tried to convert them to Gnosticism.

So, I’ve spent some time thinking about this before this weekend.

Read more... )

roadrunnertwice: Weedmaster P. Dialogue: "SON OF A DICK. BALL COCKS. NO. FUCKING." (Shitbox (Overcompensating))

tl;dr: If you interactively rebase to clean up a PR, GitHub displays all your commits in the wrong order and wastes everybody's goddamn time. Fix it like this:

git rebase -i <PARENT SHA> -x 'sleep 1 && git commit --amend --no-edit --date=now'

Explanation: )

It lives

Sep. 25th, 2019 10:46 pm
roadrunnertwice: Yoshimori from Kekkaishi, with his beverage of choice. (Coffee milk (Kekkaishi))

eardogger dot com

LMK if you wanna be an alpha tester and I'll make you an account. (I haven't built the self-serve sign-up form yet, so that's still by hand.)

Never mind, looks like I got sign-ups working, so I guess go ahead and open the floodgates.

roadrunnertwice: DTWOF's Lois in drag. Dialogue: "Dude, just rub a little Castrol 30 weight into it. Works for me." (Castrol (Lois))

I think I’ve finally wrapped my head around promise-based async logic in JavaScript. It took a while!

To celebrate, here’s the analogy I wish someone had given me ages ago:

A promise is a black hole. Once a value crosses the event horizon into a promise, it can never come back out again to interact with synchronous code. It’s in another universe now! You can send values from synchronous code in there to interact with the promise universe, but they’ll also have to stay there once they cross the event horizon. And it turns out that this is all fine and doesn’t limit you very much at all; it’s just that when you’re in the promise universe, any logic has to be of the form “do this once this condition is met,” never just plain “do this.” Different physics inside the black hole.

Anyway, once I started thinking of it like that, it all seemed perfectly reasonable. It also clarified some things that seemed arbitrary before, like why you can’t call await unless you’re in an async function. (It’s because await is just a clever balancing of terms so you can think synchronously while still obeying async physics.) I gather there ARE other languages that have promises where you can be like “no really, block the main thread and wait for this to resolve,” but since JS’s whole design philosophy treats blocking as such an apocalyptic event, it makes sense that you can never come back from async.

The basics

Sep. 15th, 2019 06:48 pm
roadrunnertwice: Dialogue: "I have caught many hapless creatures in my own inter-net." (Hapless creatures (Rainy Days))

Well, I've been working a bit more on Eardogger (my app for movable bookmarks, see previous), and it's coming along nicely. I think! Hard to say tbh, lol.

I'm working in Node.js with Express, I'm doing all the database stuff fairly "raw," and I'm doing the frontend in "vanilla" JS (but freely using any ES2017 shit I feel like). There's a couple reasons for all those choices, but the big one is that these are all areas where I recently ran up against some kind of wall elsewhere in my professional or personal projects due to my ignorance of the raw basics of How Shit Works.

Anyway, where I'm at right now is:

  • Glitch.com is kind of amazing. I'll need to move off it at some point soon, but:
    • The live app updates are even better for the first three hours on a project than I ever expected.
    • The starting templates are legit useful.
    • The amount of stuff they let you just get away with under the hood is pretty incredible. The instant you start chafing at the web editor, it reveals itself as a fairly legit remote dev server with very fast git-based deploys. (Pro-tip: remember you can't push to master, because it's not a bare repo. Push a named branch and merge it from the console, then remember to run their special refresh script to kick the deploy and the web editor.)
  • Express is actually kind of nice. I'd been skeptical, because the ecosystem just seems completely fucking illegible at first (and at second, and at third).* But the way it lets you compose micro-apps into a coherent whole is impressive.
  • Content Security Policy has very nearly killed bookmarklets. Remember how the classic Instapaper bookmarklet would get better over time without you having to upgrade it? And remember how it would finish doing its thing without navigating you away from your page? Both of those are basically impossible now, or at least they're impossible on a low-double-digit (and ever-growing) percentage of websites. It looks like browser vendors are vaguely aware that that's bad, but they don't seem to consider it at all urgent. (For a hot minute bookmarklets were broken entirely on sites with CSP, and at least they got that sorted out. Now bookmarklets work with CSP as long as they don't fucking do anything, lmao.)
  • Fucking CORS, omfg.
  • At least vanilla JS keeps gradually getting better. For example, fetch() is a much nicer replacement for XMLHttpRequest. Anyway, this app is definitely not supporting IE11.
  • Figuring out what's cheap at the various cloud vendors is kind of A Lot to deal with. It's looking like I can get this thing running with a free Postgres database (already got that working!) and eventually a free app container on Heroku, so that's cool; it's an open question what to do if and when it gets popular, and I'm not sure what effect the 30m "sleep" constraint on free tier will have on the UX, but that's all in the future.

* To be fair, I have this problem with like 70% of the Node and general JS ecosystems. I'll spare you my theories about why it's all like that.

roadrunnertwice: Weedmaster P. Dialogue: "SON OF A DICK. BALL COCKS. NO. FUCKING." (Shitbox (Overcompensating))
I had to move my work laptop to the side of the desk to make room for an external keyboard (it's one of those 2016 MacBook Pros and has a busted key), and now both cats have gotten REALLY into walking onto its keyboard and then just forgetting what they were doing and sitting down, while the music flips out, the trackpad clicks randomly, and emails get deleted or archived at hyperspeed.
roadrunnertwice: Wrecked bicyclist. Dialogue: "I am fucking broken." (Bike - Fucking broken (Never as Bad))

You know, over time I’ve adopted one or two weird arrangements in my workspace to avoid RSI or back strain (standing desk, left-mousing, Fucking Dvorak), which seems to be at least one level past what most people want to mess with. But I cannot even calculate the level that this guy is on. I am so impressed.

roadrunnertwice: Dialogue: "Craigslist is killing mothra." (Craigslist is killing Mothra (C&G))
So I had a somewhat sketchy craigslist adventure the other day. Or rather, the lead-up was sketchy in one way, and the punchline was sketchy in an entirely different and much more hilarious way.

I was buying a video card, and the seller said they could only meet at their house (which was out in goddamn Tigard) and at an inconvenient rush-hour-hell time. And actually that part was Especially Strange. Their exact words were: “Although I would love to, I can't meet anywhere besides my place.” ???????

Ruth reminded me that I was being an idiot by ignoring the prime craigslist directive (meet in a public place), which I was, but I was pretty sure it was fine? But she did have a point, so I brought a friend for backup.

Well. We get out there and knock on the door, and a kid answers, I’m figuring 13-years-old-ish. And he’s like, “Nick?” And I’m like “yup. Sam?” looking behind him to see who else is home. And he’s like “here’s the card, should all be working fine, feel free to email me if you need help w/ drivers or anything!” And I’m like... “cool beans, here’s that $60, pleasure doing business. 👍🏼👍🏼👍🏼”

Anyway I’m about 100% sure listing stuff before you’re 18 is against the TOS, and he definitely scheduled that annoying meeting time so his parents wouldn’t be home, lmao! I kind of admire his moxie, but I‘m also debating texting him to suggest having some backup of his own around if he has to sell something out of his own house again. On the other hand, given what I remember of living in the burbs, probably he’s a mid-level weed baron or something and doesn’t need my input.
roadrunnertwice: Weedmaster P. Dialogue: "SON OF A DICK. BALL COCKS. NO. FUCKING." (Shitbox (Overcompensating))

the relevant xkcd strip

This is long, and it's about troubleshooting an exotic driver issue. )


Of course, I'm probably going to replace the damn thing eventually anyway because the download speeds are so heinously slow. Earlier I used connection sharing via Ethernet to plug the PC into my MacBook's wireless, and it was literally like ten times faster.

Well, still, I was offended that I couldn't understand what was going on and I really wanted to win, so I guess it was worth it just for that.

roadrunnertwice: Weedmaster P. Dialogue: "SON OF A DICK. BALL COCKS. NO. FUCKING." (Shitbox (Overcompensating))

VICTORY!! I got Windows installed, got drivers and updates taken care of, got Steam installed, and managed to play like five or ten minutes of Hyper Light Drifter. At which point it was WAY past my bedtime.

What did I learn this time? I learned that it is ✨basically fucking impossible✨ to use a Mac or Linux system to turn a Windows ISO into a bootable USB installer drive. Give up. Do not try. Do not get clever. Ask a friend with a Windows box to do it for you.

I had a valid ISO! This should have been a cakewalk! But I spent all evening on it and failed A LOT.

...a lot. )

But anyway! It's done!

BTW, Ruth was able to get me a really cheap copy of Windows from the employee store, thank u Ruth!! 😭 Taking everything into account, including the Car2Go trip for picking up the tower to begin with, I ended up spending $123 for a working gaming PC. AN ALL-AROUND SUCCESSFUL ENDEAVOR.

roadrunnertwice: DTWOF's Lois in drag. Dialogue: "Dude, just rub a little Castrol 30 weight into it. Works for me." (Castrol (Lois))

So these junkyard PC adventures have continued, because I am in full project mode.

Little stuff:

  • Discovered how to remove that useless front fan! (And vacuumed out a huge wad of dust from inside the plastic front panel while I was in there.) It looks like the case was designed to have a fan there, but it was meant to suck up air from a tiny downward-facing vent a few mm above the floor? How about not.
  • I also replaced the rattly rear exhaust fan, because it turns out a nice fan costs like $8 new.
  • Tidied up the interior cables with some stretchy ties, some blue tape, and the one Command hook I could scrounge up. (They were a tangled mess, and I worried they'd foul the fan blades.)
  • Installed the SSD.
  • Bought a sketchy USB bluetooth adapter for $7.
  • And hey, it looks like HDMI audio from the gpu is working fine, even in Linux! So my plan of just swapping my speaker cord between the thunderbolt dock (for Mac) and the monitor (for PC) will totally work!

    (Actually my Mac can also use the monitor for sound, via DisplayPort... except then the music cuts out when the monitor goes to sleep, and that just won't fly. So swapping cables it is.)

Stuff where I had to learn a thing:

  • I took the Intel heat sink off (and blew a shitload of dust from between the fins), removed the crusty old thermal paste, and applied fresh paste! 😱 I've never had to deal with the "goop" phase of computer building before, but I heard that the stuff loses efficiency by drying out over time, and my housemate had a tube of decent paste sitting around, and I was like, welllll, while I have it open...

    It was mildly tense, but really pretty easy. The only confusing part was that the pegs holding the heat sink in were already in the "unlocked" position (which they shouldn't have been!!! 😑), so I was disoriented and had to read multiple guides about how to remove it before I figured out what was up.

    I already checked on the CPU temperature sensors several times last week (because I was a tiny bit paranoid about turning off that front fan), and they'd been hovering somewhere in the 50°C+ range (which is fine) during a session of mucking around in my temporary Ubuntu sandbox. So after doing the paste thing, I switched all the fans to "silent" mode in the BIOS and booted back into Linux, and after running for a while, the core temp was just kind of chilling in the mid-30°s. So I'm pretty sure that was actually worthwhile!

Anyway, now I'm at the point where I get to install an OS and maybe actually play a game or two. Wish me luck!!!

roadrunnertwice: Weedmaster P. Dialogue: "SON OF A DICK. BALL COCKS. NO. FUCKING." (Shitbox (Overcompensating))

OK. I’ve been wanting a better way to play the backlog of cool shit in my Steam library.

A lot of it technically plays on Mac, but man, it all just runs like a dog on a 13-inch MacBook Pro. And I’m not in AAA land either, this is all just low-power indie stuff! (I blame the anemic Intel gpu for half of it, and poorly optimized/buggy ports for the rest.)

Anyway, the expense of a gaming PC always seemed way too high for what I'd be using it for, so I've never gotten around to it. But recently I stumbled into a free hand-me-down desktop GPU (midrange, circa 2011), and I started wondering: could I cobble together a half-assed machine for pocket change, chuck that seven-year-old card in, and still easily crush anything my Mac has been choking on?

ACTUALLY LOOKING PRETTY PROMISING!

something of a journey ensues )

So now I've gotten it booting from a Linux USB stick, with an old keyboard I like and a scrounged mouse, and everything seems to be working fine so far. (Even managed to update it to a post-Meltdown/Specter bios! Pro-tip, Asus's no-OS updater might sound good, but it's way too finicky about partitions and filesystems, so give up early and flash a freeDOS stick.) My housemate gave me the world's tiniest USB wi-fi adapter (only does wi-fi 4 [n], but who cares, it works!), another friend traded me a spare SSD for some catsitting over Christmas (joke's on him, I love hanging out w/ his cats), and since Ruth is now technically a Microsoft employee I think I can convince her to buy me a copy of Windows for hella cheap.

God, I'd forgotten what a fantastic dopamine hit you can get from a really epic feat of garage saleing.

roadrunnertwice: Dialogue: "Craigslist is killing mothra." (Craigslist is killing Mothra (C&G))
I think I just realized why Apple ditched MagSafe for USB-C power. We were all wondering how they could think USB-C was better, but I don't think they actually do! They know it's inferior, but decided the benefits were worth the drawbacks because laptop battery life is finally acceptable.

In 2006, you had to be plugged into dangerous outlets all the time because your batteries could only last for a few hours. But now I can do almost a whole day's work on one charge, so I can wait and plug in somewhere that's not a trip hazard. Batteries still suck more than they should, especially at telephone sizes, but modern laptop batteries actually kind of rule. (When combined with the much more efficient CPUs and screens we're getting now.)

So when it came time to make a new MagSafe that would fit into the little micro-macbook, they were probably like "If normal people don't spend hours every day plugged into awkward cafe outlets, is a superior power cord still worth all that engineering effort and a (*ominous thunderclap*) Whole Extra Connector?"

IDK if I agree with their conclusion, but at least it makes more sense when I think about it that way. Also, they'll probably manage some kind of Qi-based thing in three years that would have replaced MagSafe anyway.
roadrunnertwice: Weedmaster P. Dialogue: "SON OF A DICK. BALL COCKS. NO. FUCKING." (Shitbox (Overcompensating))

On the plane to Edinburgh I got to the bottom of a persistent "launchd is eating 90% CPU and IDEK why" problem, which is probably a first in recorded human history and which I feel pretty great about.

The deal was: Launchd freaked because I copied a user account's files from another computer, where that user had a different name. There were some service plists in ~worknick/Library/LaunchAgents (Spotify web helper, and something involving Steam) that were trying to run helper apps stored in ~nick/Library/Application Support, because "nick" was worknick's old name, but he already existed (and was a different person) on this computer, and worknick couldn't access those files!

For some dumb reason, launchd didn't have a cooldown between tries or anything, and was trying to restart these un-startable jobs many times a second. I edited the Spotify plist, killed the Steam one, took out a few old ones that weren't relevant anymore, then rebooted. SOLVED. Amaze. Now I've got something like quintuple the amount of battery life when the worknick user is logged in.

roadrunnertwice: Weedmaster P. Dialogue: "SON OF A DICK. BALL COCKS. NO. FUCKING." (Shitbox (Overcompensating))
The rest of the house is shoulder-deep in a computer-box, building a gaming PC for a friend of ours. I am staying out of that.

I think the last time I cracked open some compu-tower ribs was at the yarn shop back in 2009. We had these three mildly crappy Dell P4 towers for running the POS system and everything, but they were acting like they were the ultra crappy kind. Just slow as hell and unresponsive and bullshit. Stev and Hannah were all angsting about whether we could afford new ones and how to go about getting them, and I was like, "lemme take a look." Reader, these 3Ghz machines were choking along on a half-gig of RAM each. I got on Newegg, and was like "Gimme the credit card, I'll get you some rejuvenated computers for like $140."

Once the sticks arrived, I got the backroom and cafe computers beefed up and breathing easy in like 20 minutes. Then I upgraded the main counter PC, tried to power it back up, and got nuthin'. I cracked it open again to make sure I hadn't left anything loose, and we were all like "Uh, was that creepy amber light there the last time?" It was totally not.

I searched the internet for the manual again, and it turned out the amber light on the mobo meant "power fault," usually a bunk power supply. So I grabbed a screwdriver and tore the fucker out, tossed it in my backpack, got on my motorbike, and jetted up Milwaukie to Free Geek, where they confirmed it was toast and sold me a better one (for the $15 I had liberated from the petty cash drawer). Which totally solved the problem, and left me feeling like quite the techno-samurai moto-badass.

And then the whole shop folded explosively in August and we were all out of work, but at least the computers were non-bullshit for as long as the shop survived.
roadrunnertwice: Weedmaster P. Dialogue: "SON OF A DICK. BALL COCKS. NO. FUCKING." (Shitbox (Overcompensating))
My parents want a new computer. For various reasons, I kind of wanted them to get a Mac, but they'd prefer a Windows 7 box,* so that's what they're shopping for. Or rather, asking me to help them shop for.

I have no idea how to buy a Windows PC these days.

They're leaning towards getting a Dell, mostly due to inertia; I suspect there are better options. Any advice? This will probably be a desktop machine instead of a laptop, and will be used mostly for productivity and media.



Also, they want to be able to watch Hulu and Netflix Instant on their TV, and I'm not sure of the most cost-effective or easiest way to do that. Is Boxee good? What's the best way to run it? Should I consider scrounging a cheap AppleTV or something?


_____
* Familiarity, mostly. Plus they need Quickbooks, which would require them to buy Windows 7 and VMWare anyway if they went with a Mac. (Which I still think would be preferable to having to maintain and protect a full-time Windows box, but whatever; I won't be using the computer.)

Actually, this does have the side benefit of putting Chris in charge of tech support from here on out. I haven't administered a Windows system in years, so tag, bro, you're it! :P