Programming Leftovers
-
Scripting with Scala
Scala is a compiled language, your average project has quite a complicated build setup, but we have 2 tools that makes scripting possible and quite pleasant:
Ammonite;
Scala CLI, which is newer, does more, and can embed Ammonite;
-
It pays to be Circomspect
At the time, the Tornado.cash team saved its users’ funds by exploiting the vulnerability to drain the funds from the mixer before the issue was discovered by someone else. Then they patched the ZKPs and migrated all user funds to a new version of the contract. Considering the severity of the underlying vulnerability, it is almost ironic that the fix consisted of just two characters.
-
Building Software Together as a Type of Translation
This metaphor for building software as a form of translation really strikes a cord with me. It feels relevant to the world of design and front-end engineering — an idea I want to explore a bit more in this post.
-
The C free() API gives libraries and functions useful freedom
The third use is what some people proposed as the solution to how malloc() and free() affect C APIs in the case of gethostbyname(). Although a 'struct hostent' contains pointers to various other things, you can pack all of those things together into a single memory allocation that has the 'struct hostent' at the start (effectively you allocate a little arena and then manually manage it). Because this is a single memory allocation, you can return a single pointer to it and the caller can still free everything with a single call to free(). I'm not convinced that this is a good API, but it's certainly one that free()'s API makes possible.
-
C's malloc() and free() APIs are reasonable APIs for C
I've written about how the free() API means that C memory allocation needs to save some metadata, and before that about the effects of malloc() and free() on C APIs. However, despite these issues I think that C's malloc() and free() APIs are reasonable ones for C to have, and probably that they've helped C remain relevant over the years.
To start with, both malloc() and free() have what I could call a minimal API, where they take only the arguments that are really needed; in the case of both, this is one argument each. You can't allocate memory without saying how much in some way, and you can't free memory without saying what to free, so it's hard to get a smaller API without some form of automatic handling of memory (including Rust's automatic lifetime management). Having memory allocation as an explicit API has also meant that you can readily write C code that doesn't allocate memory (except on the stack), or use entirely different allocation functions that you built yourself. Both OS kernels and embedded code tend to use something completely different from malloc() and free().
-
[Older/repost] Migrating my Jekyll website to Codeberg Pages
I've been really busy these days and haven't made any posts. Despite having plenty of drafts for the blog, I couldn't find time to sit down and write.
Fortunately, unlike any algorithm-based platform, this blog allows me to write at my own pace and as I wish. After all, there's no financial support or, with all respect, any kind of obligations to readers. The dynamics of this blog is quite simple: I write what I want and like, while people who are interested in what I have to say, read it, and when they want, they interact with me by email or on fediverse. And this has been working very well.
Okay, back to the point that I've been 26 days without posting. I believe that one of the reasons that makes me post less - besides the time factor - it's my publishing workflow. This blog is powered by Jekyll, where I write everything in a .md file, then I push the modifications to my git repository. If I want to add some picture, this process becomes even annoying, as I convert the image to lightweight and web-friendly format, strip the metadata, and upload it to my s3 storage.
-
When to use Bazel? - Earthly Blog
Here at Earthly, we care a lot about builds and talk to many people about their struggles with builds and CI. A frequent topic of conversation, especially if an organization has a monorepo and more than 500 developers, is Bazel, Google’s open-sourced monorepo build system.
I’ve never worked at Google or anywhere using Bazel to drive their builds, and so while I can walk through a Bazel tutorial, I felt like I was missing the sense of what using Bazel was like, both the day-to-day and migrating to Bazel. So I interviewed 6 Bazel experts and asked them what they like about Bazel, when they would use it, and what to expect or consider before doing a Bazel migration.
-
- Top End Devs
Adam Gordon Bell is back on the show again! Today he shares his views on language tooling, new articles he has recently written, documentation for Ruby, software consulting, and insights into other programming topics.
-
Escaping strings faster with AVX-512
When programming, we often have to ‘escape’ strings. A standard way to do it is to insert the backslash character (\) before some characters such as the double quote. For example, the string
-
Recursive-length Prefix (RLP)/Simple Serialize (SSZ)
There are two serialization methods designed for Ethereum – Recursive-length prefix (RLP) and the newer Simple Serialize (SSZ). The problem they are trying to solve, a short overview of the format, and some other thoughts.
The problem: data needs to be encoded/decoded over the wire, but also for hash verification (a transaction is signed by signing the RLP hash of the transaction data, blocks are identified by the RLP hash of their header). Additionally, for some cases, there should be support for efficient encoding of the merkle tree data structure.
-
TensorFlow vs. PyTorch
If you take a look at some of the popular machine learning models written in the last few years (YOLOv5, Stable Diffusion), they've been written in PyTorch, not TensorFlow.
I remember when TensorFlow was released in 2015. Kubernetes was released around the same time (part of Google's reasoning for open-sourcing both was to not make the same mistakes they did with Hadoop/Map Reduce – see Diseconomies of Scale at Google). It was a time when many of the deep learning models (Inception, ResNet, other CNNs, and DNNs) were built with TensorFlow, and the industry rallied around the framework. Facebook released PyTorch a year later.
-
Poor mans mind mapping tool with just the terminal
Now, this of course has no where near the functionality build into the h-m-m tool by Nader K. Rad, but sometimes you just want a really basic and simple solution.
-
Reload Zsh Configuration
I’ve been using Zsh on-and-off for a very long time (15+ years), but I still occasionally learn something new about it. Yesterday I was setting up oh-my-zsh on a new computer and I’ve noticed they had added a command for reloading the Zsh configuration: [...]
-
Oh My Zsh: Fun with Take
Basically, depending on its argument take does one of 3 things: [...]