Skip to content

Instantly share code, notes, and snippets.

View makotom's full-sized avatar
👋
Huomiseen. Bye.

Makoto Mizukami makotom

👋
Huomiseen. Bye.
View GitHub Profile
@makotom
makotom / anchors.html
Created February 15, 2024 05:50
Dynamic generation of HTML anchors (to test Intents)
<!doctype html>
<html lang="en">
<meta charset="UTF-8">
<title>Anchor generator</title>
<script>
addEventListener('DOMContentLoaded', () => {
const form = document.querySelector('form#input');
const input = document.querySelector('input#url');
const div = document.querySelector('div#output');
@makotom
makotom / enefarm.md
Last active July 7, 2023 12:15
エネファームの経済

共通諸元

  • 12.5 kWh g / m3
  • 139.68 JPY / m3
  • 26.5 JPY / kWh e
  • 水道水は 15 C, 出湯温度は 40 C, エネファームの貯湯温度は 60 C で一定
    • エネファームによる出湯は安定して 60 C の温水と 15 C の水道水の 5 : 4 混合と仮定

エコジョーズ

#!/bin/bash
CONCURRENCY=8
RESULT_DIR="$(mktemp -d -p ./)"
for iter in $(seq 1 "${CONCURRENCY}"); do
./ndt7-client.exe -format json | tail -n 1 >"${RESULT_DIR}/${iter}" &
done
until [[ "$(jobs | grep -c Running)" -eq 0 ]]; do
@makotom
makotom / snat-reflector.js
Created December 22, 2022 16:32
User-space gap filler to implement full-cone NAT on Linux brouter
#!/bin/node
const child_process = require('node:child_process');
const readline = require('node:readline/promises');
class SNATReflector {
constructor() {
this.armIptablesRestore();
this.armConntrack();
}
@makotom
makotom / transix-addrs.txt
Created October 7, 2022 03:33
IP address history of CGN at transix
2022/04/08 17:25:01 217.178.137.58
2022/04/05 19:43:14 217.178.137.58
2022/04/01 18:01:51 217.178.137.58
2022/03/26 10:58:34 217.178.130.122
2022/03/26 9:49:27 217.178.130.122
2022/03/01 20:36:31 217.178.27.70
2022/03/01 16:47:54 217.178.27.70
2022/01/16 17:54:54 217.178.27.70
2021/12/23 0:31:37 217.178.27.70
2021/11/25 14:48:27 217.178.27.183
@makotom
makotom / exp.txt
Last active July 1, 2022 05:47
IPv6 link-local addresses are not selected by RFC 3484/RFC 6724 destination address selection on Linux
$ uname -a
Linux *****.makotom.org 5.18.7-arch1-1 #1 SMP PREEMPT_DYNAMIC Sat, 25 Jun 2022 20:22:01 +0000 x86_64 GNU/Linux
$ curl -fsSJL https://gist.github.com/makotom/9bab3eccbd5eccc82011dd9730a8825a/raw/try-connect.c | gcc -o try-connect -x c -
$ ./try-connect 2001:db8::1234:5678
connecting 2001:db8::1234:5678...connected
src_addr: 240b:10:****:****:****:****:****:****
$ ./try-connect fe80::1234:5678
connecting fe80::1234:5678...EINVAL (22): Invalid argument
$ ./try-connect "$(ip -6 addr | grep 'scope link' | head -n 1 | awk '{ print $2 }' | awk -F/ '{ print $1 }')"
connecting fe80::****:****:****:****...EINVAL (22): Invalid argument
@makotom
makotom / multi-ndt7.sh
Created May 10, 2022 15:38
Multi-session ndt7
#!/bin/bash
MAX_ITER=16
RESULT_DIR="$(mktemp -d -p ./)"
for iter in $(seq 1 "${MAX_ITER}"); do
./ndt7-client >"${RESULT_DIR}/${iter}" &
done
until [[ "$(jobs | grep -c Running)" -eq 0 ]]; do
@makotom
makotom / multi-ndt7.sh
Last active May 10, 2022 15:36
Multi-session ndt7
#!/bin/bash
MAX_ITER=16
RESULT_DIR="$(mktemp -d -p ./)"
for iter in $(seq 1 "${MAX_ITER}"); do
./ndt7-client >"${RESULT_DIR}/${iter}" &
done
until [[ "$(jobs | grep -c Running)" -eq 0 ]]; do
@makotom
makotom / cygwin-eats-backslashes.c
Created September 6, 2021 15:40
Demo: Cygwin "eats up" backslashes unexpectedly under certain circumstances
#include <ctype.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <wchar.h>
// https://github.com/cygwin/cygwin/blob/eeeb5650cf706f4dde72ce8b8598aef41f88718a/winsup/cygwin/glob.cc#L112
#define MAXPATHLEN 8192
@makotom
makotom / PKGBUILD.patch
Created May 17, 2021 11:10
Patches to 1) avert bugs in vDSO of WSL1, and 2) build it with the default makepkg.conf
diff --git a/trunk/PKGBUILD b/trunk/PKGBUILD
index 76516184b49..a3b73c8f210 100644
--- a/trunk/PKGBUILD
+++ b/trunk/PKGBUILD
@@ -24,7 +24,8 @@ source=(https://ftp.gnu.org/gnu/glibc/glibc-$pkgver.tar.xz{,.sig}
bz27343.patch
0001-nptl_db-Support-different-libpthread-ld.so-load-orde.patch
0002-nptl-Check-for-compatible-GDB-in-nptl-tst-pthread-gd.patch
- 0003-nptl-Do-not-build-nptl-tst-pthread-gdb-attach-as-PIE.patch)
+ 0003-nptl-Do-not-build-nptl-tst-pthread-gdb-attach-as-PIE.patch