Ne v kontakte Asocial programmer's blog

Learning Elvish (but not the Middle-earth one)

There is some part of me that is drawn to obscure, odd technologies and tools. It’s kind of irrational, but also very exciting to tinker with. As I was looking for alternatives to my zsh setup, I couldn’t help but look at some of the more niche shells, even if it wasn’t very likely that I’ll settle on them.

Elvish was one of the options that caught my attention with its friendly website, not too stuffy documentation and being written in Go. It’s a non-POSIX shell, which offers some unusual TUI features and a scripting language with some very interesting ideas.

This post is my subjective impressions of it, which you are welcome to consume with some salt to taste. Shell usage tends to be a very personal thing, so take my opinions as a prompt for your own exploration, rather than a final verdict.

Custom transient prompt in Fish

Friendly Interactive Shell (more commonly known as Fish) is a popular alternative to the more ubiquitous shells like Bash and Zsh.

If you’ve been a command line aficionado, you have probably seen fancy command line prompts that conveniently show you everything you need to know from current working directory, to VCS status, to outside temperature. Maybe you are enjoying one right now!

This is what my prompt looks like, which, arguably, is on the lighter weight side:

zsh_prompt.png
Zsh prompt based on the Bira theme from Oh-my-zsh.

The additional information is very handy, but it also clutters the terminal scrollback. More than than, at work I often need to copy and paste my terminal logs to keep record of the actions I took for one task or another. Editing the fluff from my prompt gets annoying fast.

Transient prompt is a feature offered by some shells where your command prompt is normally rendered in all its helpful glory, but is collapsed into a more minimalistic representation of itself once you execute the command. I think it was brought to mainstream by Powerlevel10k, but these days it’s offered by many other tools and shells.

Bringing in an extra dependency just for that didn’t sit right with me, and I decided to implement it myself.

If you just want to make your own transient prompt and aren't interested in under the hood dealings, grab zzhaolei/transient.fish. What follows is a simplified and less versatile version of that plugin, but it's easier for understanding.

Self-hosting Minecraft at home

Feature image

Last year I spent more hours playing Minecraft than I care to admit. Being an introvert that I am, I play on a small private server with my partner and a few friends, and Minecraft Realms has been a great hosting for us, fast, cheap, secure, with backups. The only issue — it can’t have mods, and eventually we wanted to play with mods. After shopping around for hosting services and trying a couple of them we came away mildly disappointed: they were either very slow, or very expensive. I decided that I will simply move the server to my former gaming laptop, which has been sitting idle for the last year or so. It had plenty of power and, most importantly, RAM, while being fairly energy-efficient. The cost of electricity running it 24/7 was a couple of times smaller than a comparable hosting.

Can I put my blog into blockchain?

Feature image

My twitter feed be like:

Blockchain! NFTs! Distributed governance! Get rich quick!

We all know NFTs with URLs to someone’s HTTP server are silly1. True cryptopunks store everything in blockchain directly! So how much would it cost me if I immortalized this blog in the Ethereum blockchain? Think about it! All my typos and rants immutable and preserved forever, that’d be cool!

Disclaimer: I have no idea what I’m talking about. I never actually used Ethereum for anything, and all I know about it I’ve learned in a couple of hours of random googling.

Wild gremlin engineering

… or how to sell Chaos Engineering to your team when everything is already on fire.

This post is once again inspired by a discussion in DevZen podcast, episode #309 (for russian speakers, I highly recommend listening this one, lots of 🔥 discussions) and the Chaos Engineering book.

In the podcast, @sum3rman brought up an excellent point that most teams don’t reach a stage when their product is “too stable” and they need to introduce faults deliberately. Many more teams are actually in a semi-permanent dumpster fire state and claiming that breaking it even further will somehow help is gonna be a though sell.

on_fire.jpg
Your teammates when you wanna let chaos monkeys in.

Every hackable connector on ASUS Eee PC 901

Feature image

Recently I found my old Eee PC 901 at the bottom of a drawer sitting and collecting dust. It served me well a decade ago and I still have fond memories of it, but by modern standard it’s really obsolete as a laptop. With Intel Atom N270 and 2GB DDR2 RAM at its heart, I’m not sure it’ll win over even Raspberry Pi 4. Yet it is in a good working condition, and I couldn’t bring myself to discard it into the trash bin.

At a peak of its popularity Eee PC family was very popular in the hacking/modding community, so I went on to see if there’s something cool I can do with it. I’ve never really messed with hardware before, so even if it doesn’t work out, I’ll learn something useful from it.

In this post I’ll document interfaces that exist on Eee PC 901 motherboard and present interest for modding. Kudos to the Eee PC community who reverse engineered all of this, I’ll try to cite original sources to the best of my ability, but internet archeology is hard, so apologies if I misidentify any.

