GTK UNIT SCALE: tweak density and scaling of GTK UIs 2025-11-01 22:00:00 JST GTK's widget spacing and padding can sometimes seem excessive, but it is particularly problematic on mid-DPI displays. These screens fall into that awkward range where 1x scaling makes elements too small while 2x scaling creates excessive spacing. gtk-unit-scale is a quick'n'dirty workaround. It introduces a new…
Imperative Balanced Binary Trees, Part 1: Core Balancing 2023-03-05 08:40:00 CET I used to find balanced trees tedious to deal with in an imperative setting, particularly in C, though I love them in functional languages. In this series, I will describe an implementation strategy that achieves all I could hope for in a C implementation: safe, modular, reasonably fast, independent of an allocation…
High quality scrolling with Emacs 2023-03-05 11:30:30 CET Doom Emacs convinced me to switch to emacs after being a long time vim user. Naturally, I spent a lot of time tweaking my emacs setup 😃 and I settled with Emacs 29.0 using native-compilation (see also gcc-emacs ). On macOS, I use a custom built emacs-plus formula . The specific command line is: $ brew install emacs-plus@29 --with-xwidgets…
Even more compact lexer table 2022-04-14 15:44:30+09:00 Some time ago, I blogged about the representation of lexer table . This post introduced a common scheme originally described in the Dragon Book together with a practical implementation. In a footnote, I mentioned that I thought that the pseudo-code of the Dragon Book was wrong: The traditional compacting scheme encodes transitions as a pair…
A typeof operator in OCaml 2021-06-25 21:26:20+09:00 Let’s say one is implementing a source to source rewriter for OCaml (a preprocessor, like a PPX library) and needs to manipulate the type of an expression. They don’t want to execute the expression, just want to refer to its type, something like a type of <expr> operator. OCaml lets you bind the type of a sub-expression to a variable, e.g.…
DDCUTIL: controlling the brightness of an external monitor 2021-06-25 13:16:27+09:00 TL;DR install ddcutil decrease brightness with sudo ddcutil setvcp 10 - 25 increase brightness with sudo ddcutil setvcp 10 + 25 to remove the sudo , setup udev rules as suggested by ddcutil documentation, e.g. /usr/share/ddcutil/data/45-ddcutil-i2c.rules on my setup For some time I wondered why external displays…
Pretty-printing with dominators 2020-11-14 17:55:44+01:00 A static analysis that I am working on generates complex intermediate data structures. To help debugging it, I wrote a few specialized pretty-printers. But these structures rely a lot on sharing (as in hash consing ). The output of pretty-printers would easily blow up in size. To the extent that it was not helping debugging anymore. Here is…
Nottui & Lwd at ML Workshop 2020 2020-09-06 13:40:47+02:00 Last week, the ML and OCaml workshops were held as part of ICFP 2020. There, I presented "Nottui & Lwd - A friendly toolkit for the ML programmer". Nottui builds on top of Notty to make user interfaces in the terminal. Lwd is an abstraction for making "interactive documents," a limited form of reactivity that proved suitable as an…
Inuit: Textual User Interfaces, OCaml Workshop 2016 2020-09-05 12:00:00+02:00 Inuit is a library I developed a few years ago to introspect the internal state of running applications. At its core is an abstraction representing an interactive text buffer. While doing some cleanup, I found the poster that I submitted at the OCaml Workshop 4 years ago. In this demo , it is used to visualize the…
Cuite Design (1/?): QObject in OCaml 2020-05-10 18:39:59+02:00 Two years ago, I worked on "Cuite" , an OCaml binding to Qt5. The project stalled when I reached the point where all core concepts were mapped to OCaml. The remaining work was very repetitive: going through the vast hierarchy of Qt classes and binding each method, accommodating for the occasional ad-hoc behavior. There are also some…
Compact Lexer Table Representation 2020-05-02 15:31:09+02:00 I found surprisingly little information on the transition table of a lexer generator. There are plenty of resources on the front-end, such as the very nice Regular-expression derivatives reexamined paper. However, resources on the transition table are much more scarce. Eventually, I found two references: The Dragon Book , which explains…
Mettre à jour un firmware NVME 2020-03-15 06:45:48+01:00 Comment mettre à jour le firmware d'un SSD Toshiba sous Linux. Update 2 (25/08/2020) : J'ai trouvé via ce guide pour hackintosh qu'il était possible de formater le disque NVME pour avoir des secteurs de 512 octets ou de 4 kilo-octets. J'ai fait un reformattage pour avoir des secteurs de 4 kilo-octets et depuis les performances sont…