Compare commits

...

10 commits

15 changed files with 393 additions and 4 deletions

View file

@ -0,0 +1,35 @@
Meta(
title: "Agis updates",
summary: Some("I trim some fat from Agis, my Spartan protocol server"),
published: Some(Time(
year: 2024,
month: 5,
day: 29,
hour: 16,
minute: 26,
second: 21,
)),
tags: [
"agis",
"spartan",
"rust",
"programming",
],
)
---
I've had very little time recently to devote to programming, but there have been a few things that have received some attention in the past few months which are beginning to bear some fruit in more tangible ways. I've been focusing more on library code recently than applications. A side effect is that I'm finding that often an application that I wrote in the past might benefit from applying that library code.
Case in point is my Spartan server, Agis. What is Agis? It's a multithreaded Spartan protocol server written in Rust with some nice features. It serves this capsule over Spartan, actually. Being written in Rust has benefits and drawbacks. One of the benefits of writing something in Rust is having access to the entire crates ecosystem. One of the serious drawback of writing an application in Rust is having access to the entire crates ecosystem, because adding one dependency is generally going to pull in 3, 4, or 50 transient dependencies. This morning I finished swapping out two of the original dependencies in Agis with my own code as an experiment to see how much the dependency graph is brought down. The results are promising.
OsRand is a tiny crate I wrote a while back for random number generation. Osrand had the explicit goals of simplicity and no dependencies beyond `std`. Pretty much every RNG on crates.io generates randomness via cryptographic code. That's fine, and it's even good if you want to be able to use it in embedded applications without an OS, but what about when your application is running on some form of Unix? In Unix we already have an RNG at /dev/random and a psuedo-RNG at /dev/urandom. In OsRand I just use the rust std::io::Read interface to read random bytes from one of those device files, configurable at compile time through a feature flag. So yeah, it's tiny and simple.
But one of the most common use cases for an RNG isn't numerical at all actually. No, a lot of the time we want a random string rather than a random number. So I included a random string generator in OsRand, and to the best of my knowledge it's the only RNG on crates.io which has this capability. Seems like a huge oversight to me, but it's the way that the ecosystem developed I guess. Anyway, one of the original deps for Agis was the `tempfile` crate, which was used to create temporary files with a bit of randomness in their pathname. But tempfile, as I mentioned before, commits the sin of pulling in five other crates when you add it to your Cargo.toml. By replacing tempfile with OsRand I was able to remove five transient dependencies and 8k of binary size.
Agis has built in logging which is pretty verbose. Every log entry gets the time prepended. As I originally built the program I was using the chrono crate to get the time and make it human readable. Now chrono is a great library that covers 99.99% of anything related to timekeeping. It's a great library. But pulling in all of chrono, plus it's dependencies, was overkill for Agis. My own crate `epoch` does about 70% of what chrono does in a fraction of the code size and with no dependencies beyond rust std. The only drawbacks right now are that I haven't published it to crates.io so you have to get it from git, and I haven't resolved completely getting the current time for a completely stupid reason. Allow me to explain..
Unix records time using timestamps which are counted as the number of seconds since the Unix epoch, which occurred on Jan 1, 1970. Incidentally that's where the name of the crate came from. Anyway, those seconds were originally recorded as a signed 32-bit integer, or i32, which was way too small and was definitely going to overflow if not made larger. That's a solved problem now, because we all settled on using an i64 instead. By 'all' I mean every extant Unix derivative or clone. But here comes Rust and they decided in their infinite wisdom that we aren't going to care about dates previous to the Unix epoch and we want to go even further into the future, so we're going to have the standard library timekeeping functions use an unsigned 64 bit integer, but we're also going to hide that in an opaque struct and make you call a member function to compare two of those structs and return the difference, the second version being derived from the Unix Epoch, just to get at that internal u64. Fucking. Dumb. But now we're stuck with this shitty interface because stability.
Anyway, right now the `DateTime::now()` constructor relies on this shitty interface, which leaves a messy error situation where we now have a potentially fallible conversion from u64 back to i64, which won't ever actually occur anyway because on Unix the rust std interface uses gettimeofday from the C library anyway which returns an i64 (as I've already explained). This is shit code. I'm going to bypass this trainwreck and just get the timestamp from the OS directly. I just haven't done it yet, which is why the crate remains unpublished right now. I'm going to give three options for the `now` constructor, behind a feature flag. Option one is going to be using the libc crate. Option two will be to use a system call via my fork of the `sc` crate, and it's going to specifically be my fork because I've been adding support for other OS and architecture combinations since the only non-linux Unix that upstream seems to care about is x86_64 on FreeBSD and they haven't responded to pull requests in any way. But option two is nice because it's not pulling in the rather large `libc` crate for ONE function. Option three will be to exclude the `now` constructor altogether, because I don't like external dependencies.
Now that I've written that, I suppose there is a simpler way. I could create a binding that only includes the gettimeofday function, bypassing the libc crate. Something to ponder. Why include bindings to every part of libc when I just need that function? Well because libc is pulled in by other deps that I haven't gotten around to removing. Shit.
Anyway, just those two crate replacements reduce the dependency graph from 51 crates in a release build down to 41, and shave 12k (12,264 bytes) from the binary size. Now, 12k is a LOT of dead code. This is a lot of the reason I've been souring on Rust in the first place. The Zig compiler would happily just optimize all that dead code away, for instance, and the binary sizes after this sort of twiddling wouldn't be much different. But even ignoring the dead code, which is pretty much unreachable from the binary so not really a security issue, those extra ten dependencies I consider a huge win because the attack surface has shrunk by a fifth in one measure. That is to say, the number of external maintainers being trusted not to have screwed something up which might cause a security issue has been reduced by a fifth. It's still shit in that by including 11 total dependency entries in Cargo.toml I wind up with 41 dependencies due to transients, but it's better.

View file

