Skip to content

Instantly share code, notes, and snippets.

View areas.c
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define WIDTH (99 * 40)
#define HEIGHT (99 * 25)
static double timespec2d(struct timespec *ts)
* % gcc -shared -fPIC injectaddr.c -ldl -o
* -- inject 1s delay, then connect to
* % \
* curl
use strict;
use warnings;
use File::Temp qw(tempdir);
use Getopt::Long;
use POSIX qw(:sys_wait_h);
my $jobs = 1;
"jobs=i" => \$jobs,
#! perl
use strict;
use warnings;
my $lines_to_pick = 5; # 何行選ぶか
my $lines_total = 0;
my @picked;
kazuho / cloexec-posix-spawn.c
Created Nov 16, 2021
Command hangs on macOS 11.5 if O_CLOEXEC is used
View cloexec-posix-spawn.c
#include <errno.h>
#include <fcntl.h>
#include <spawn.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#define USE_O_CLOEXEC 1
View delivery_rate.h
* Copyright (c) 2021 Fastly, Inc., Kazuho Oku
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
kazuho / main.cpp
Last active Aug 8, 2021
micro:bit v2 controller for RIGID Micro DC Aircon
View main.cpp
#include <algorithm>
#include <cstdio>
#include "MicroBit.h"
static MicroBit uBit;
static int targetTemp = 35;
static int showCount;
static void setPower(int newPeriod, NRF52Pin &pin)
View gist:fa5a95e0aa2c44b552a78ba5ea0b5cdc
commit 2340bc1ef749df3494ed8897e438fd747e978b67 (origin/kazuho/travis-test, kazuho/travis-test)
Author: Kazuho Oku <>
Date: Mon Mar 22 20:41:34 2021 +0900
add assertion
diff --git a/lib/common/http1client.c b/lib/common/http1client.c
index 25c580d97..221c4b38b 100644
--- a/lib/common/http1client.c
+++ b/lib/common/http1client.c
View iw10.log
{"type":"packet-sent", "conn":0, "time":1611735067804, "pn":0, "len":1280, "packet-type":0, "ack-only":0}
{"type":"packet-received", "conn":0, "time":1611735067806, "pn":0, "decrypted":"0x7ffeebbe60c5", "decrypted-len":99, "packet-type":0}
{"type":"packet-acked", "conn":0, "time":1611735067806, "pn":0, "is-late-ack":0}
{"type":"packet-received", "conn":0, "time":1611735067806, "pn":1, "decrypted":"0x7ffeebbe615c", "decrypted-len":1076, "packet-type":2}
{"type":"packet-received", "conn":0, "time":1611735067806, "pn":2, "decrypted":"0x7ffeebbe65c4", "decrypted-len":1228, "packet-type":2}
{"type":"packet-received", "conn":0, "time":1611735067806, "pn":3, "decrypted":"0x7ffeebbe6ac4", "decrypted-len":715, "packet-type":2}
{"type":"packet-received", "conn":0, "time":1611735067806, "pn":4, "decrypted":"0x7ffeebbe6daa", "decrypted-len":363, "packet-type":3}
{"type":"packet-sent", "conn":0, "time":1611735067806, "pn":1, "len":112, "packet-type":2, "ack-only":0}
{"type":"packet-sent", "conn":0, "time":1611735067806, "
View master.log
$ build/default/cli -e /dev/stdout -k tmp/server.key -c tmp/server.crt 4433 2>&1 | egrep 'packet-(sent|ack)'
{"type":"packet-sent", "conn":0, "time":1611723421519, "pn":0, "len":168, "packet-type":0, "ack-only":0}
{"type":"packet-sent", "conn":0, "time":1611723421519, "pn":1, "len":1182, "packet-type":2, "ack-only":0}
{"type":"packet-sent", "conn":0, "time":1611723421519, "pn":2, "len":161, "packet-type":2, "ack-only":0}
{"type":"packet-sent", "conn":0, "time":1611723421519, "pn":3, "len":211, "packet-type":3, "ack-only":0}
{"type":"packet-acked", "conn":0, "time":1611723421521, "pn":1, "is-late-ack":0}
{"type":"packet-acked", "conn":0, "time":1611723421522, "pn":2, "is-late-ack":0}
{"type":"packet-acked", "conn":0, "time":1611723421522, "pn":3, "is-late-ack":0}
{"type":"packet-sent", "conn":0, "time":1611723421522, "pn":4, "len":1350, "packet-type":3, "ack-only":0}
{"type":"packet-sent", "conn":0, "time":1611723421522, "pn":5, "len":1350, "packet-type":3, "ack-only":0}