Adventures in manipulating Graphviz SVG outputs.| Tamir Bahar
A few days ago I created CFGBot - a small Bluesky bot that publishes hourly control-flow-graphs. While technically simple, this bot is something I wanted to create for a few years now. Originally, I wanted to write one that publishes IDA Pro graphs of random functions in system binaries. But due to logistical issues (how to run a bot that uses software I’m only allowed to run on my own PC) and my concerns about copyright (can I freely post the disassembly of copyrighted software?| Posts on Tamir Bahar
Python has what is probably the most elegant way of sorting a collection of objects by their attribute values: 1 sorted(people, key=attrgetter("age", "name")) Let’s break it down. sorted() We start with the sorted() function. It returns a new sorted list from the items in its first argument. 1 2 >>> sorted([3, 1, 2]) [1, 2, 3] sorted() also takes an optional key function. key, when provided, is used to extract a comparison key from the items being sorted.| Tamir Bahar
Overview of the visualization used in function-graph-overview| Tamir Bahar
Some thoughts about the issues with version numbers, supporting multiple versions, and the usefullness of Patch Levels.| Tamir Bahar
A writeup of my 2021 talk Implementing C++ Semantics in Python| Tamir Bahar
C++17 has granted us with std::variant. Simply put, it is a type-safe union. To access the value it stores, you can either request a specific type (using std::get or something similar) or “visit” the variant, automatically handling only the data-type that is actually there. Visiting is done using std::visit, and is fairly straight forward. Compilation, Execution 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 #include #include #include using var_t = std::variant; // (...| Tamir Bahar
An overview of different resource management models| Tamir Bahar
Go's new proposed range over func grammar allows for Python-style context-managers.| Tamir Bahar
The benefits of binary-reverse-engineering tooling. Migrated from Twitter thread.| Tamir Bahar
Sets of floats are weird, especially when NaNs are involved.| Tamir Bahar
Extending mdformat to not destroy wikilinks.| Tamir Bahar
Python tools & libraries that I use and would recommend| Tamir Bahar
All whitespace is significant. It might not always matter to your computer, or compiler, or piece of code. But to you, a human reading the code, it is significant. I often here people complaining about significant whitespace. They say it makes no sense, that it makes working with the code harder. That whitespace, specifically in code, should not be significant. But the unavoidable truth is that whitespace is always significant, regardless of the language you use.| Tamir Bahar
More lessons learned memory-optimizing Python code.| Tamir Bahar
Last week I had to fix a memory leak in a Python program for the first time. A long running process started eating too much RAM (only ~20GB to much) and the friendly OOM Killer had to step in and terminate this. Since this kept happening, I had to go ahead and fix the issue. Step 1 - Reproduction As with every bug, before you can reliably fix it, you must reproduce it.| Tamir Bahar
This post is brought to you in the spirit of converting tweetstorms to blogposts. to the tweetstorm Surprise! 🎁 In Python, if property access raises AttributeError, and the class implemented getattr, it will get called with the property name. This results in some very cryptic errors. If you run the following code (repl): 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 class Thing: name = "Thing" class NameProvider: def __init__(self, na...| Tamir Bahar
Where we steal good concepts from other languages to create questionable Python code| Tamir Bahar
Internationalization is a difficult problem is software-engineering. Usually that statement would refer to the technical aspects of providing a good user experience for your customers. Today, however, I am referring to the social aspects. Just as it has become common-place to have your users spread across the globe, so it has with developers. It is not uncommon to work with teams in another country, or even to have a specific team-member working from a remote location.| Tamir Bahar
Minor brain-dump of experiences from teaching programmers from complete scratch.| Tamir Bahar
First, an apology. The first part of this post was published on May 26. It is now September. I had most of the code for this part done by then. But finalizing the code took some more effort. Once that was done, explaining took a while. There were quite a few things I had to learn myself first. So now, months later, I present this humble offering to the Gods of C++ and template meta-programming.| Tamir Bahar
It turns out that C++'s type-system does not allow for recursive types. This is annoying. There is no reason why a function should not be able to return itself.| Tamir Bahar
TL;DR Windows’ shell sucks so people write tools. Tools are fun to use. Linux’s shell is amazing so people write terrible bash scripts and makefiles. Be sensible. Use Python. Use C. The rest of the post is me ranting, letting off some steam. Have fun, and don’t take it too seriously. 🐢 A Story of Shells 🐢 1 2 3 my_var=$(application arg0 arg1) for /f %%i in ('application arg0 arg1') do set my_var=%%i 🪟 Windows 🪟 I’ve been a Windows user for a very long time.| Tamir Bahar