@ -0,0 +1,52 @@
Meta(
title: "Electric Cars",
summary: Some("I give my take on electric cars as they exist today"),
published: None,
tags: [
"automobiles",
"sustainability",
"complexity",
],
)
---
> But on the other hand, automobiles in general are a disaster, and most people shouldn't have one.
=> gemini://the-brannons.com/ev/
In a lot of ways I agree with this sentiment, even though I love cars. In the US in particular we have created a way of life that revolves around the car. It is next to impossible to be a full citizen without car ownership. We have long ago decided against mixed use neighborhoods and rejected local first supply chains in favor of cheap crap sold in big box store chains that can only be accessed via car, on the outskirts of town, away from where everyone lives. That's one of the most insidious aspects of the corner we have painted ourselves into, but it's not the one that bothers me the most.
## I love cars. Old cars.
Owning a car is a liberating experience. For a few generations now the first car has been a right of passage, and one of the most prominent steps on the road to independence.
That said, I hate modern cars. With a passion.
My dream car is a very simple machine. An inline six cylinder engine is plenty of power and is less complex than any modern engine. One camshaft. One exhaust manifold. Usually a single barrel carburetor. Points ignition. Couple it with a three speed manual shift with overdrive, and let the top cruising speed be about 60mph. But the most efficient cruising speed is 45-50. Roll up windows, with a little vent window in the corner. Manual door locks. A simple three way switch for the windshield wipers - mounted on the dash instead of on a turn signal stalk. Cable operated heater valve and no AC.
I wouldn't mind going even more primitive with the valves in the block and a magneto ignition. Even less moving parts. Simple to understand. Simple and cheap to maintain. Can be kept on the road for decades.
This type of transportation was made for slower speeds. People drive 80-90mph on the freeway regularly today, and that makes it scary to even try to drive an older car except on the backroads. It also leads to a lot of accidents and deaths. We should all slow down a bit.
## I want to like EV's
The EV has the potential to be dramatically simpler than an internal combustion powered car. There's no transmission required because all of the torque is available at any motor speed. No driveshafts, Universal Joints or Constant Velocity Joints because we can build the motors right into the wheel hubs. Eliminating the constraints of a "conventional" driveline also frees up design options that can make better use of space and increase aerodynamics. I'm on board with all of that.
What I don't want is pretty much every other feature they're putting in today's EV's.
We're literally seeing doors without physical handles or locks.
Every one of these cars has more sensors pointing at the vehicle's occupants than at the outside world, recording everything we do or say and selling that data to not just the highest bidder but literally every bidder.
Battery packs are all specific to the manufacturer and never interchangeable.
These cars are all loaded up with backup cameras and self driving / driver assist features that likely cause more accidents than they prevent.
## There are other paradigms worth exploring
One of the biggest issues with the EV has always been limited range. This issue is closely followed by the need to have the car sit immobile in a charging station in order to refuel, perhaps for hours, before being able to continue on a longer trip. Range is improving, as is charging infrastructure. However, it's likely never going to be as convenient as a gasoline powered car.
The cost of replacing the entire battery pack in an EV is a significant fraction of the price of the car when it was new. This is another huge problem that we're not even looking at yet, but is going to be a huge problem for the working class who are not fortunate enough to be the target audience for new cars. Instead, they're going to have no lower cost options.
I want to briefly look at a completely different industry and infrastructure for a moment. That industry, and it's associated infrastructure, is propane fueled barbecue grills. Consider how one re-fuels their grill. You turn the fuel valve off, unscrew the lines and put the propane cylinder into your vehicle. You then drive to a store and exchange your empty tank for a full one. The company that services the tanks owns the tanks, not the consumer. They perform all of the maintenance on the tanks and make sure they are within safe operating specifications. They handle repairs or replacement.
I can imagine a similar system for EV's. Standard configuration battery packs, which are able to be hot swapped quickly from the vehicle. The company servicing the battery swap facility handles maintenance and replacement. Your car is worth the same amount of money whether the battery that's currently in it is new or old. It takes five minutes to drop a battery pack and lift a new one into place, rather than hours sitting in a charging station drinking gas station coffee.
You could still plug your car in at night, of course, making this style of EV perfectly suited to the short commute lifestyle that today's EV's are already suited for. But longer trips would no longer be a problem and the most expensive aspect of EV ownership could be mitigated by providing good infrastructure.
Before dismissing this idea as impractical, let me also point out that when we start seeing large numbers of older EV's out there, their aged battery packs are going to be a liability. Those things aren't going to be properly recycled by cash strapped working class folks who are barely scraping by when they buy a used car with bad batteries, or when they finally have to give up on an older car that can only go five miles between charges and decide to scrap it. Let's be realistic. The batteries are going to be dumped at the back of urban lots, thrown into ravines, left in basements, stacked behind the garage or any number of awful scenarios. Trust a guy who has been poor his entire life - that's what's going to happen. But if, instead, a large energy company is responsible for their maintenance, then when they get caught dumping them (and they likely will), then we'll at least have someone with money to sue in court...

View file

