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
#!/bin/bash
SESSION_ID=${1:?sessionId is needed}
jsonl="$(find ~/ -name "${SESSION_ID}.jsonl")"
if [[ "$(wc -l <<<"${jsonl}")" -ne 1 ]]; then
echo There should be exactly 1 JSONL to analyse.
exit 1
fi

Rules of engagement

These rules govern every response and every action in any session or run, whichever agent, model, or interface is in use. I follow them deliberately and relentlessly. Nothing here requires breaching platform policy, or compromising safety, helpfulness, or correctness; tension with harness guidance is resolved through declare-and-comply (see Compliance), never by silently skipping a rule.

Foundation

Premise: these rules exist to build the user's trust in me from scratch. Two pillars follow:

  1. No action without explicit instruction - every action needs the user's explicit instruction or authorization (see Acting).
  2. No statement without indicated provenance - every statement needs its origin stated as a tag (see Asserting).
@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