Skip to content

Instantly share code, notes, and snippets.

@problame
problame / 00 Article.md
Last active April 29, 2025 12:49
io_uring, ext4, and O_DIRECT writes - how to make it issue directly to disk, without punting

Summary

While investigating neondatabase/neon#11446 I learned a lot about the exact conditions in which io_uring punts to async workers (io-wq).

Specifically, I was surprised that, on Debian Bookworm 6.1.0-32-amd64, all Direct IO writes on ext4 would get punted to async workers. Even fallocateing the space upfront didn't help.

I wrote a reproducer app (see appendix) and used bpftrace + light kernel patching to triangulate in which cases we punt, and why.

The gist is: on mainline kernel 6.12.25, fallocate() before you write, and it should work.

@problame
problame / main.c
Created April 4, 2017 14:54
C Function Pointer Typing
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
int *add(const int *a, const int *b) {
int *res = malloc(sizeof(int));
*res = *a + *b;
return res;
}
@problame
problame / gist:72dc65d40f4855166df370836e1add42
Created June 9, 2016 10:52
Thinkpad T460s notebookstats
= Lenovo Thinkpad T460s =
== Hardware Overview ==
* CPU: Intel(R) Core(TM) i7-6600U CPU @ 2.60GHz
* Intel HD Graphics 520
* Intel Ethernet I219-LM
* Intel Wireless 8260
== Notes ==
@problame
problame / 90-antispam.conf
Created January 26, 2015 22:22
Dovecot Antispam Configuration + Testing script
plugin {
# Dovecot Antispam-Plugin configuration for sa-learn
# Names for mailboxes that should not be confused
# i.e. only operate on mail moved in and out of the spam folder
antispam_trash = Trash,"Deleted Messages"
antispam_spam = Junk;Spam;SPAM
# The mailtrain backend basically is a fork and execv of the
@problame
problame / xcode_base_localization_cheat_sheet.md
Last active January 4, 2016 14:29
Xcode Base Localization Cheat Sheet

#Xcode Base Localization Cheat Sheet

If you are using Base.lproj to localize your Storyboards in Xcode (and you should!), you need to work with specific attributes for the IB objects that are not always equal to the real UIKit objects in code.

  • UILabel.textIBUILabel.text
  • UIButton.titleIBUIButton.normalTitle
  • UINavigationItem.titleIBUINavigationItem.title
  • UITabBarItem.titleIBUITabBarItem.title
  • [UISegmentedControl setTitle:forSegmentAtIndex:]IBUISegmentedControl.segmentTitles[n]
  • Title of a section in a static UITableView → IBUITableViewSection.headerTitle
#!/bin/sh
#
# update_storyboard_strings.sh - automatically extract translatable strings from storyboards and update strings files
# Based on http://forums.macrumors.com/showpost.php?p=16060008&postcount=4 by mikezang
storyboardExt=".storyboard"
stringsExt=".strings"
newStringsExt=".strings.new"
oldStringsExt=".strings.old"
localeDirExt=".lproj"