@ -0,0 +1,31 @@
Meta(
title: "Going Flat",
summary: None,
published: Some(Time(
year: 2024,
month: 6,
day: 5,
hour: 17,
minute: 10,
second: 15,
)),
tags: [
"motorcycling",
],
)
---
I took the motorcycle out for a bit longer of a trip yesterday. Mostly I ride this bike as a commuter for my 4.3 mile trip to work. On this day I was off to the barber. My barber is actually an old friend of mine who I've known since we were in 7th grade in school, which is a lot of why I make the 40 minute trip every 6 weeks or so to hang out and get a haircut and beard trim. It helps that he's also the best at what he does of course.
The ride out was uneventful, but it marked my first time taking the highway for a significant stretch and served as a sort of test run for longer trips. At 70mph this bike feels rock solid, right at home and I'm sure it (and I) could do a nice long day at this pace if needed. If anything the bike is even more eager than me to go fast, and at this speed it's just past halfway to it's full capability, a speed which I have no desire to experience any time soon. But it made for a successful test and encourages me that we'll be doing some inter-state travel in the future.
Being a beautiful, sunny day I saw no reason to go straight home from there and instead just got off on some country roads to explore. It's definitely fun to head out on some twisty's every now and then, although my own skills are still at the novice level and I don't really push the limits yet. I did take the opportunity to wind the engine out up to it's redline a couple times though, as I've done most of my riding with the engine at lower rpm's so far and haven't really experienced that part of the rev range where it's making full power. Definitely breathtaking when she gets wound up like that. All was still good up until the final stretch of country road before coming back into town, a several miles long flat and straight run at a 55mph speed limit. Out of the blue the bike went from holding that perfectly straight line and smooth ride that it's so good at to a death wobble, with the bars careening side to side and the back end fishtailing around in either direction. The back tire, it seems, had run flat. I don't know how I did it, but I managed to pull it off onto a small side road and get stopped without laying the bike down. Sure enough, the rear tire was so flat it had unseated from the bead.
Now, for my commute to and from work I normally carry a backpack, and in that backpack along with my laptop and lunch I have a small toolkit. The backpack was at home today. But my fiance was already out and about and not far from where I was stopped, having gone out in the same direction to meet her cousin for some ice cream. She happened to be on her way back when the phone rang, so I had only about a ten minute wait until she could come get me. We were able to get home and return to where the bike was at with my truck within a half hour, with a few tools and a small air compressor which had about 120psi stored in the tank. A kind passerby stopped, which was a good thing because it took all three of us to get the bike up onto the center stand (the Yamaha XS Eleven Special has a curb weight north of 600lbs). I managed to re-seat the tirer bead by filling the tire with starting fluid and lighting it, then started pumping it with air and quickly found the leak. It turned out to me a pretty massive puncture, looked to be from a large nail.
What I didn't have among my little toolkit, but have been meaning to get, is a puncture kit. So we were about to head off to grab one from a store, but about this time the guy who owned the farmstead I was broken down in front of came out and asked if we needed any assistance. He laughed when I told him we were about to go to a store and grab a puncture repair kit and said that with all the tires he has on the farm of course he's got one in the barn and that he'd be right back. Now this is why I love country folk. True to his word he returned about five minutes later with everything needed to plug a puncture hole and we struck up a conversation while fixing the tire. He was a super nice guy who it sounds like lived an extraordinarily interesting life. A retired family doctor, who had taken over a two generation family practice in a much smaller nearby town that I lived in myself for about five years after calling it quits with my first wife. My daughter played saxophone in the school band while we lived there, and he had been the on-call doctor for the football team before retirement, so we laughed about watching the local team lose ten games in a row like clockwork each season. I'll never forget his kindness and willingness to help a complete stranger. It definitely went a long way towards renewing my faith in humanity.
In short order the tire was patched, and there was just enough air left in the tank of the little compressor I brought out to get it filled. I didn't want to trust it on the way home, and besides my SO can't drive my truck due to the tired old manual transmission, so I got it loaded up into the bed and strapped down, scaring Chrystal half to death with the way I got a runnning start and rode right up the ramp like Evil Kenievel (the doctor/farmer joking that I was probably going to just jump the truck to show off for her) and strapped into the tire chock.
I tend to just go into problem solving mode at times like this and yesterday was no different. So it was only later, after we were safely home with the bike unloaded (another scary procedure involving riding backwards down the ramp) that it really hit me just how lucky I had been. That tire lost all of it's air within a matter of seconds, and I was doing a good 60mph at the time. I shoul be dead, or at the very least in a hospital. The fact that I got the bike brought to a stop, off the main road, without laying it down is very humbling. I'm not much on the concept of a higher power, but it felt like someone was looking out for me yesterday. Then to have not one, but two different strangers stop what they were doing to offer assistance, well, I'm at a loss for words about it.
I'm not letting the experience stop me from riding of course. But I'm going to just replace that tire rather than riding on the patch. And I'll always have it in the back of my mind just how badly wrong thins can potentially go, which tends to keep you more alert and careful.

View file

@ -0,0 +1,23 @@
Meta(
title: "Mental health and guns",
summary: Some("Some reflection on the second amendment and mass shootings"),
published: None,
tags: [
"guns",
"healthcare",
"lewiston",
"family",
],
)
---
My son is a sophomore at Bowdoin College in Maine. Bowdoin is a fairly small but very old liberal arts school situated in the town of Brunswick, part of the Portland metropolitan area. It's a quiet area most of the time. Quiet has taken on a completely different meaning these past two days, however.
About a half hour to the North from my son's dorm is the town of Lewiston, the site of the horrific shooting that took place this past Wednesday evening which has claimed 18 lives so far and spawned a massive manhunt, along with shelted in place orders for many of the surrounding communities. The college has cancelled classes the past two days and the students are all being cautioned to stay in their dorms as much as possible. Note that while Lewiston is around a half hours travel to the North, the shooter, Robert Card, apparently abandoned his vehicle in the town of Lisbon, which is South of the site of the shooting. As a dad, it's horrifying to think that the suspect was definitely traveling nearly straight towards my son's location the last place he was known to be. My son is smart and I trust him to play things cautious. Also, there's not much chance that Robert Card is still both alive and in the area considering the time that has passed. None of that makes me feel better right now. I doubt I'll sleep much until I know he's been found, or until my kid is safely back home with us.
## What caused this?
One thing that always happens right after a tragedy like this is that people on one side of the debate around gun control use it as an opportunity to push their cause to the front. I've wanted to punch a number of people for doing this these past couple days. It's not that I disagree with them, it's that they need to shut the fuck up until people either know their loved ones are safe or they have had a chance to grieve, for one thing. The other thing I want these particular assholes to consider is that it's not as simple as they want it to be.
### Mass shootings are not a recent thing
The first time in my life that I remember hearing about mass shootings was Columbine. Probably like a lot of other people, I've been living under the delusion for a large chunk of my life that this is a relatively recent phenomenon. A few months back I actually went looking for data that would support this in order to shut up someone who was preaching gun control. The thing is, my family have always been very much in favor of the second amendment. I went hunting with my dad and my older brother for the first time when I was 14. My grandfather ran a sportsman's supply business and helped establish a hunting and fishing resort in a rural part of Canada. Both of my brothers own multiple firearms. Even my mother owns a handgun. And while I don't own any guns, that was always due not to ethical misgivings but being broke and not very interested. No, I had no problem with private gun ownership and I've always read the second amendment as a very simple prohibition against the government curtailing weapons ownership in any form.
Imagine my surprise when my research immediately showed that mass shootings have been a problem in the US almost from day one. It's bad. If you look at the history and timeline there are some truly horrific incidents. It made me question my beliefs in a big way.

