Paper Alert!
From Nov 17th-19th, I got to present our paper “How To Surprisingly Consider Recommendations?” at KEOD 2024. The conference is over, the proceedings are out, so grab it from SCITEPRESS while it’s hot! (mirror)
Read on to learn more!
Nobody reads your blog
From Nov 17th-19th, I got to present our paper “How To Surprisingly Consider Recommendations?” at KEOD 2024. The conference is over, the proceedings are out, so grab it from SCITEPRESS while it’s hot! (mirror)
Read on to learn more!
In this post, we’re going to investigate Python’s powerful collections.Counter
class, and how we can use it to, well, count stuff.
We’ll find that comparisons with other Counter
instances are supported, but unintuitive, and that scalar comparisons are not supported.
We’ll take a plunge into special methods, a somewhat low-level concept that enables, among other things, comparisons between objects.
With this knowledge, we’ll build a ComparableCounter
class that can we can use to apply a threshold to the actual value-counts and filter a Counter
in a more intuitive approach!
As I was hacking away at a shell-script the other day, I realised the script should prevent multiple instances from running at the same time. In my case, I wanted a simple egg-timer on the command line that runs for X minutes, shows a notification and beeps annoyingly, then exits. Obviously, there’s no point in having multiple timers stack up, so there should only ever be one ticking away.
There are multiple other reasons you may only want a single instance running: a long-running backup-task should complete before the next iteration starts, or all writes to a file should be synced to disk before modifying the file again.