August 14, 2023
re: Coding
This Post is part of the Blog Chain: Write An App (2023) Blog-Chain.
Ownership in Rust - Chapter 4 of the Rust Library Book
I'm moved beyond much of the review of the first few chapters, and Chapter 4 of the Rust Library Book actually gets in to some of the idiosyncrasies of the language. Particularly with "Ownership" in Rust.
I found the review of the computer's memory Stack and Heap helpful, as I hadn't spent much time on those concepts before.
The idea of Ownership and memory management seems straightforward, but there are some counter-intuitive 'gotchas' that must be considered between references and copies/clones of variables. Also odd is that references can be mutable. Okay, not odd, but I haven't run into a situation yet where I needed a mutable reference. I'm sure with more experience, I'll run in to situations where a mutable reference is necessary or at least preferred.
This chapter also strangely appended a section on slicers, which while are a neat convenience syntax, seems out of place in this chapter.
re: Linux, Raspberry Pi, Jellyfin, Tailwind, "Um" Files, Etc.
This week in learning more about Linux on the Raspberry Pi, Jellyfin, etc:
Re-installing Raspberry Pi's OS and Jellyfin
As I was considering how I would store media (mp3 and flac files mostly) on my Raspberry Pi, I noticed that the micro-sd card had approximately six different partitions and the free disk space was scattered amongst them. I also found out that the lastest version of Raspberry Pi's official OS was only available if I directly loaded its image on the SD card instead of any software upgrade.
So I decided to wipe the memory card clean, install the minimal Ubuntu Raspian OS image, and set up my environment again - including Nushell, which fortunately has a binary for the appropriate architecture.
After doing all this, mounting the external usb disk drive wasn't automatic anymore, so I spent a fair amount of time learning how to do that, how to expose it to the local network, and the pains and challenges of permission sets on exfat4 between Windows and Linux systems.
I didn't end up fixing the permission system for the external hard drive, so instead I disconnected it, hooked it up to my laptop, and am fixing the meta data on my files more directly instead of over the network.
OR SO I THOUGHT
Because the external drive is a back-up of my Google Drive, it shares the same volume name as the symbolic link when Google Drive is running on my Windows laptop.
So as I've been updating the metadata on my mp3s (using mp3tag, the updates were taking exceptionally long and I just assumed the external HD was slow. Later, I realized I'd been updating the files directly in Google Drive, meaning that each file had to be downloaded, modified, and uploaded again. What a colossal waste of bandwidth. And my ISP let me know, too! It is barely a week into my billing cycle and I've used > 75% of my allotted bandwidth.
I set up Tailscale VPN
Because I want to be able to access my music server and ssh into the Raspberry PI while away from home, I had been looking into solutions to expose the Raspberry Pi to the internet securely. A reverse-proxy seemed doable with Nginx or Apache, but it seemed cumbersome and like too much yak-shaving for the time being.
Tailscale was recommended to me by folks on Mastodon for secure VPN which took less than 5 minutes to sign up, install on two devices, and verify successful access from off-network.
This seems like a viable solution for the time being and covers 95% of my current use cases.
Someone mentioned Yunohost as well, which seems turn-key self-hosting solution, but that is an experiment I'll have to run another day. I also should get another Raspberry Pi to run these experiments on.
"Um" or "Cheat" Files
Throughout all this, I ended up looking into a lot of different Linux CLI utilities to solve various problems and found myself having to re-look-up commands periodically and got tired of switching contexts. So I made a /notes/
folder in my $HOME directory with a couple markdown files for CLI commands, CLI tools I use, and system info I need to periodically look up. Then it was easy to simply cat cli.md
to get a refresher on what needed. Later, I came across Glow which does discovery of your notes and formats it nicely in the CLI which is nice.
As you can see, I also added rClone and Samba to my system for Google Drive syncing and network sharing, respectively.
I added the Micro text editor to the Linux CLI
I added the Micro text editor for the CLI because Nano is just... 🤮.
I wanted to add the Helix text editor not just because the features, functionality, and aesthetics seem great, but I wanted to support a Rust-based project. Unfortunately, there isn't a package for my Linux distro and I was unable to successfully cross-compile the source code. The compiler error failed at the tree-sitter grammar. I found some guides (like this one and this stackoverflow answer.) that offer some clues about what I need to do, but those will have to wait for another time.
I don't think I'll be held back by using Micro, but it would have been nice to use tools built on Rust. Micro also gave me a few problems so solve. Namely, that it didn't show up in the select-editor
list, so had to do a work-around after changing the symbolic link to the executable.
Linux for Puzzle Solvers
There is a significant satisfaction with solving for myself the myriad of problems faced with working toward a goal where the interfaces the resources I need are all in the same room and not particularly dependent on considerations of the perceptions and personalities of other people - the part of real life jobs that sap energy and will from most people. With this project - its just me and the terminal most of the time.
It also gets a little addicting: although the yak-shaving in Linux gets monotonous at times (after all, a lot of these problems aren't problems at all on Windows or Mac operating systems), the little hits of dopamine you get from solving a puzzle keeps me thinking about the next layer of yak-hair I get to shave.