news
Programming Leftovers
-
Tony Finch ☛ semaphores in Golang and GNU make
Semaphores are one of the oldest concurrency primitives in computing, invented over 60 years ago. They are weird: usually the only numbers of concurrent processes we care about are zero, one, or many – but semaphores deal with those fussy finite numbers in between.
Yesterday I was writing code that needed to control the number of concurrent operating system processes that it spawned so that it didn’t overwhelm the computer. One of those rare situations when a semaphore is just the thing!
-
Tony Finch ☛ syntax highlighting with tree-sitter
I moved my blog to my own web site a few years ago. It is produced using a scruffy Rust program that converts a bunch of Markdown files to HTML using pulldown-cmark, and produces complete pages from Handlebars templates.
Why did I write another static site generator?
-
Ted Unangst ☛ where do the bytes go?
Or perhaps more precisely, how do they get there? What happens when you call write?
-
Dirk Eddelbuettel ☛ Thinking inside the box
This version responds solely to things CRAN now nags about. As these are all package quality improvement we generally oblige happily (and generally fix in the respective package repo when we notice). I am currently on a quest to get most/all of my nags down so new releases are sometimes the way to go even when not under a ‘deadline’ gun (as with other releases this week).
-
[Old] Dave Gauer ☛ RetroV Change: Flattening Node Lists - ratfactor
One thing I never managed to simplify in my original slap-dash creation of this library was my handling of nested node (tag) lists.
A node tree is a series of (possibly nested) lists of HTML tags you would like rendered.
Lists can either represent tags, or they can simply be containers. Here are examples of each: [...]
-
Golang
-
Redowan Delowar ☛ Deferred teardown closure in Go testing
While watching Mitchell Hashimoto’s excellent talk1 on Go testing, I came across this neat technique for deferring teardown to the caller. Let’s say you have a helper function in a test that needs to perform some cleanup afterward.
You can’t run the teardown inside the helper itself because the test still needs the setup. For example, in the following case, the helper runs its teardown immediately: [...]
-