Skip to content

Instantly share code, notes, and snippets.

View ned14's full-sized avatar
💭
Happy happy happy!

Niall Douglas ned14

💭
Happy happy happy!
View GitHub Profile
@ned14
ned14 / main.cpp
Created November 9, 2022 17:21
Many SIMD ways of finding the last zero byte in a fixed length string
#include <cassert>
#include <chrono>
#include <climits>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <span>
#include <vector>
@ned14
ned14 / reset_docker_on_ubuntu_zfs.sh
Created September 3, 2020 15:06
Script to completely reset docker on zfs after Ubuntu zsysd has completely fubared your docker installation
# Ubuntu's zsysd creates snapshots within docker's zfs datasets, causing docker
# to fail to destroy them, which then completely wrecks the correspondance
# between zfs reality, docker's belief of zfs reality, and you are screwed.
# These are the commands I used to completely reset docker on zfs so it
# could be completely rebuilt.
# First things first: get rid of all the autozsys snapshots
service zsys stop
zfs list -H -o name -t snapshot | grep autozsys | xargs -n1 zfs destroy
@ned14
ned14 / gist:9ed4b583b3064ad9f8bbb8e9fa2408b6
Created May 10, 2020 21:25
Chris Glover directory enumeration performance regression
See attachment
@ned14
ned14 / fs_probe_results.yaml
Created April 20, 2020 22:54
Samba to Hyper-V Linux ext4 with 9k frames
---
timestamp: 2020-04-20 20:23:17 +0000
system:
os:
name: Microsoft Windows NT
ver: 10.0.19041
cpu:
name: GenuineIntel Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz
architecture: x64
physical_cores: 4
Running test latency:read:qd1:min ...
latency:read:qd1:min = 176800
Running test latency:read:qd1:mean ...
latency:read:qd1:mean = 235811
Running test latency:read:qd1:max ...
latency:read:qd1:max = 9119200
Running test latency:read:qd1:50% ...
latency:read:qd1:50% = 225700
Running test latency:read:qd1:95% ...
latency:read:qd1:95% = 297000

+++ title = "result<R, S>" weight = 20 +++

Header file result.hpp

namespace outcome_v2_xxx
{
namespace policy
{

Normal markdown code blocks with syntax highlighting:

template <class T> class foo;

The harder way which permits inline hyperlinking:

template <class T> class foo;

Note the link and syntax highlighting!

@ned14
ned14 / PoorCachedIoPerformance.cpp
Last active September 5, 2017 20:51
Demos the poor cached i/o performance on Windows
/* Demos the poor cached i/o performance on Windows
Windows x64 with NTFS:
memcpy: 91.7057ns per 1Kb
Write: 1258.34ns per 1Kb
Read: 1318ns per 1Kb
Linux x64 with ext4:
@ned14
ned14 / upd.sh
Created April 11, 2017 12:32
Update all boostish libraries when configured as siblings
cd boost-lite
git checkout master
git checkout include/revision.hpp
git pull
git submodule update --init
mkdir -p build_posix
cd build_posix
cmake ..
cd ../..
@ned14
ned14 / pegasus_mail_to_mbox.py
Created December 30, 2016 02:13
Converts old, corrupted Pegasus Mail mail stores into portable mboxo or maildir stores suitable for import into almost any other mail client
#!/usr/bin/python3
# Converts Pegasus Mail v4.x .PMM files into Unix mbox files using lots
# of heuristics to repair any corruption in the Pegasus mail store
# (the "Unix mbox" feature of Pegasus produces malformed Unix mbox files)
# (C) 2016 Niall Douglas http://www.nedprod.com/
# File created: Dec 2016
#
# Best used with python 3.6, anything older has a less able email and
# mailbox python modules