Q's Blog

Optimizing Sony Digital Paper for Chinese

4 minute read Published: 2024-06-18

The Sony DPT-RP1 is a large-screen E Ink reader built for A4 PDFs. Sony ships the same firmware image in China, Japan, and the United States. A region identifier stored outside the firmware selects the UI language, the input methods, and the default font families, so flashing firmware cannot change the region.

The Japanese build has Japanese and English fonts. The American build has English only, while the Chinese build has Chinese and English. My Japanese unit rendered Chinese characters in a book's table of contents with Japanese glyph variants, or did not render them at all. The Chinese and American builds did not have that problem. Their default font families differ.

Surviving the OOM Killer with Swap

4 minute read Published: 2024-01-13

The Linux OOM killer runs when the kernel can no longer reclaim memory. If anonymous memory exceeds RAM and has nowhere to go, the kernel scores processes and kills the one with the highest score. On a small VPS, that can be the application, database, or build job you meant to keep alive. A low-priority daemon with a large RSS can lose, but so can one large process when there is no swap.

Swap gives anonymous pages backing storage under memory pressure. The kernel can evict those pages instead of killing the owning process, at the cost of latency when it reads them back. On a VPS, that delay is often preferable to losing the process.

Converting .sas7bdat to CSV Without SAS

2 minute read Published: 2023-08-27

.sas7bdat is the binary format SAS uses to store data sets. SAS is commercial statistical software with a licensing cost that prices out most individual users. The format is proprietary and undocumented by SAS, so every reader outside it, including pyreadstat, is the product of reverse engineering.

A single .sas7bdat file holds the table itself, the column metadata, and enough type information to reconstruct rows. What it does not hold is the display layer. SAS stores human-readable value labels and formats in a separate catalog file, .sas7bcat. Converting to CSV throws that layer away, because CSV has no place to put it.

Creating a Bootable macOS USB Installer

4 minute read Published: 2023-07-19

Making a macOS USB installer becomes awkward when the host and target use different architectures or macOS generations. I ran into it while reinstalling macOS 10.7 Lion on a 2012 Mac Pro from an M1 MacBook Air. The M1 cannot run Lion's installer, and Apple's direct Lion download is packaged in a form that modern macOS refuses to open.

Disabling Automatic APT on a Low-Resource Debian VPS

3 minute read Published: 2023-06-10

I run two inexpensive OranMe VPS instances: one has 0.1 CPU and 128MB RAM, the other 0.5 CPU and 512MB. They are only suitable for light self-hosted work, so I installed Debian without a desktop environment.

The 0.1 CPU box kept shutting down. In the OranMe control panel, its CPU usage hit the limit shortly before each crash. That looked like the provider's abuse protection killing the VM. /var/log/system.log showed that the spikes matched apt's periodic tasks.