View file

@ -0,0 +1,35 @@
Meta(
title: "New Motorcycle",
summary: None,
published: Some(Time(
year: 2024,
month: 5,
day: 8,
hour: 19,
minute: 52,
second: 13,
)),
tags: [
"transportation",
"motorcycles",
],
)
---
I've written before on this log about wanting to get a motorcycle. There are a lot of reasons why, ranging from the fun aspect to the economic and environmental impact of driving a car to and from work daily. A few weeks ago I took my Basic Riders Skills course offered by the BMV and passed the examination, so as of last week I have a valid motorcycle endorsement on my driver's license.
Now, my original plan had been to buy a new bike. I was looking seriously at Royal Enfield, as the price is incredibly low for what you get. I'm also a huge fan of classic British motorcycles and the Enfield's, while made in India, trace their heritage back to Britain and have retained their classic styling. They're simple designs for the most part, which also appeals to me.
Back in October last year my fiancee's car suffered catastrophic engine failure. It did end up being covered under warranty, but due to the time it took for the shop to fit her car in we had to pay for three weeks of rentals so she could get back and forth to work. The warranty did pay for one week, but the dealership and warranty company took a combined month to diagnose the damage, decide if it was covered and get it into the shop and fixed. Much of that money happened to come out of my motorcycle fund.
I thought that I had scraped enough together to be able to still buy an Enfield. I had $1200 USD for the down payment. Then I found out about how high the dealer fees were. We're talking in the range of $1500-$2000 in destination charges, setup fees, battery maintenance fees, etc, on a $4500 bike? WTF? That put a new bike back out of range for me.
So it was that I found myself on the used market again. I was looking for a 400-750cc Honda if possible, and there were plenty of them ... at first. Every single one I tried to look at was gone before I could get to it. Seems that pretty much everyone thinks like I do and wanted a midsize bike. Now, I really didn't want a 250, because they just can't keep up on US highways. I was reluctant to go bigger, but in the end that's what I wound up doing anyway because frankly the season is already here and I'm tired of waiting.
What I found was a 1979 Yamaha XS Eleven Special. Now, the regular XS was actually a bit of a special bike to begin with, even though it's largely forgotten today. It was the largest of the Universal Japanese Motorcycle designs to date and the first production motorcycle to do a sub-12 second quarter mile on the drag strip. Basically, in the 70's, as soon as Honda released a new design Yamaha, Suzuki and Kawasaki quickly followed with nearly identical designs. The XS Eleven was Yamaha upping the ante on the pattern Honda had found so much success with in the CB750-four. A transversely mounted four cylinder engine with an upright, neutral seating position and a smooth shifting five speed gearbox. The XS added a shaft drive, which for the time was a novelty, and sported dual overhead cams with four valves per cylinder. My new bike, when new, made 95 horsepower and was the fastest thing on wheels of the day, at least in a straight line.
Now, this is significantly more bike than I started out wanting, but after taking it out for a first ride yesterday I have to say, this is going to be a fun summer. It's not as economical as I wanted, true, but it's significantly better than my truck (and handily beats your average modern SUV) in both gas mileage and emissions just by virtue of having so much less to carry around. I'll get my smaller bike eventually, when money is less of an issue, at which time this bike will be reserved for longer trips when I want to cross state lines on the highway. But for now, holy mother of god this thing is fun.
=> ../images/xs11_front_left.jpg
=> ../images/xs11_front_right.jpg
=> ../images/xs11_back.jpg
=> ../images/xs11_right.jpg

View file

