Programming Leftovers
-
3 ways to embed a commit hash in Go programs | Red Hat Developer
Whether you are using Go to write a simple console-based utility or a fancy web application, it is always helpful to reference the previous version of your software. This information is essential, especially for developers. They need to know what the source code looked like in previous versions, so they can debug any issues introduced at specific points in time.
To do that, you need a system that can control and manage different versions of the source code, such as git. Whenever you want to capture a snapshot of the program's current codebase, you run a git commit command that saves the code at that point in time. To make sure you do not overwrite a previously saved record, git creates (by default) a unique identifier, hashed with the SHA-1 algorithm, for every commit.
Usually, when a decent amount of progress has been made, a couple of features have been implemented and lots of bugs have been fixed, it's about time to make things official and announce a new release version of your software. Of course, embedding the release version is not new. You most likely already have automation in place to provide this information within your software (e.g., during the release pipeline). But this kind of progress doesn't happen in a day. So what happens in the meantime? You do what the rolling-release model does, associating every build (go build) with a snapshot of the code at that point in time. This is when the git commit hash comes in handy. There are three ways to embed this hash into your Go program.
-
RC Week 8: Life happens, and databases are hard
In that vein, I spent the last two weeks mostly focused on figuring out how to build an inverted index over all the unique positions in a collection of chess games I have. To make it concrete, this is 3.8 million games and about 240 million unique positions (north of 300 million before dedup). I ran in circles, and I think it was a combination of: [...]
-
Writing a SQL database, take two: Zig and RocksDB
As a second non-trivial post while learning Zig, I decided to port an old, minimal SQL database project from Go to Zig.
In this post, in ~1700 lines of code (yes, I'm sorry it's bigger than my usual), we'll create a basic embedded SQL database in Zig on top of RocksDB. Other than the RocksDB layer it will not use third-party libraries.
-
FOSS Activites in October 2022 · utkarsh2102
Here’s my (thirty-seventh) monthly but brief update about the activities I’ve done in the F/L/OSS world.
-
GoReleaser Split and Merge
Since v1.12.0-pro, GoReleaser can split and merge its release process.
This means that you can run the builds for each platform in its own machine, and then merge the results and publish later.
This can be useful if you need CGO, or if your build process takes too long.
-
Daily Buggle (2) | [bobulate]
Not even all-that-long-ago I ported about playing around with Rust to build a little bot that gets my FreeBSD bug counts (currently me:0/cmake:9/desktop:24/kde:34, thanks for asking) and posts it to a social thing I no longer participate in. So it’s time to re-jig the bot, switching to Mastodon posting (my profile, thanks for asking) and re-implement it in a different language. I’m vaguely inclined to try some more Haskell, or Zig, or Dart. Very different kinds of language, but that’s kind of the point.
-
The “idiotism” of software developers | Mardy
Before you get angry at me for this title, please let me state that I count myself in the number of the “idiots” and, secondly, that what I mean by “idiotism” here is not to be intended as an offence, but as some traits of mindset which are typical of very logical brains.
Some months ago I finished reading Dostoevskiy's “The Idiot”, a book about an exceedingly good-hearted man, prince Lev Mishkin, whose behaviour was puzzling the people around him so much that they thought of him as an idiot. Sure, the fact that he was suffering from epilepsy didn't help, but it was far from being the primary reason for their thinking, since his epileptic seizures were very rare (if I remember correctly, only two occurred during the time of the story) and everybody's opinion had already formed well ahead of witnessing him in such a state.
He was an idiot because he was open, trustful, and especially because he could not “read between the lines” of what was been said to him: his social conduct was straight, and although he was following at his best the customs that he had been taught, he was supposedly awkward and unable to perceive and parse all the messages that are implicitly conveyed by social behaviours and human interactions. I added the word “supposedly” because, as a matter of fact, his behaviours were all perfectly normal for me: I only noticed their awkwardness when it was pointed out by the other characters, at which point I couldn't help smiling and acknowledging that, indeed, that thing he did was weird.
-
What are Double Parentheses in Bash
-
Floating Point Math in Bash
-
Bash Continue Built-In Statement