Skip to content

Instantly share code, notes, and snippets.

@kazuho
kazuho / nespresso.scad
Created January 8, 2024 10:34
Nespressoカプセルホルダ(OpenSCAD形式)レイヤ0.2mm前提
View nespresso.scad
Rtop = 12;
Htop = 25;
Rin = 15;
Rout = 20;
H = 2 + (Rout - Rin) / 1.5;
thick = 1.2;
rows = 7;
cols = 5;
for (i = [0:cols - 1]) {
View tsurukame95.py
# 必要なモジュールのインポート
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
View gist:159a48d29c826b8b51f60f6ab412a69a
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 ??:?
View anthy-unicode.termux.patch
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 November 8, 2023 21:18
Meta Quest 3のlinuxセットアップ
View quest3-termux.md

想定読者

  • 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
View unixbench.md

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
View fizzbuzz300.c
#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
View fizzbuzz-overwrite32.c
#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
View fizzbuzz-ymm.c
#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
View fizzbuzz.c
#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;