@ -0,0 +1,58 @@
Meta(
title: "Reliant",
summary: None,
published: Some(Time(
year: 2024,
month: 6,
day: 15,
hour: 14,
minute: 9,
second: 17,
)),
tags: [
"StarTrek",
"python",
"programming",
"school",
],
)
---
Coming up on the end of week six of eight in my current term at school and we had to turn in an interim milestone for our final project in my Python course. The assignment was to build a text based adventure game. I thought I'd go a little above and beyond and add in some ascii art, throw in a few Easter eggs and be a nerdy old Trekkie.
```Ascii art with a rendition of the starship Reliant from "The Wrath of Khan"
________________ _ _____ _______________ ________ ___
,' ________ ___// \ \ __`-. /___ ___/\ __`-. ,' ___/\ / ,' /
| `-.__ | | / . \ | |,',-' | | | |,',-' | ,'___ | |,',-'
`-.___ `, | | / /_\ \ | _ `-, | | | _ `-, | ___/ | _ `-,
______\ \ | | / _____ \ | | `-. \_ | | | | `-. \_| `.___ | | `-. \_
/_________| /_|/_/ \_\|_\ /__/ /_\ |_\ /__/ `.____||_\ /__/
* ___---__ +
'----___' _-_ *
.-----|\-`--'---`---.______ *
+ `-`---| \._________.------' .
__.--' / `--_--' .
__________-'-------'___
\____(============/_=_/
. _____ _______ ___ _ __ __ ________
; \ __ `-. ,' ___/\ | \ / / \ \ `. \ / /__ __/
- --+- - | |,',-' | ,'___ | | | | ,' . `. | \ | | | |
! | _ `-, | ___/ | | | | | | | | | ` | | |
. | | `-. \_| `.___ | |___ | | | _ | | | `. | | |
|_\ /__/ `.____||_____\ /_\ ,'_/ \_| |_\ /_\ /_\
```
The game takes place aboard the Federation starship Reliant during the early part of the movie "The Wrath of Khan", before the arrival of the Enterprise on scene. You are a Junior grade ensign on a spacewalk inspecting hull plating when the ship is compromised. Your best friend, Mike, assigned to hydroponics, is a perpetual slacker who is always dragging you into trouble. You get a message from him on your private encrypted channel about what went down. Where's Mike and how did he survive? Well he and his girlfriend Becky were hiding out in a Jeffries tube near hydroponics smoking a joint during the takeover. So after entering the ship, you have to collect Mike and Becky, sober them up, get weapons and storm the bridge to stop Khan from getting Genesis.
This course is called 'Introduction to Scripting' and they pretty much assumed that we were coming into it with no programming experience. The fact that I'm not that green has made it both easy and hard at the same time. Easy, because I already knew a substantial portion of the material. Annoying due to the format of our online textbook (more on that later), and hard because if I'm not dilligent I get marked down for rather stupid things. My instructor wanted a lot more code comments from me on my early assignments, for instance. My perspective said, 'What part of this brain-dead code is unclear?'. We also had a number of assignments turned in that were just pseudocode. To me, Python kind of *is* pseudocode already, so I rushed a couple of those assignments and lost points on some finer details which to me were obvious and didn't actually need written down.
## Python is exactly what I always thought it was
I've always avoided Python so I've never really learned it before now. I've written a few small one-off things just to say I have, and I experimented with using PyGTK+ and PyQt to add a GUI to an existing program a while back. But for the most part I've done everything I can to just ignore Python before now.
Picking it up was easy enough after having explored a bunch of other languages more in-depth, and on the one hand I can see how quickly a program can be knocked together when you never have to type cast and the syntax seems designed for speed. I see the appeal. I just don't share in it. Python still feels to me like a toy. It's not the syntax, but the fact that it completely glosses over and abstracts away how data is actually stored in memory and accessed by the processor. I get that the whole point of the language is to make programming accessible without having to think like a computer. But I've already trained my brain to think a certain way when coding and I really can't stand giving up the control over how the memory is laid out that has so much bearing on how your code performs.
Even so, I'm glad that I've finally taken some time to learn more about the language. I even found a few syntax features that I really like and kind of wish I could bring over to other languages. I like list comprehensions for instance. I can see that particular syntactic suger being usable in other languages. Basically is just applying a closure to transform a collection. I also like the *args and **kwargs syntax for handling varargs. If you've ever used varargs in C you'll know it's rather clunky, and some languages don't even have this facility or require a macro (Rust). That's not enough to get me on board with using Python anywhere I don't have to of course, but it does illustrate that good ideas can be found everywhere.

View file

@ -0,0 +1,59 @@
Meta(
title: "Summer 2024 Semester: Sustainability",
summary: Some("Some reflections on how school is going and what\'s next"),
published: Some(Time(
year: 2024,
month: 4,
day: 24,
hour: 20,
minute: 46,
second: 19,
)),
tags: [
"sustainability",
"school",
"proprietary_software",
],
)
---
With one week left in the current term I'm definitely settling into a nice groove with my schooling. Up until now I've been taking one eight week online course at a time, with the first two courses being almost pitifully easy. About halfway through my third term I emailed my advisor and requested to enroll in two courses per term, so that's what I'll be doing in just over a week.
## First, let's finish PreCalc
So I mentioned that my first two courses were almost pitifully easy. Not so this term, as I needed to get PreCalculus out of the way as it is a prerequisite for almost every CS course that I have coming up. The thing is, not only has it been literally thrity years since my last math course, but I stopped after Geometry and didn't even take Algebra II in high school. At the time I just wasn't interested, and didn't need the credit in order to graduate. So I took the first semester of Algebra II and then withdrew for the spring. That meant that I came into this current class without all of the requisite knowledge and three decades out of practice. But I do like a challenge. I worked my ass off the first couple of weeks and I'm happy to say that I've pulled a 3.9 in this class. I definitely learned a lot.
The thing is, in addition to me being more receptive than I was at 17, the way this course was taught was just better than what I got back then. When I was first introduced to trigonometry the word was, don't worry about how this works, just memorize it and accept that it does. That's a sure way to piss me off and make me tune out. My brain needs the why. Now that I've gotten the why, I'm finding that I actually like learning and applying the material. Who knew? I'm planning on going on at least to Calculus I, and possibly going further with the math if things go well for me there.
## Next term: Intro to Scripting and Sustainability
So I have two courses next term, which starts after a one week break. The first actual CS course I get to take is "Introduction to Scripting". I've looked over the curriculum and I'm not worried. Or impressed, for that matter. Our assignments are going to be in Python and in pseudo-code. I'm annoyed that part of the curriculum is learning how to use PyCharm. I mean, fucking teach the concepts not the fucking tools. I don't want or need an IDE, and I sure as fuck don't want to be forced to use a specific one. But I'll get past it. I'll do whatever assignments they expect relating to PyCharm and probably write everything else using NeoVim just like I always do. Anyway, this class starts at such a low level that I'm pretty sure I'll be able to do it with close to zero effort.
The other class I have is "Global Perspectives in Sustainability". Oh, fun. I've read the first chapter of the text and I can tell I'm going to have some strong opinions and a LOT to say. That's good, too, because every assignment is either a discussion board post or a paper. I'm likely going to be roasting the college and the materials pretty hardcore here as well. Should be fun, and it will be a good exercise to do so in a way that doesn't make too many enemies.
## Here's the rub...
So looking at the three classes I've taken and the two upcoming courses I'm scheduled for, let me break down the things that piss me off (bearing in mind that I like my professors and I'm glad to be enrolled).
### Everything is proprietary and paywalled
Now, one could argue that since my employer is picking up the tab for my schooling, I don't have standing to complain about things being paywalled since I've got access without paying. One could argue that, but then be prepared for me to launch into a nice long talk about how unneccessary and immoral it is to treat knowledge as property. The fucking email is Exchange, too, so I can't even access it using a client. No, I have to use shitty webmail. I get a free subscription to Office365 as part of my enrollment, but of course I don't give a fuck about this "perk" because I'm using fucking Void Linux and FreeBSD and obviously that means I'm not going to download and install either the Windows or Mac versions of the shitware that I've been given "access" to. Nor would I, because I strongly disagree with the notion of software as a subscription and refuse to participate in that ecosystem, and don't even get me started on the non-free as in freedom aspects here.
### Not only is it proprietary, but each class uses a different platform
My first course, I went ahead and installed the proprietary app on my phone that was needed to access my textbook. Silly me, thinking that I was ever going to use it again after that class. No, no. Every. Single. Class. has used a different, incompatible, proprietary and shitty cloud service to access our textbooks.
What's worse is that some of these cloud ebook viewers are just BAD. They can be painfully slow to render, they enforce their own formatting which doesn't work well on the smaller screen of my travelling laptop, and in one case the CSS specifies fucking grey on white text with the world's thinnest font so I almost have to highlight it with the mouse cursor to read it. In that platform's case I am able to use Firefox and enforce my own font choice, but this will likely be the thing that makes me figure out a way to apply my own CSS as well to get readable text, and frankly I'm NOT interested in web design so this isn't a skill I care to learn and don't see myself using much in the future.
And speaking of Firefox..
### "This platform is incompatible with Firefox" - SERIOUSLY!?! WTF!?!
The platform we used in my PreCalc class to both read the material and submit assignments has big banners everywhere warning that it is incompatible with Firefox. Fucking hell. I wanted to scream. I don't even want Chromium installed on my machines. I was able to use qutebrowser when using FreeBSD, so that was OK I guess, but the only way I could get this working with Void was to install Chromium. Since I'm extra paranoid when it comes to Google anything, this wound up being the thing that made me find an actual use case for FlatPak. Not that I really expect FlatPak's sandboxing to be effective, but that just shows how much I distrust Google, because normally I view FlatPak as Hot Flaming Garbage (TM) but I was willing to use it just to try and isolate even worse Hot Flaming Garbage (TM) even a little bit from the rest of my system.
There's a short survey at the end of each class. I'll be filling it out.
### What does all of this have to do with Sustainability?
Reading the first chapter of the text for my upcoming class got me thinking about these things that I've been putting up with and how I'm having to compromise principles in order to attend college. The thing is, every one of these platforms they're using is restricting freedom and funneling more money into the hands of people who don't need it. The software itsef is a Big Steaming Pile of Javascript that I'd rather not touch with a ten foot pole, which requires fetching all of the "content" from The Cloud (read: Someone Else's Computer) every time I want to read it, when they could have just given me a fucking Epub that I could download once and read locally, saving on bandwidth and running a much more power efficient software stack than a browser tab loaded with said B.S.P. of JS. And in doing so, I wouldn't have to wait for a second for the page to render literally every time I scroll the page down, and I'd actually be able to read the text because I'd have control over the rendering. The platform used for the sustainability course let's you download a copy of the textbook, except that it doesn't. What you actually download is an html file which you can only open with a proprietary Adobe program which then fetches the book over the internet (I'm assuming it probably fetches it anew every time you open it, because why wouldn't it?). The fact that they change the file extension isn't enough to fool me, or indeed anyone who has even a passing interest in how Computers work. The only option I found where I could read the text without wanting to pound my head against a brick wall was the option to download chapters as individual PDF files and open them in Evince, with a side by side page layout.
I should also mention that my earlier writing course, and this Sustainability course, both use a platform called Turnitin for paper submission, which uses a fucking LLM to "detect" plagiarism. Ironic, at least to me, both in that their trying to detect plagiarism through the use of a tool which relies entirely on massive amounts of plagiarism in order to function, and that said tool is based on a technology that is becoming infamous for being environmentally and financially non-sustainable.
Finally, I want to address the economics of College itself along with how cozy our educational institutions are with big tech as those things relate to sustainability. I'll just give a small nod at this point to the horrific student loan crisis that we're in the middle of. Talk about not being sustainable. The thing is, there's too much to say about that subject so I'm purposely keeping my comments about it short. Part of what is feeding the crisis is the massive problem with rising costs in secondary education. Tragically, an awful lot of money seems to be getting funneled right into the accounts of the very sort of corporations that are behind some of the worst excesses in terms of inequality.
When I think of sustainability, I see a massively interlocked set of concerns - and not all of them are of the environmental sort. Let me point out that the American revolution was largely a result of the idea that we would no longer suffer a king. Then, when we actually put anti-trust legislation on the books, we referred back to it and (rightly) drew comparisons between the owners of those monopolistic monsters and the kings we would no longer suffer. Since that time, particularly in the past forty years, we've slowly eroded all of the progress that was made towards shutting down monopolies and encouraging healthy competition. For our educational institutions to be so cozy with monopolistic corporations that do literally everything they can to thwart interoperability, and for them to be using all of these absolutely horrible proprietary systems that serve no purpose but to lock you into renting the materials using their platforms, shows that they either truly do not understand the economic injustice or are actively on the wrong side of it.
Now the point I'm driving at here is that these systems are by nature of their economic injustice unsustainable. At some point the billionaires will have extracted so much wealth with these tactics that the rest of us will revolt. The best case scenario is that we do so via legislative change and actually fix our broken systems, but the worst case scenario, and the one that I fear, is that we will have a destructive civil war and tear it all down, without giving any real thought as to what we should replace it all with. That's one of the dangers that these companies have been playing with. They know that they are taking too much, and that they run the risk of pissing people off enough to spark catastrophe. I mean, they also know that they are literally raping the planet for short term goals, but that's a subject for another day. Anyway, I find it really fucking ironic that I'm about to go into class on sustainability at an institution that seems to have zero grasp on how unsustainable their own practices are.

View file

@ -0,0 +1,44 @@
Meta(
title: "Where things stand, March 2024",
summary: None,
published: Some(Time(
year: 2024,
month: 3,
day: 21,
hour: 14,
minute: 56,
second: 17,
)),
tags: [
"school",
"vehicles",
"math",
],
)
---
If you were to ask me two years ago where I thought I'd be in 2024 the answer would have been pretty far from the mark. But that's not a negative thing really. I'm happy with how life is going.
## School
I think the first thing to mention is school. I started college late last year. It's fully online and asynchonous. We do have weekly assignments, but there is no set time when you have to log in and work on them. Each course is eight weeks, so after six months I will have finished three courses and have nine credit hours. I'll start taking two courses at once pretty soon to speed the process up.
I'm going for a CS degree because it seemed the logical choice for me. It's also a degree path that my employer will pay for in it's entirety. My job mostly sucks, but this is a good benefit that I wish I had started taking advantage of sooner. But at this point I've had nothing related to my major due to having prerequesite courses that need taken first. My first two courses were almost painfully easy for me, and I was beginning to think everything would be that way. I literally got a perfect score in my composition class with very little effort on my part. I don't feel like I'm that great of a writer, but having seen the work that others were turning in I guess I have to say there was a definite contrast. I can only surmise that the standards have been set accordingly to what the average college freshman can handle. But a big part of me felt as if I didn't actually earn that A grade. I was definitely beginning to view my school as a diploma mill, and then I got to Precalc.
Now I'll preface this by saying first that I graduated high school in 1995 and the last math course I took was one semester of Algebra II during my junior year. I already had all of the math credit that I needed to graduate and was at the time wholly uninterested in pursuing it further. At the time, I was spending every waking hour playing music with my friends. Math seemed about the furthest thing from my goals in life. So I just stopped doing any of the work in that class, took a failing grade for the semester and dropped it for the next term. So upon beginning PreCalculus a few weeks ago it had been a literal 30 years since my last math course, and I never did get a lot of the material that I should have before starting this course. Oh, I wasn't completely unprepared. I've used a surprising amount of algebra over the years in various hobbies such as electronics and of course programming, and I have been doing a lot of review and studying in my spare time because I knew this would be a challenge. Even so, the first week was one of the hardest things I've ever done getting up to speed.
I surprised myself really. Our first assignment was a self assessment, which I failed miserably. So I went and looked up all of the material related to the parts that I had missed and just ground through it until things began making sense. By the end of the week when we had another quiz on new material I only missed a half a point because I got the correct answer but not the way I was supposed to. Three weeks in and I've still got my 4.0 grade. I've begun considering that I might go on past the math requirements for my degree. I'll have Calculus I next year, but if things continue going well I might want to go on to multivariable Calculus. Time will tell.
## My dad
Around the time my second term began my father was in the hospital with congestive heart failure and unable to walk more than a few steps unassisted. It's hard seeing the strongest man I've ever known in decline like that, and it was heart wrenching in the extreme confronting the fact that he might be gone very soon. My brother came up from Florida and my son, who was already taking a semester break from his own CS degree, came home from visiting my other kid in Minnisota. We all rallied and did everything we could to get my dad to do the same. He spent a week in the hospital and then twelve days in a rehabilitation center. My brother did a lot of work on dad's house while he was in rehab but had to get back home shortly after he was released. Since then I've been making weekly trips down to check on him and help where needed, bringing my son along for a lot of them. It's not easy to maintain that schedule while working full time, keeping up with coursework, planning a wedding and running our own household. It's just shy of a two hour drive one way, so I devote the better part of one of my two days off to the trip.
Things have a way of snowballing though, and sometimes in a good way. A large part of what got my dad into this mess is overeating coupled with a sedentary retired lifestyle. He was spending the majority of his time in his LaZboy watching TV, and it almost killed him. I've been wanting to get in better shape myself, and this gave me, and my fiancee, the kick in the pants to get into action. Along with cutting out sugar and overall eating healthier we've been hitting the gym twice a week. My brother followed suit, and he's been taking hours long bicycle trips several times a week. I think knowing that we're all doing this together has made it easier for Dad to keep trying, and every time I see him I can tell he has a little more energy and moves around easier. He's far from out of the woods, but if the trend continues then I have hope that he might live well into his 90's like our grandmother did.
Interestingly, I might have set off a chain reaction by going back to school. My dad had a fair amount of college credit when he was younger but never got his degree. He's talking about finishing it now, at 73, in engineering. His plan wouldn't have anything to do with returning to work, but just to have accomplished the goal. I really hope that he does because he's a brilliant man. My brother is also looking into taking classes.
## Projects
Obviously with this much going on I'm spending far less time on software projects. I haven't completely stopped of course, but the things that I'm working on are at a slower pace and there isn't enough to want to show them off.
Here's what I can say. I've continued my slow migration away from Rust towards plain C and am finding my groove there. I haven't abandoned rust entirely, especially when it comes to projects which I started long ago and wish to keep going. For instance I finished my Haggis archiver, and I've been chiping away periodically at the package manager for HitchHiker Linux. But I've also been putting a bit of work into a utility library for said Linux distro, which I intend to put to use fairly soon.
Now, HitchHiker as the codebase stands right now has a Linux kernel with a GNU toolchain, but a crazy mix of userland utilites. There are no GNU coreutils left in the system, but I've retained a few things from the Util-Linux package. The rest of the command line utilities are made up of BSD code ported to Linux, a few Suckless utils and code that I wrote myself when I was trying to teach myself C initially. My intention is to replace most of the BSD and Suckless utilities with my own code eventually. That's where the new utility library comes in. The idea is to provide a lot of the things that are taken for granted in languages like Rust such as dynamically sized arrays and hash maps, some nice abstractions over the shittier interfaces in libc, things of that nature. I'm also experimenting with a bounded string data structure inspired by Rust's 'String' and a slice type, in order to hopefully provide a much nicer and more consistent string interface than what you get in libc. Right now that's just an experiment, but it feels interesting.
Since I already have a C implementation of Haggis, there is a possibility that the package manager for HitchHiker might be written in C as well. I have some Rust in the base system now, but I've already seen cases where portability will break out of the blue. HitchHiker is supposed to be able to cross compile from any supported architecture to any other supported architecture. In the long run I want to be able to cross compile it from any Unix machine. If my Rust code cross compiles to RiscV64 one day and then that same cross compilation stops working in a later Rust compiler then I have a major problem with that. So in the long run C might still be the better fit for what I want to achieve. That might also mean rewriting things like 'su' and my sudo replacement 'jah' to get rid of the Rust that I've been experimenting with including in HitchHiker, but both of those programs are quite small and should be easy to re-implment.

View file

@ -0,0 +1,16 @@
Meta(
title: "Yak Shaving",
summary: None,
published: None,
tags: [
"software",
"programming",
"rust",
],
)
---
It's funny the little tangents I'll go on sometimes when I'm working on a project. I have a bad NIH complex at times which is getting worse in relation to Rust. Often this is spurred on because I actually care about binary sizes and dependency graphs, so I will gladly reinvent a few wheels in order to trim out some bloat in both of those regards.
I've gotten my little archiver, Haggis, working pretty well now. At least the Rust implementation is working and pretty well tested. I have a tested C library called SeaHag which is fairly complete, just in need of a binary to complete the proof of concept. I also have a Zig implementation which is nearly as complete as the C one, which is to say I've spent way too much time farting around. But I did actually begin working a bit more towards building my package manager for HitchHiker, which was after all the goal here. Then I went down another rabbit hole.
I wanted some really flexible versioning for my package manager. You can *mostly* count on open source projects to use SemVer, but there are jackasses like Mozilla who like to just give you a single number as the version, and there's even a few shops that like to give you a four number version of SemVer. Then there's the need account for pre-releases, and properly order them. I went so far as to enable using a Git revision as a pre-release, and that's when the rabbit hole opened up again.

View file

@ -0,0 +1,28 @@
Meta(
title: "Zond updates 02-2024",
summary: Some("Some updates and fixes for my Gemini ssg, Zond"),
published: Some(Time(
year: 2024,
month: 2,
day: 20,
hour: 14,
minute: 51,
second: 47,
)),
tags: [
"programming",
"rust",
"zond",
],
)
---
Zond is my SSG for Gemini, and is used to build this capsule. It's been reliable for me for a few years now, but there are always some tweaks to be made. I'll be doing a new release in the not so distant future. There won't be a lot of changes, but some of them are nice little fixes to various small papercuts that have been there for a while.
Zond is written in Rust, and it leverages some Cargo magic to optionally build a `bootstrap` binary while it's building the main binary. This `bootstrap` will install the program, compile shell completions, translations and Unix man pages and install all of that into a prefix of your choosing, making packaging a breeze. However, there were some incorrect semantics in my Cargo.toml file which led to certain dependencies which are only used by the bootstrap binary always being compiled, even when you had this feature disabled. It didn't affect the size of the final binary but it did slow down compile times. This is fixed, and I took the opportunity to bring all of the other deps up to date as well.
Another small fix makes sure that there is a line break at the end of tinylog posts, which in turn makes sure that they have a blank line between them. This one was definitely annoying and it's now fixed.
One more little fix will go in before I do a release. When doing a tinylog draft, Zond creates a temporary file in /tmp with a random string. The random string is currently generated with the `tinyrand` crate. This crate is much smaller than the `rand` crate and has fewer dependencies, but I've created the `osrand` crate which gets it's entropy from the OS and has no dependencies at all. It might not be as fast, but for such light usage you will never notice the difference and it's going to cut down the dependency graph nicely.
## Future plans
My own capsule is built using Zond wrapped with a Makefile which calls Zond to build the site, uploads it using rsync and commits the changes using Git. Eventually I want to do away with the Makefile entirely, which means Zond will have to speak both SSH and Git. Both are possible - I just haven't done the work yet.

Binary file not shown.

After

Width:  |  Height:  |  Size: 432 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 481 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 470 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 425 KiB

View file

@ -4,10 +4,10 @@ Meta(
published: Some(Time(
year: 2024,
month: 2,
day: 20,
hour: 14,
minute: 1,
second: 51,
day: 22,
hour: 15,
minute: 16,
second: 36,
)),
tags: [
"tinylog",
@ -18,6 +18,14 @@ Some shorter thoughts and updates that might not warrant a full gemlog entry. I'
=> .. Home
## 2024-02-22 15:16 UTC
Test post using `osrand` in place of `tinyrand`
## 2024-02-22 15:13 UTC
Preliminary results after swapping my `osrand` crate for `tinyrand` in Zond.
* Dependencies are down from 80 crates to 76
* Binary size is down by 4k
## 2024-02-20 14:01 UTC
My project for the writing class is due this weekend. Which means I'm coming to the end of this term and will be into the new on fairly soon. Pre-calculus is next, which means I will actually be starting my CS courses after that. Really looking forward to that.