Posts

Showing posts with the label programming

Signal boost: Voronoi diagrams with SciPy

Image
[Link] Voronoi diagrams with SciPy  I was a bit confused by SciPy's documentation for its Voronoi class and wondering how I could easily draw the "infinite" regions from the output. After getting a somewhat verbose answer from ChatGPT, I decided to Google the question and found Voronoi diagrams with SciPy , by Martin McBride , which solved my problem. The solution is not different in spirit to ChatGPT's but it's simpler in my mind, so I went with it. The idea is to add the points of a very far off bounding box, then simply ignore regions with -1 vertices.

A neat approach for sortable versioned filenames

A neat approach for sortable versioned filenames tl;dr Add a letter to indicate number of digits: a0, a1 to a9, b10 to b99, c100 to c999, etc. Important disclaimer: I didn't come up with this scheme. I read it in a twitter X thread some time ago and have been using it ever since. I'm sure I bookmarked it, but I lost access to my account 1 So, basically, I know you hate when you're dealing with files and start with important_work.xlsx and then realize that you better version this thing, so you F12 it and add a suffix indicating the version: important_work.xlsx important_work_v2.xlsx That works, so back again to doing your job. Then, after a few back and forth with peers/boss/clients you find yourself with over 10 versions: important_work.xlsx ...

Can Rust teach me computers?

     One of the books on my reading list is Bryant and O'Hallaron's Computer Systems: A Programmer's Perspective . As the name implies, it teaches you how computers work. The book uses C since it's a low-level language that "exposes" the machine and it appeals to me because I've been eager to learn both systems-level programming and computer hardware, and this book addresses both areas using C.     Now, the reader might not be aware, but there's currently a low-level language holy war between Rust and C going on (well, more like a two-front war with Rust tackling C and C++ at the same time). Which is fine and all - I've got no dog in this fight - but it got me thinking: Is there some book or piece of content that can teach me the same breadth of hardware knowledge based on Rust? Even though learning is fun, I'd rather learn a language at the same time I learn about hardware.      I don't expect to become a systems programmer any time soon, ...