Ultimately, the most useful sources were the ASUS original motherboard schematics and component layout, which you can find with a little bit of googling. I also relied heavily on postinga at eeeuser.com (down and gone, but mostly available through web archive), eee-pc.ru (which is also frequently down) and jkkmobile.com. Some specifics about supported protocol versions were found in Intel Atom N270 datasheet and Intel ICH7-M datasheet (south bridge). I also found helpful notes at ivc.no 1, 2, although they focus on Eee PC 701.

WTF is SRE? The job nobody understands.

Feature image

Trigger warning: If you have strong opinions about Ops, DevOps, SRE and adjacent subjects, read this at your own risk.

A bit over 4 years ago I’ve accepted a job offer with the “Site Reliability Engineer” title, and at the time I had no clue what it really was about. The recruiter said it was kinda like a normal Software Engineer, but more about infrastructure, and that was all. Since then people wrote countless posts, gave dozens of talks, literally published whole books about this job, and yet the industry in general has no clue what the fuck SRE means. Okay, maybe SRE still new 1, but DevOps has been popular for a decade and people still get it wrong 🤷

So let’s set the record straight, shall we?

First of all, every modern organization needs IT Operations (Ops for short) these days. Computer systems are complicated enough to require a specialized professional to run and maintain them. This role’s purpose is to take existing components (software and hardware) and make them work together to solve business’s problem. Even though Ops usually isn’t about creating new components, this is really a jack-of-all-trades role and they can do anything IT.

Depending on the scale of the organization, Ops can branch out into more specialized roles such as Hardware Ops, Network Engineers, System Administrators, be that in-house or outsourced. Contrary to the popular opinion, coding skills often play a big role in these jobs, for example in integrating different systems, task automation, etc. And yeah, all those folks are “real engineers”, oftentimes more real than “software engineers”, but I digress.

Facets of simplicity

Feature image

Simplicity is complicated. In the Golang community, this statement is most often attributed to Rob Pike but it turns out a lot of people said something like that. A couple of weeks ago I encountered this yet again in a debate with a colleague (someone with lots of experience and whose opinion I respect a lot). Both of us considered ourselves advocates for simplicity, yet we were leaning towards radically different technical approaches. Both, of course, were sure that our own solution is much simpler than the other, and even had a good set of technical arguments to support that.

Without going into too many details, we needed a bunch of small business logic snippets executed ever so often against a certain dataset. The whole thing was supposed to be pretty small and simple (no high-load, out of the critical path, latency insensitive, etc.), so the main concern was to minimize maintenance and debugging effort. In this particular case, the language was Go, but frankly, this can be applied to any language.

FSEconomy noob: most profitable assignments?

Feature image

Not so long ago I’ve discovered FSEconomy, an economy meta-gate for flightsim fans. Despite of somewhat simplistic core mechanics and unfancy look, it has a very active community and a lot of depth to it. I’ve spent last couple of weeks reading the manual, watching community forums and doing some assignments in the game itself. And the more I was learning the more questions I was having: where to fly? Which aircraft? Rent, buy or lease? What about FBOs? How to find the best assignments? The manual and community forums have some advices, but I want more definite answers.

I mean, staying net positive is not so difficult, but being efficient is a whole another story. And I want to be as efficient as I can. Luckily, FSE offers a treasure trove of data to support decision-making in a form of data feeds. So I armed myself with Python and spend a few evenings getting some answers.

Since I’m still quite a noob in this game, my high-level plan is this:

  1. Find the most efficient way to build up initial capital without owning any assets.
  2. Find out which assets (FBOs or aircraft, which ones) would provide the most significant cost reduction.
  3. Invest and explore less involved methods of gaining revenue: rent/lease business, FBOs and all other fun.

Comment branching in C++

Feature image

Recently I’ve stumbled upon a code snippet in my C++ code, which I’d call “comment branching”. For example, you are experimenting with two implementations of the same functionality represented by a relatively small pieces of code and you need to switch between them back and forth until you decide which one will end up in final version.

Consider following snippet:

1
2
3
4
5
6
long number = 1024;
//*
std::string number_str = std::to_string(number);
/*/
std::string number_str = boost::lexical_cast<std::string>(number);
/**/

If you simply remove first slash from the second line, it turns into this:

1
2
3
4
5
6
long number = 1024;
/*
std::string number_str = std::to_string(number);
/*/
std::string number_str = boost::lexical_cast<std::string>(number);
/**/

Your first implementation became switched off, while code remained completely valid.

It’s pretty obvious, what’s going on there. //* is “commented-out” beginning of multi-line comment which becomes uncommented in second case. If might be considered as a kind in if equivalent. /*/ is a universal token which either starts or ends multi-line comment, depending on preceding context, something like else. Finally, /**/ works as endif token, which terminates comment is case was opened before, or does nothing otherwise. It might also be //*/, but visually I like /**/ more.

Be warned!

This technique has some disadvantages, which must be taken into account:

  • It’s a very obscure way of code management for anyone except you and even for you few months later. Don’t commit this ever, it’s just a time-saver during playing with code.
  • If code block a large, it’s hard to find these boundaries visually, especially taking into account that they most likely won’t be indented.
  • It doesn’t work at all if code between this special comments contains multi-line comments.