Skip to content

Instantly share code, notes, and snippets.

# 必要なモジュールのインポート
import numpy as np
import scipy.stats as stats
# カウントされた足の本数
counts = np.array([57, 62, 63, 60, 57, 60, 58, 60, 61, 62])
# つるとかめの個体数は合計で20匹
total_animals = 20
2752512 bytes alive from 0x7f8e184d27d1, alloc=84, free=0, collision=0
X509_VAL_it at ??:?
SSL_set_ciphersuites at ??:?
966000 bytes alive from 0x7f8e185b746e, alloc=29642, free=26548, collision=0
CRYPTO_zalloc at ??:?
229376 bytes alive from 0x7f8e184d27d1, alloc=7, free=0, collision=0
X509_VAL_it at ??:?
diff --git a/src-main/context.c b/src-main/context.c
index d84858c..08a0de5 100644
--- a/src-main/context.c
+++ b/src-main/context.c
@@ -594,7 +594,7 @@ anthy_save_history(const char *fn, struct anthy_context *ac)
dprintf(fd, "\n");
/**/
errno = 0;
- if (fchmod(fd, S_IREAD | S_IWRITE)) {
+ if (fchmod(fd, S_IRUSR | S_IWUSR)) {
@kazuho
kazuho / quest3-termux.md
Last active September 3, 2025 01:17
Meta Quest 3のlinuxセットアップ

想定読者

  • linuxに関する基本的な知識があるソフトウェアエンジニアもしくはヘビーユーザで、Quest 3のlinuxをGUI環境で使いたい人
  • apkのインストールとか説明しませんが、Quest 3に入れたやつは、アプリ一覧からカテゴリでUntrusted Sourcesみたいなのを選ぶと出てきます
  • termuxの上にlinux distroを載せるのは、遅いのでやりません(下記ベンチマーク参照)。prefixed-rootだろうがシングルユーザだろうがmusl libcだろうが我々なら大丈夫だ!
  • linuxアプリのインストールは特記事項ない限り省略します。勝手にpkg installとかして

ベンチマーク

@kazuho
kazuho / unixbench.md
Last active October 23, 2023 23:25
UnixBench Results

Summary of SystemBenchmarks Index Score:

single-core multi-core
Oculus Quest 3 (termux) 551.4 2086.0
Oculus Quest 3 (termux + proot(manjaro)) 254.0 1197.9
Ryzen 4750G (ubuntu 22.04) 2181.5 18262.5
MacBook Pro 16" 2019 (VMware Fusion + ubuntu 22.04) 684.8 3142.1

Oculus Quest 3 (termux)

@kazuho
kazuho / fizzbuzz300.c
Last active September 22, 2023 14:03
optimized fizzbuzz in C, using AVX and partial updates
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <immintrin.h>
#include <unistd.h>
#define inline __attribute__((always_inline))
@kazuho
kazuho / fizzbuzz-overwrite32.c
Created September 21, 2023 12:27
fizzbuzz using ymm + non-overlapping writes of uint32
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <immintrin.h>
#include <unistd.h>
#define inline __attribute__((always_inline))
static char tens[48] __attribute__((aligned(64)));
@kazuho
kazuho / fizzbuzz-ymm.c
Created September 21, 2023 12:25
optimized fizzbuzz in C using ymm registers
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <immintrin.h>
#include <unistd.h>
#define inline __attribute__((always_inline))
static char tens[48] __attribute__((aligned(64)));
@kazuho
kazuho / fizzbuzz.c
Created September 21, 2023 03:11
optimized fizzbuzz in C, one branch prediction miss per 100 numbers, uses 64-bit stores
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#define inline __attribute__((always_inline))
static char tens[16];
static size_t tenslen = 0;
@kazuho
kazuho / fizzbuzz.c
Created September 21, 2023 03:02
simple fizzbuzz in C
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
int maxval;
if (argc < 2 || sscanf(argv[1], "%d", &maxval) != 1) {
fprintf(stderr, "usage: %s <max-value>\n", argv[0]);
exit(1);