When you use JSON to call an API - not a REST API, but something like JSON-RPC - you will usually want to encode one of several possible messages.
Your request body looks like this:
{
"type": "MessageWithA",
intersection() { | |
cube([30, 30, 10]); | |
smooth_union(0.1) { | |
rotate([0, 0, 10]) cube([20, 10, 20]); | |
rotate([0, 0, -10]) cube([10, 20, 20]); | |
} | |
} |
The D GC is tuned by default to trade memory for performance. This can be clearly seen in the default heap size target of 2.0, ie. the GC will prefer to just allocate more memory until less than half the heap memory is alive. But with long-running user-triggered processes, memory can be more at a premium than CPU is, and larger heaps also mean slower collection runs. Can we tweak GC parameters to make D programs use less memory? More importantly, what is the effect of doing so?
sphere(1); | |
sphere(2); | |
sphere(3); | |
sphere(4); | |
sphere(5); |
Today at dayjob, my architect: "You should update the README as well. You know, I don't like having all the library environment variables copied into the service README. Can you just link to the submodule?"
Me, actually quite liking that all the variables are right there in the service README: "I wish there was an include directive for markdown."
Me, having access to Sonnet API via OpenRouter: "How hard is ad-hoc Markdown parsing anyway?"
"Hey Sonnet, can you..."
Hi! Need your help with a ruby/rake tool. I'm trying to ensure that my README includes environment variable snippets that are consistent with the submodules the service pulls in. Those have their own READMEs documenting their respective environment variables. So my idea is to throw in a very simple ruby markdown parser that just splits the file at sections (lines starting with #) and include directives (lines of the form
[//] # (include path#section)
and then just ensures that the text following the include directive matches the section in
Dustmite is a tool written by CyberShadow that ships with the stock DMD download. It is a bug reducer.
Have you ever run into a compiler bug? Or some error message that you didn't understand, because it involved too much source code? Have you formed a theory about what was its cause, only for your simple testcase to end up unable to reproduce it? How does everybody else make those nice, simple testcases anyways? The answer is Dustmite.
How does that work? In fully general terms, Dustmite takes two things: a test folder, and a tester.
#!/usr/bin/env python3 | |
# Warning: Undertested! May corrupt your git repos! | |
import os | |
import sys | |
import subprocess | |
import re | |
import argparse | |
import shutil |
We had a fun bug last week that almost doubles as a logic puzzle. It makes perfect sense in hindsight, but as I was staring at it, it seemed every part of it was nailed down tight - until I spotted the obvious, natural assumption that had been violated from the start.
A bit of background. We're working with microservices propagating state with event streams. For a typical stream, most events will concern unrelated objects, so we parallelize them: each incoming event is assigned a key, and we accept parallel events so long as their keys don't collide with any events currently in progress. Furthermore, because we track our position in the input stream as a single number, we can't retire events as soon
Hi! Programming challenge. I'm gonna paste the convo from IRC, names anonymized. Same challenge goes to you. :)
[16:31] <foo> do you wanna hear some nerd shit about my event queue impl and why it started hanging forever once we started using google rpc
[16:31] <baz> Shore
[16:31] * foo spent three days on this bug
[16:31] <bar> Distributed stuff?
[16:31] <foo> okay so we have an eventstoredb client at work that used to use the tcp api but we're switching to the (cool, new) eventstore db
[16:31] <foo> er\
#!/usr/bin/env python3 | |
# Helper script that classifies the structure of a JSON object. | |
# Useful for getting an overview of novel JSON data. | |
# Created largely by Claude 3 Opus. | |
import json | |
import sys | |
class JSONType: | |
def is_similar(self, other): |