matoken's blog https://matoken.org/blog Is there no plan B? Thu, 05 Feb 2026 21:07:09 +0000 ja hourly 1 https://wordpress.org/?v=6.9.1 https://matoken.org/blog/wp-content/uploads/2025/03/cropped-1865f695c4eecc844385acef2f078255036adccd42c254580ea3844543ab56d9-32x32.jpeg matoken's blog https://matoken.org/blog 32 32 GNU coreutils 9.10でpasteのデリミタにマルチバイト文字が利用可能に https://matoken.org/blog/2026/02/06/gnu-coreutils-9-10-paste/ https://matoken.org/blog/2026/02/06/gnu-coreutils-9-10-paste/#respond Thu, 05 Feb 2026 21:07:07 +0000 https://matoken.org/blog/?p=5219

GNU coreutils 9.10 がリリースされました.

paste でマルチバイト文字を認識するようになったそうです.まだ対応していなかったんだとちょっと試してみました.

  • paste(1) is now multi-byte character aware

まずは適当なファイルを用意します.

$ echo '1
2
3' > num
$ echo 'い
ろ
は' > data

GNU coreutils 9.7 のpaste で試すと日本語のデータもうまく動いていそうです.

$ paste --version | head -1
paste (GNU coreutils) 9.7
$ paste num data
1       い
2       ろ
3       は

NEWS の下の方を見ると少し詳しく書いてありました.

'paste' now supports multi-byte --delimiters characters.

デリミタにマルチバイト文字が使えるようになったようです.

ということで再度,今度はデミリタを指定します.

GNU coreutils 9.7 のpaste でデリミタに , を指定
$ paste num data -d,
1,い
2,ろ
3,は
GNU coreutils 9.7 のpaste でデリミタに を指定
$ paste num data -d=
1��
2��
3��

たしかにマルチバイト文字を使うとおかしくなります.

GNU coreutils 9.10 を用意
$ wget https://ftp.gnu.org/gnu/coreutils/coreutils-9.10.tar.xz \
	https://ftp.gnu.org/gnu/coreutils/coreutils-9.10.tar.xz.sig
$ echo 'SHA256 (coreutils-9.10.tar.xz) = FlNamt8LEANzZOLWEqrT2fTso6NElJztdNEvr0vVHSU=' | cksum -a sha256 --check
coreutils-9.10.tar.xz: OK
$ gpg --verify coreutils-9.10.tar.xz.sig
gpg: assuming signed data in 'coreutils-9.10.tar.xz'
gpg: Signature made Wed Feb  4 21:46:29 2026 JST
gpg:                using RSA key 6C37DC12121A5006BC1DB804DF6FD971306037D9
gpg: Good signature from "P draig Brady <P@draigBrady.com>" [unknown]
gpg:                 aka "P draig Brady <pixelbeat@gnu.org>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: 6C37 DC12 121A 5006 BC1D  B804 DF6F D971 3060 37D9
$ tar xvf coreutils-9.10.tar.xz
$ cd coreutils-9.10
$ sudo apt build-dep coreutils
$ ./configure
$ make
$ src/paste --version | head -1
paste (GNU coreutils) 9.10
GNU coreutils 9.10 のpaste でデリミタにマルチバイト文字を指定
$ ./src/paste num data -d=
1=い
2=ろ
3=は
$ ./src/paste num data -d🐈
1🐈い
2🐈ろ
3🐈は

ということでGNU coreutils 9.10 のpaste でデリミタにマルチバイト文字が使えるようになっているのが確認できました.
使い道はあまり浮かびませんが…….

環境
$ dpkg-query -W coreutils
coreutils       9.7-3
$ src/paste --version
paste (GNU coreutils) 9.10
Copyright (C) 2026 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by David M. Ihnat and David MacKenzie.
$ lsb_release -dr
Description:    Debian GNU/Linux forky/sid
Release:        n/a
$ arch
x86_64
]]>
https://matoken.org/blog/2026/02/06/gnu-coreutils-9-10-paste/feed/ 0
VirusTotalのcli toolとあまりに小さいAPI制限 https://matoken.org/blog/2026/02/06/virustotal-api-limit/ https://matoken.org/blog/2026/02/06/virustotal-api-limit/#respond Thu, 05 Feb 2026 20:49:13 +0000 https://matoken.org/blog/?p=5214

久々にcli でVirusTotal を使おうとしたらツールが変更になっていたり,API 制限がおかしくなっていました.

以前のblog エントリを確認すると,

以下のツールを使っていたようですが,Archived になっています.

現在は以下のツールがアクティブなようなのでこちらを使うことにしました.

build
$ git clone https://github.com/VirusTotal/vt-cli
$ cd vt-cli
$ make
$ build/vt -h
A command-line tool for interacting with VirusTotal.

Usage:
  vt [command]

Available Commands:
  analysis       Get a file or URL analysis
  collection     Get information about collections
  completion     Output shell completion code for the specified shell (bash or zsh)
  domain         Get information about Internet domains
  download       Download files
  file           Get information about files
  group          Get information about VirusTotal groups
  help           Help about any command
  hunting        Manage malware hunting rules and notifications
  init           Initialize or re-initialize vt command-line tool
  iocstream      Manage IoC Stream notifications
  ip             Get information about IP addresses
  meta           Returns metadata about VirusTotal
  monitor        Manage your monitor account
  monitorpartner Manage your monitor partner account
  retrohunt      Manage retrohunt jobs
  scan           Scan files or URLs
  search         Search for files in VirusTotal Intelligence
  threatprofile  Get information about Threat Profiles
  url            Get information about URLs
  user           Get information about VirusTotal users
  version        Show version number

Flags:
  -k, --apikey string   API key
      --format string   Output format (yaml/json/csv) (default "yaml")
  -h, --help            help for vt
  -s, --silent          Silent or quiet mode. Do not show progress meter
  -v, --verbose         verbose output

Use "vt [command] --help" for more information about a command.
API key 登録
$ build/vt init

██╗   ██╗██╗██████╗ ██╗   ██╗███████╗████████╗ ██████╗ ████████╗ █████╗ ██╗
██║   ██║██║██╔══██╗██║   ██║██╔════╝╚══██╔══╝██╔═══██╗╚══██╔══╝██╔══██╗██║
██║   ██║██║██████╔╝██║   ██║███████╗   ██║   ██║   ██║   ██║   ███████║██║
╚██╗ ██╔╝██║██╔══██╗██║   ██║╚════██║   ██║   ██║   ██║   ██║   ██╔══██║██║
 ╚████╔╝ ██║██║  ██║╚██████╔╝███████║   ██║   ╚██████╔╝   ██║   ██║  ██║███████╗
  ╚═══╝  ╚═╝╚═╝  ╚═╝ ╚═════╝ ╚══════╝   ╚═╝    ╚═════╝    ╚═╝   ╚═╝  ╚═╝╚══════╝

VirusTotal Command-Line Interface: Threat Intelligence at your fingertips.

Enter your API key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
API key written to config file: /home/matoken/.vt.toml
Relationships cache written to: /home/matoken/.cache/.vt.relationships.cache
Note

API key はVirusTotal のアカウントを作成してログインした状態で,右上のユーザーをクリックしたときに出てくる「API key」から取得できます.

準備ができたのでスキャンしたいファイルをアップロードします.

ファイルのアップロード
$ build/vt scan file ~/Downloads/briar-desktop-x64-0.6.4-beta.AppImage
/home/matoken/Downloads/briar-desktop-x64-0.6.4-beta.AppImage YTg3MzBiNGEwOWFmODUxMjgwYmFjOGI0YjE1YmQ4MTE6MTc3MDE5NDcyOA==

結果を確認してみようとします.しかし制限に掛かってしまっています.

結果の確認
$ build/vt analysis YTg3MzBiNGEwOWFmODUxMjgwYmFjOGI0YjE1YmQ4MTE6MTc3MDE5NDcyOA==
Quota exceeded

無料アカウントの制限を確認すると1日あたり500リクエストとか1分辺り4件とかで結構広くなぜ制限されたのかわかりません.

Public API constraints and restrictions

The Public API is limited to 500 requests per day and a rate of 4 requests per minute.
The Public API must not be used in commercial products or services.
The Public API must not be used in business workflows that do not contribute new files.
You are not allowed to register multiple accounts to overcome the aforementioned limitations.

自分のAPI ページを確認するとリファレンスページと違い以下のように1日1問い合わせになっています.少なすぎる…….

Access level
 Limited , standard free public API
Upgrade to premium
Usage 	Must not be used in business workflows, commercial products or services.
Request rate 	1 lookups / min
Daily quota 	1 lookups / day
Monthly quota 	31 lookups / month

virustotal limit01
virustotal limit02
virustotal limit03

以下のフォーラムを見ると結構古い問題のようでアカウントを作り直さないと治らなそうです.

If you have an old account with stricter limitations than described, it might be best to set up a new account to ensure you benefit from current limitations stated.

ちなみにプロフィールページはこんな感じで9年前に作ったアカウントのようです.

virustotal userprofile

仕方がないのでVirusTotal のアカウントを削除して作り直します.

virustotal deleteaccount

  • 既存アカウントを削除

  • 既存アカウントからログアウト

  • 新規アカウントを作成

    • このときアカウント名とメールアドレスが同じだと駄目

  • API key を取得して vt init を実行してAPI key 再登録

新しいアカウントは以下のように正い制限になりました.

Access level
 Limited , standard free public API
Upgrade to premium
Usage 	Must not be used in business workflows, commercial products or services.
Request rate 	4 lookups / min
Daily quota 	500 lookups / day
Monthly quota 	15.5 K lookups / month

これで普通に動かせそうな感じです.

$ build/vt analysis YTg3MzBiNGEwOWFmODUxMjgwYmFjOGI0YjE1YmQ4MTE6MTc3MDE5NDcyOA== | tail -10
  stats:
    confirmed-timeout: 0
    failure: 0
    harmless: 0
    malicious: 0
    suspicious: 0
    timeout: 0
    type-unsupported: 12
    undetected: 64
  status: "completed"
環境
$ build/vt version
vt-cli
$ git log --pretty=oneline -1
d3405587c568b6486ccd5ac773cde1a25e4bb762 (HEAD -> master, origin/master, origin/HEAD) chore: upgrade `vt-go` to version 1.1.0.
$ lsb_release -dr
Description:    Debian GNU/Linux forky/sid
Release:        n/a
$ arch
x86_64
]]>
https://matoken.org/blog/2026/02/06/virustotal-api-limit/feed/ 0
電源ボタンで自動シャットダウンを抑制 https://matoken.org/blog/2026/02/03/do-not-auto-shutdown-with-power-button/ https://matoken.org/blog/2026/02/03/do-not-auto-shutdown-with-power-button/#respond Tue, 03 Feb 2026 10:16:37 +0000 https://matoken.org/blog/?p=5203

laptop を少し移動したらシャットダウン処理が走ってしまいました.ログを見ると電源ボタンが押されてシャットダウン処理が走ったようです.
これを抑制しました.

ログはこんな感じです.

リスト 1. syslog より
2026-02-02T06:38:41.358362+09:00 tp-l13 acpid: received input layer event "button/power PBTN 00000080 00000000"
2026-02-02T06:38:41.359609+09:00 tp-l13 acpid: rule from /etc/acpi/events/powerbtn-acpi-support matched
2026-02-02T06:38:41.362438+09:00 tp-l13 acpid: executing action "/etc/acpi/powerbtn-acpi-support.sh"

/etc/systemd/logind.conf の電源ボタンを押したときの HandlePowerKey のコメントを解除して poweroffignore に書き換えて電源ボタンで何もしないようにします.

$ sudo git -C /etc diff HEAD~~ /etc/systemd/logind.conf
diff --git a/systemd/logind.conf b/systemd/logind.conf
index 02ec007..d7e2dbe 100644
--- a/systemd/logind.conf
+++ b/systemd/logind.conf
@@ -25,7 +25,7 @@
 #InhibitDelayMaxSec=5
 #UserStopDelaySec=10
 #SleepOperation=suspend-then-hibernate suspend
-#HandlePowerKey=poweroff
+HandlePowerKey=igore
 #HandlePowerKeyLongPress=ignore
 #HandleRebootKey=reboot
 #HandleRebootKeyLongPress=poweroff

デーモンを再起動して設定を反映します.

$ sudo systemctl restart systemd-logind

電源ボタンを押してシャットダウン処理が走らないのを確認します.

リスト 2. 環境
$ dpkg-query -W systemd acpi
acpi    1.8-1
systemd 259-1
$ lsb_release -dr
Description:    Debian GNU/Linux forky/sid
Release:        n/a
$ arch
x86_64
$ sudo lshw -sanitize -json | jq '."vendor", ."version"'
"LENOVO"
"ThinkPad L13"
]]>
https://matoken.org/blog/2026/02/03/do-not-auto-shutdown-with-power-button/feed/ 0
懐かしい感じのターミナルスクリーンセーバーのmystify-term https://matoken.org/blog/2026/01/27/mystify-term/ https://matoken.org/blog/2026/01/27/mystify-term/#respond Mon, 26 Jan 2026 20:48:08 +0000 https://matoken.org/blog/?p=5191

古いWindows を使っていた方は懐かしく感じるかもしれないターミナルスクリーンセーバーのmystify-term というものを見かけたので試してみました.

install

c製で依存も少ないのでmake 一発な感じです.Debian sind amd64/Raspberry Pi bookworm armhf ともに問題なく動きました.

$ git clone https://github.com/adsr/mystify-term
$ cd mystify-term
$ install mystify-term ~/bin/
$ which mystify-term
/home/matoken/bin/mystify-term
$ mystify-term --help
Usage:
  mystify-term [options]

Options:
  -h, --help                  Show this help
  -v, --version               Show program version
  -q, --polys=<int>           Set number of polygons (default=2, max=16)
  -p, --points=<int>          Set number of points per polygon (default=4, max=16)
  -t, --trails=<int>          Set number of trails lines (default=20, max=64)
  -f, --fps=<int>             Set frames per second (default=60)
  -e, --max-velocity=<float>  Set max velocity per point (default=1.00, min=0.01, max=10.00)
  -s, --no-status             Hide status text
  -i, --trail-incr=<int>      Render every nth trail (default=4, max=64)
$ mystify-term --version
mystify-term v0.1.0

実行例

とりあえずオプション無しで起動します.懐かしい感じのスクリーンセーバーが起動します.

スクリーンショットはこんな感じです.

mystify term01

UTF-8 の四角を使っているので,UTF-8 が使えないとこんな感じになったりします.まあこれはこれで.

mystify term02

動いている様子は以下のasciinema を.

キーバインド

下の方にあるとおり以下のキーバインドで操作ができます.

p=pause, s=step, r=reinit, w=status, q=quit

p

一時停止/再開

s

停止/コマ送り(pで再開)

r

再初期化

w

ステータス表示/非表示

q

終了

コマンドラインオプション

スタータスをいじれますが, -s, --no-status くらいであとは既定値でいいかなと言う感じ.

-h, --help                  Show this help

このヘルプを表示

-v, --version               Show program version

バージョン表示

-q, --polys=<int>           Set number of polygons (default=2, max=16)

ポリゴン数

-p, --points=<int>          Set number of points per polygon (default=4, max=16)

ポイント数(例えば3で三角形,4で四角形)

-t, --trails=<int>          Set number of trails lines (default=20, max=64)

トレイルラインの数

-f, --fps=<int>             Set frames per second (default=60)

1秒あたりのフレーム数

-e, --max-velocity=<float>  Set max velocity per point (default=1.00, min=0.01, max=10.00)

最大速度

-s, --no-status             Hide status text

ステータスを隠す

-i, --trail-incr=<int>      Render every nth trail (default=4, max=64)

n番目のトレイルごとに描画

tmux のスクリーンセーバーに設定

ターミナルマルチプレクサのtmux のスクリーンセーバーに設定してみます.

まずは設定ファイルに以下を記述します.

set -g lock-after-time 900 #スクリーンセーバーが起動するまでの秒数
set -g lock-command "mystify-term -s" #スクリーンセーバーコマンド
Note

tmux の設定ファイルは

       ~/.tmux.conf
       $XDG_CONFIG_HOME/tmux/tmux.conf
       ~/.config/tmux/tmux.conf

byobu から起動している場合は

       ~/.byobu/.tmux.conf

次回起動時から反映されますが,現在のtmux セッションに反映したい場合は以下のように tmux source 設定ファイル として反映できます.

$ tmux source ~/.byobu/.tmux.conf
]]>
https://matoken.org/blog/2026/01/27/mystify-term/feed/ 0
軽量ActivityPub Serverのsnac 2.89リリース https://matoken.org/blog/2026/01/25/snac-2-89/ https://matoken.org/blog/2026/01/25/snac-2-89/#respond Sun, 25 Jan 2026 10:16:05 +0000 https://matoken.org/blog/?p=5181

RELEASE NOTES

## 2.89

Fixed crash in pronouns processing (contributed by byte).

Added counters in the people page (contributed by byte).

New command-line option refresh, to refresh all follower and following Actor objects, marking them as broken if they are.

今回の新機能は2つ.

  • people ページにカウンターを追加

snac 2.89 people count

  • コマンドラインオプションにフォロワーとフォロー中のアクターのオブジェクトを更新する refresh を追加.

$ snac | grep refresh
refresh {basedir} {uid}              Refreshes all actors
$ snac snac-data matoken

特に問題がなかったのか何も出力されませんでした.

Debian package はまだ2.88 です.

$ rmadison snac2
snac2      | 2.75-2~bpo12+1 | oldstable-backports       | source, amd64, arm64, armel, armhf, i386, mips64el, mipsel, ppc64el, s390x
snac2      | 2.75-2~bpo12+1 | oldstable-backports-debug | source
snac2      | 2.75-2         | stable                    | source, amd64, arm64, armel, armhf, i386, ppc64el, riscv64, s390x
snac2      | 2.88-1~bpo13+1 | stable-backports          | source, amd64, arm64, armel, armhf, i386, ppc64el, riscv64, s390x
snac2      | 2.88-1~bpo13+1 | stable-backports-debug    | source
snac2      | 2.88-1         | testing                   | source, amd64, arm64, armhf, i386, ppc64el, riscv64, s390x
snac2      | 2.88-1         | unstable                  | source, amd64, arm64, armhf, i386, loong64, ppc64el, riscv64, s390x
snac2      | 2.88-1         | unstable-debug            | source
]]>
https://matoken.org/blog/2026/01/25/snac-2-89/feed/ 0
x11上のmltermでマウスアウト時に文字入力ができない https://matoken.org/blog/2026/01/21/mlterm-mouseout/ https://matoken.org/blog/2026/01/21/mlterm-mouseout/#respond Wed, 21 Jan 2026 11:31:37 +0000 https://matoken.org/blog/?p=5167

たくさんの環境で動作する軽量で多機能なターミナルエミュレーターのmlterm(Multi Lingual TERMinal)を近年メインに利用しています.

最近の問題としてmlterm のウィンドウからマウスカーソルが外れるとmlterm がアクティブウィンドウでも文字が入力できません.文字が入力できない→カーソルをmlterm に持ってくるというのが地味に面倒です.
今回これを調べて解決しました.

まず検索して以下の記事を見つけました.

解決方法は、

~/.mlterm/main

input_method=ibus

を追加すること。

直接マウスアウトのときの設定ではないのですが,これを真似すると確かにマウスアウトしても文字が入力できます.

~/.mlterm/main に以下の設定を追加
input_method = fcitx

しかし,今度は日本語が入力できません.
mlterm のドキュメントを見ても設定は大丈夫そう.

doc/ja/README.ja より
      o input_method (*default*) (#)
        使用するインプットメソッド
        default は、x11 版の mlterm では xim、それ以外は、システムが提供する標準
        のインプットメソッドが使用されます。
        フォーマットは以下のようになります。

        [input method];[option1]:[option2]

        [input method] にインプットメソッド(xim/uim/m17nlib/scim/kbd/skk/wnn/
        canna/iiimf)を指定し、必要であれば ":" で区切ってオプションを列挙します。

        各インプットメソッドのオプションは以下の通りです。

        xim の場合: xim:[xim server]:[locale]
        [xim server] で XIM サーバー名(kinput2, Ami, xcin など)を指定します。
        指定しなかった場合は、環境変数 XMODIFIERS で指定した XIM サーバーが
        使用されます。[locale] には XIM サーバーのローケールを指定します。指定し
        なかった場合はシステムのローケールが使用されます。use_xim オプションで
        xim を無効にした場合、xim を指定しても無視されます。

        uim の場合:
        uim:[conversion engine]
        [conversion engine] に変換エンジン(anthy, prime, hangul2など)を指定しま
        す。指定しなかった場合は uim のデフォルト変換エンジンが使用されます。

        m17nlib の場合:
        m17nlib:[language id]:[input method]
        [language id] には ISO-639 に従って言語(ar, zh, ja など)を指定します。
        指定しなかった場合はシステムのローケールから取得した言語が使われます
        [input_method] で使用するインプットメソッド(anthy, py など)を指定します
        指定されなかった場合は [language id] のデフォルトインプットメソッドが使
        用されます。m17nlib を指定した時は key ファイルで IM_HOTKEY を指定して
        ください。

        scim の場合:
        scim (オプション無し)

        ibus の場合:
        ibus:[conversion engine]
        [conversion engine] に変換エンジン(anthy, prime, hangul2など)を指定しま
        す。指定しなかった場合は ibus のデフォルト変換エンジンが使用されます。
        (ibusを使用する際の注意点)
        ibus の preferences 画面からキーボードショートカットを設定する場合、モデ
        ィファイアの Release にはチェックを付けないでください。

        fcitx の場合:
        fcitx (オプション無し)

        wnn の場合:
        wnn:[server]
        [server] には、接続するかな漢字変換サーバを指定します。
        なお、JSERVER 環境変数により指定することも可能です。
        また、WNNENVRC 環境変数により wnnenvrc ファイルの場所を指定することができます。

        canna の場合:
        canna (オプション無し)

        skk の場合:
        skk:dict=[dictionary](:utf8),sskey=[sticky shift key]
        [dictionary] に、接続する辞書サーバ(skkserv)の "ホスト名:ポート番号" 又
        は、辞書ファイルのパスを指定します。辞書が UTF-8 の場合には、末尾に
        :utf8 を付けてください。
        SKK_DICTIONARY 環境変数により指定することも可能です。
        指定しない場合は、localhost の辞書サーバに接続します。
        なお、上記とは別に、~/.mlterm/skk-jisyo をローカルの辞書として使用します。

        [sticky shift key] には、sticky shift key として使用するキーを指定してく
        ださい。印刷可能な文字のキーを指定する場合はその文字(\x3bのように16進数
        で指定することも可)を、それ以外の場合は <X11/keysymdef.h> に定義されたシ
        ンボル(XK_を除く)を指定してください。
        SKK_STICKY_SHIFT_KEY 環境変数により指定することも可能です。

        kbd の場合:
        kbd(:hide):[lang]
        US キーボードで入力された文字を、指定したキーボードレイアウトの文字に変
        換します。
        :hide を指定した場合は、ステータスウィンドウを表示しません。
        [lang]には、次のいずれかを指定することができます。
        arabic, hebrew, de, fr, es, pt, jp106, isciixxx
        なお、[lang]を省略した場合、ISCII モードの時は ISCII 配列、それ以外では
        ローケールにより判定します。
        kbd を指定した時は key ファイルで IM_HOTKEY を指定してください。

        iiimf の場合:
        iiimf:[language id]:[language engine]
        [language id] には RFC1766 に従って言語(ar, zh_CN, ja など)を指定しま
        す。指定されなかった場合はシステムのローケールから取得した言語が使われ
        ます。[language engine] では使用する LE (CannaLE, newpy など)を指定しま
        す。指定されなかった場合は [language id] のデフォルト LE が使用されま
        す。
        なお、HTT_SERVER_ADDRESS 環境変数により、接続するサーバのアドレス(Unix
        Domain Socket の場合はファイルパス)を指定できます。
        また、HTT_SHOW_STATUS_WINDOW=trueを指定することにより、ステータス表示用の
        ウィンドウを表示します。
        HTT_AUX_BASE_DIR 環境変数により、aux モジュールのあるパスを指定するこ
        とができます(デフォルトは/usr/lib/iiim/le)。

mlterm のログを見るとfcitx が読み込めていません.

~/.mlterm/msg.log
    Jan 21 19:22:50[3188254] ERROR(Resource temporarily unavailable): fcitx: Could not load.

この端末にはmlterm のインプットメソッドプラグインの mlterm-im-fcitx パッケージが導入されていませんでした.ibus は入っていたのでfcitx 切替時に入れていなかったのですね.そしてmlterm plugin を使わず日本語入力をしていたと.
mlterm-im-fcitx を導入してmlterm を起動し直すことでマウスアウト時も文字入力できるし日本語入力もできるようになりました.

$ apt-cache search mlterm input method
mlterm-im-fcitx - MultiLingual TERMinal, Flexible Input Method plugin
mlterm-im-ibus - MultiLingual TERMinal, IBus input method plugin
mlterm-im-m17nlib - MultiLingual TERMinal, m17nlib input method plugin
mlterm-im-scim - MultiLingual TERMinal, scim input method plugin
mlterm-im-skk - MultiLingual TERMinal, SKK input method plugin
mlterm-im-uim - MultiLingual TERMinal, uim input method plugin
$ sudo apt install mlterm-im-fcitx

mlterm mouseout

環境
$ dpkg-query -W mlterm*
mlterm  3.9.4-3
mlterm-common:amd64     3.9.4-3
mlterm-im-fcitx:amd64   3.9.4-3
mlterm-im-ibus  3.9.4-3
mlterm-im-m17nlib
mlterm-im-scim
mlterm-im-uim
mlterm-tiny
mlterm-tools    3.9.4-3
$ echo "${XDG_SESSION_TYPE}"
x11
$ lsb_release -dr
Description:    Debian GNU/Linux forky/sid
Release:        n/a
$ arch
x86_64
]]>
https://matoken.org/blog/2026/01/21/mlterm-mouseout/feed/ 0
軽量なActivityPub Server のsnac 2.88 でミュートワードやメタデータ除去機能追加 https://matoken.org/blog/2026/01/20/snac-2-88-muted_words-strip_metadata/ https://matoken.org/blog/2026/01/20/snac-2-88-muted_words-strip_metadata/#respond Mon, 19 Jan 2026 22:29:13 +0000 https://matoken.org/blog/?p=5160

snac susie

ミニマムで軽量なActivityPub Server のsnac 2.88 がリリースされました.

2.88

If disable_emojireact is set to true in server.json, EmojiReacts (incoming and outgoing) are totally disabled.

New command-line option top_ten, that returns the top ten most popular posts by a user (ordered by the sum of likes and boosts) (contributed by aov).

Added a new set of per-user muted words; if a post contains any of them, it’s hidden behind a dropdown (contributed by byte).

If an account has a metadata named pronouns, it’s shown by the name (contributed by violette).

Mastodon API: children of a post are returned recursively, not just the first level (contributed by violette).

Implemented optional metadata stripping for images and videos using external tools (contributed by Stefano Marinelli).

— https://codeberg.org/grunfink/snac2/src/branch/master/RELEASE_NOTES.md#2-88

それぞれのcommit はこのあたりでしょうか

絵文字リアクションの無効設定

今回の更新で,サーバー設定ファイルの server.json の中に disable_emojireact が設定できるようになりました.これを true にすることで絵文字リアクションの送受信が無効化できます.
自分は有効にしたいのでこの設定はスルー.

$ man doc/snac.8 | grep -A1 disable_emojireact
       disable_emojireact
                   If set to true, all EmojiReact support (for input and output) is disabled.

top_ten コマンド

top_ten という新しいコマンドラインオプションが実装されました.これを実行すると対象ユーザーのいいねとブースト数から最も人気のあった投稿のトップ10が表示できます.オプションで指定件数にもできます.

$ ./snac2/snac top_ten
snac 2.88 - A simple, minimalistic ActivityPub instance
Copyright (c) 2022 - 2026 grunfink et al. / MIT license

top_ten {basedir} {uid} [{N}]        Prints the most popular posts
$ ./snac2/snac top_ten snac-data matoken 5
https://snac.matoken.org/matoken/p/1768641700.668031 1★ 0↺
https://snac.matoken.org/matoken/p/1768600460.460220 0★ 0↺
https://snac.matoken.org/matoken/p/1768690681.713879 0★ 0↺
https://snac.matoken.org/matoken/p/1768690814.893464 0★ 0↺
https://snac.matoken.org/matoken/p/1768690913.716133 0★ 0↺
man doc/snac.1 | grep -A1 top_ten
             top_ten basedir uid [N]
                     Returns the ids of the top ten (or top N) most popular posts (considering the sum of likes and boosts).

ユーザーミュートワード

ユーザーごとにミュートワードが設定できるようになりました.投稿に設定ワードが含まれていた場合隠されるようになります.
設定は,対象アカウントの「private」 → 「Muted words…​」にあります.

snac 2.88 muted words

$ man doc/snac.5 | grep muted
       muted/      This directory contains files which names are hashes of muted actors. The content is a line containing the actor URL.  Messages from these actors will be ignored on input and not shown in any timeline.

画像とビデオのメタデータ除去

外部ツールを利用して画像とビデオからメタデータを除去できるようになりました.
既定値では無効になっています.有効にしたい場合は,server.json"strip_exif": true, を設定します.
画像のメタデータ除去にはImageMagickのmogrify を,動画のメタデータ除去にはffmpeg を利用します.導入していない場合は導入が必要です.
外部ツールがパスの通っていない場所にある場合は,mogrify_path, ffmpeg_path で指定可能です.

server.json 設定例
    "strip_exif": true,
    "mogrify_path": "/usr/local/bin/mogrify",
    "ffmpeg_path": "/usr/local/bin/ffmpeg",

実際にexif 付きの画像を投稿して確認してみます.

サンプル画像の入手と確認
$ wget https://raw.githubusercontent.com/ianare/exif-samples/refs/heads/master/jpg/Pentax_K10D.jpg
$ exif Pentax_K10D.jpg
EXIF tags in '/home/matoken/Downloads/Pentax_K10D.jpg' ('Intel' byte order):
--------------------+----------------------------------------------------------
Tag                 |Value
--------------------+----------------------------------------------------------
Manufacturer        |PENTAX Corporation
Model               |PENTAX K10D
Orientation         |Top-left
X-Resolution        |350
Y-Resolution        |350
Resolution Unit     |Inch
Software            |GIMP 2.4.5
Date and Time       |2008:07:31 15:56:49
Copyright           |Laitche (This file is in the public domain.) (Photographer
XP Author           |www.laitche.com
Compression         |JPEG compression
X-Resolution        |72
Y-Resolution        |72
Resolution Unit     |Inch
Exposure Time       |1/180 sec.
F-Number            |f/11.0
Exposure Program    |Aperture priority
ISO Speed Ratings   |200
Exif Version        |Exif Version 2.21
Date and Time (Origi|2008:05:04 16:47:24
Date and Time (Digit|2008:05:04 16:47:24
Exposure Bias       |0.00 EV
Metering Mode       |Pattern
Flash               |Flash did not fire, compulsory flash mode
Focal Length        |90.0 mm
FlashPixVersion     |FlashPix Version 1.0
Color Space         |sRGB
Pixel X Dimension   |100
Pixel Y Dimension   |72
Sensing Method      |One-chip color area sensor
--------------------+----------------------------------------------------------
EXIF data contains a thumbnail (1349 bytes).

exif 付きの画像を投稿します.

snac 2.88 strip exif

投稿された画像をダウンロードして確認するとexif は消えていました.

$ wget http://127.0.0.1:8001/test/s/post-d2e2931a72bbe1cafaaf94e82ea27e66.jpg
$ exif ./post-d2e2931a72bbe1cafaaf94e82ea27e66.jpg
Corrupt data
The data provided does not follow the specification.
ExifLoader: The data supplied does not seem to contain EXIF data.

以下のようなコマンドを発行しているようです.

mogrify
            xs *cmd = xs_fmt("cd \"%s\" && %s -auto-orient -strip \"%s\" 2>/dev/null", srv_basedir, mp, r_fn);
ffmpeg
 	            /* -map_metadata -1 strips all global metadata */
	            /* -c copy copies input streams without re-encoding */
	            /* we don't silence stderr so we can debug issues */
	            /* we explicitly cd to srv_basedir to ensure relative paths work */
	            xs *cmd = xs_fmt("cd \"%s\" && %s -y -i \"%s\" -map_metadata -1 -c copy \"%s\"", srv_basedir, fp, r_fn, tmp_fn);
man doc/snac.8 | grep -A1 metadata
$ man doc/snac.8 | grep strip_exif -A7
       strip_exif  If  set  to  true,  EXIF and other metadata will be stripped from uploaded images (jpg, png, webp, heic, avif, tiff, gif, bmp) and videos (mp4, m4v, mov, webm, mkv, avi). This requires the mogrify (from ImageMagick) and
                   ffmpeg tools to be installed. If snac cannot find or execute these tools at startup, it will refuse to run.

       mogrify_path
                   Overrides the default "mogrify" command name or path. Use this if the tool is not in the system PATH or has a different name.

       ffmpeg_path
                   Overrides the default "ffmpeg" command name or path. Use this if the tool is not in the system PATH or has a different name.
]]>
https://matoken.org/blog/2026/01/20/snac-2-88-muted_words-strip_metadata/feed/ 0
Let’s Encrypt の短期証明書とIP証明書を少し試す https://matoken.org/blog/2026/01/19/lets-encrypts-short-term-certificates-and-ip-address-certificates/ https://matoken.org/blog/2026/01/19/lets-encrypts-short-term-certificates-and-ip-address-certificates/#respond Mon, 19 Jan 2026 10:36:54 +0000 https://matoken.org/blog/?p=5150

無料で証明書を発行できるLet’s Encrypt で短期証明書と IP アドレス証明書の一般提供が開始されました.

Short-lived and IP address certificates are now generally available from Let’s Encrypt. These certificates are valid for 160 hours, just over six days. In order to get a short-lived certificate subscribers simply need to select the ‘shortlived’ certificate profile in their ACME client.

興味があるので少し試してみました.

certbot コマンドで試そうと思ったのですが,Debian package版のcertbot はunstable でも4.0.0 で対応していません.

$ certbot --ip-address
usage:
  certbot [SUBCOMMAND] [options] [-d DOMAIN] [-d DOMAIN] ...

Certbot can obtain and install HTTPS/TLS/SSL certificates.  By default,
it will attempt to use a webserver both for obtaining and installing the
certificate.
certbot: error: unrecognized arguments: --ip-address
$ certbot --version
certbot 4.0.0
$ rmadison certbot
certbot    | 1.12.0-2      | oldoldstable | all
certbot    | 2.1.0-4       | oldstable    | all
certbot    | 4.0.0-2       | stable       | all
certbot    | 4.0.0-2       | testing      | all
certbot    | 4.0.0-2       | unstable     | all

2日前の 58724f6 でCommit されているようです.

ということでDeveloper Guide を見ながらsource から導入して試しました.

certbot をsource からbuild
$ sudo apt install python3-dev python3-venv libaugeas-dev gcc (1)
$ git clone https://github.com/certbot/certbot (2)
$ cd certbot
$ git log --pretty=oneline -1
58724f68ec46c57dd3c3c8ed4ae686c2d7ad893b (HEAD -> 58724f6) Add CLI flag --ip-address (#10495)
$ python3 tools/venv.py (3)
$ source venv/bin/activate (4)
$ which certbot
/home/matoken/src/certbot/venv/bin/certbot
$ certbot --version
certbot 5.3.0.dev0
  1. 依存パッケージ導入

  2. source 入手

  3. build

  4. certbot環境に入る

今回使うオプションのhelp
$ certbot help all | grep -A2 -- --ip-address
  --ip-address IP_ADDRESSES
                        IP addresses to include. For multiple IP addresses you
                        can use multiple --ip-address flags. All IP addresses
                        will be included as Subject Alternative Names on the
                        certificate. (default: [])
$ certbot help all | grep -A8 -- --preferred-profile
  --preferred-profile PREFERRED_PROFILE
                        Request the given profile name from the ACME server,
                        or fallback to default. If the given profile name
                        exists in the ACME directory, use it to request a a
                        certificate. Otherwise, fall back to requesting a
                        certificate without a profile (which means the CA will
                        use its default profile). This allows renewals to
                        succeed even if the CA deprecates and removes a given
                        profile. (default: None)
IPアドレス証明書を取得
$ sudo bash -c "source venv/bin/activate && certbot certonly --ip-address 84.247.152.162 --preferred-profile shortlived"
出来上がった証明書を確認
$ sudo cat /etc/letsencrypt/live/84.247.152.162/cert.pem | openssl x509 -noout -issuer -subject -dates
issuer=C=US, O=Let's Encrypt, CN=YE2
subject=
notBefore=Jan 18 23:06:01 2026 GMT
notAfter=Jan 25 15:06:00 2026 GMT
$ sudo cat /etc/letsencrypt/live/84.247.152.162/cert.pem | openssl x509 -noout -text
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            06:e7:4e:65:fe:41:f7:9b:9e:38:12:12:64:13:85:b4:f3:dd
        Signature Algorithm: ecdsa-with-SHA384
        Issuer: C=US, O=Let's Encrypt, CN=YE2
        Validity
            Not Before: Jan 18 23:06:01 2026 GMT
            Not After : Jan 25 15:06:00 2026 GMT
        Subject:
        Subject Public Key Info:
            Public Key Algorithm: id-ecPublicKey
                Public-Key: (256 bit)
                pub:
                    04:d9:d9:68:d2:fe:7b:09:0d:c4:97:1e:fc:e4:1e:
                    65:50:90:cc:63:ec:6a:98:a3:5c:77:b6:d0:33:f5:
                    4d:8f:ec:38:d5:e8:1d:01:75:fb:d6:93:15:b9:f3:
                    f8:7e:a4:a9:7b:bf:d7:4d:a3:5e:d0:ca:8f:74:e5:
                    7a:98:bc:8e:9e
                ASN1 OID: prime256v1
                NIST CURVE: P-256
        X509v3 extensions:
            X509v3 Key Usage: critical
                Digital Signature
            X509v3 Extended Key Usage:
                TLS Web Server Authentication
            X509v3 Basic Constraints: critical
                CA:FALSE
            X509v3 Authority Key Identifier:
                B9:59:F2:8E:CF:22:F0:86:D3:37:48:FF:76:14:18:BA:82:D8:55:87
            Authority Information Access:
                CA Issuers - URI:http://ye2.i.lencr.org/
            X509v3 Subject Alternative Name: critical
                IP Address:84.247.152.162
            X509v3 Certificate Policies:
                Policy: 2.23.140.1.2.1
            X509v3 CRL Distribution Points:
                Full Name:
                  URI:http://ye2.c.lencr.org/94.crl

            CT Precertificate SCTs:
                Signed Certificate Timestamp:
                    Version   : v1 (0x0)
                    Log ID    : 0E:57:94:BC:F3:AE:A9:3E:33:1B:2C:99:07:B3:F7:90:
                                DF:9B:C2:3D:71:32:25:DD:21:A9:25:AC:61:C5:4E:21
                    Timestamp : Jan 19 00:04:31.276 2026 GMT
                    Extensions: none
                    Signature : ecdsa-with-SHA256
                                30:45:02:20:19:47:12:58:F2:D7:9C:08:A5:0D:C0:5B:
                                F0:E7:DF:73:0F:64:77:B2:39:39:A4:3C:A1:D3:F0:39:
                                4E:7B:0D:91:02:21:00:87:BA:CE:E6:6E:F6:D3:52:D2:
                                BC:C4:ED:BE:26:6F:DE:BC:B7:17:5F:B6:47:4A:82:75:
                                A9:95:56:A0:68:FD:1F
                Signed Certificate Timestamp:
                    Version   : v1 (0x0)
                    Log ID    : E3:23:8D:F2:8D:A2:88:E0:AA:E0:AC:F0:FA:90:C9:85:
                                F0:B6:BF:F5:D2:A5:27:B0:01:FC:1C:44:58:C4:B6:E8
                    Timestamp : Jan 19 00:04:31.523 2026 GMT
                    Extensions: 00:00:05:00:2F:CD:F8:E5
                    Signature : ecdsa-with-SHA256
                                30:46:02:21:00:CD:4B:99:89:27:23:A9:B5:4E:68:D9:
                                A0:59:63:45:F5:8F:6A:5C:1F:C2:39:24:AF:60:E4:25:
                                FF:E6:53:08:4E:02:21:00:DE:9F:73:AB:35:BC:7D:5D:
                                E7:7A:CB:DE:A7:25:FE:2E:09:A3:2A:33:6E:3B:E4:4E:
                                D7:AD:67:B9:02:E5:36:B8
    Signature Algorithm: ecdsa-with-SHA384
    Signature Value:
        30:64:02:30:09:90:c5:7b:2d:7c:21:7e:7a:21:77:3a:2d:8e:
        cd:a1:4d:d1:5e:08:2f:8c:e7:b9:ad:19:39:33:d7:67:41:76:
        68:39:26:f5:cf:8e:4d:42:5e:cf:45:69:e2:8a:18:ef:02:30:
        2b:7f:6c:90:27:d1:e5:b1:dd:a2:2a:cb:20:d4:8c:27:0c:7c:
        6d:9b:06:c8:52:bd:23:d6:aa:83:61:f5:13:fd:77:55:e9:ab:
        29:e2:bd:82:84:4d:4f:81:4b:3b:76:8a
有効期限の時間を確認
$ echo $(( $( date +%s --date 'Jan 25 15:06:00 2026 GMT' ) - $( date +%s --date='Jan 18 23:06:01 2026 GMT' ) )) (1)
575999
$ echo $((160*60*60)) (2)
576000
  1. notBefore と notAfter の間の秒数を確認

  2. 160時間を秒数に変換

環境
$ git log --pretty=oneline -1
58724f68ec46c57dd3c3c8ed4ae686c2d7ad893b (HEAD -> 58724f6) Add CLI flag --ip-address (#10495)
$ dpkg-query -W python3-dev python3-venv libaugeas-dev gcc
gcc     4:14.2.0-1
libaugeas-dev:amd64     1.14.1-1+b3
python3-dev     3.13.5-1
python3-venv    3.13.5-1
$ lsb_release -dr
Description:    Debian GNU/Linux 13 (trixie)
Release:        13
$ arch
x86_64
]]>
https://matoken.org/blog/2026/01/19/lets-encrypts-short-term-certificates-and-ip-address-certificates/feed/ 0
絵文字リアクション機能などが追加されたsnac 2.86, 2.87 https://matoken.org/blog/2026/01/12/snac-2-86-2-87/ https://matoken.org/blog/2026/01/12/snac-2-86-2-87/#respond Mon, 12 Jan 2026 10:42:13 +0000 https://matoken.org/blog/?p=5140

snac susie

ミニマムで軽量なActivityPub Server のsnac 2.86, 2.87 がリリースされました.

RELEASE NOTES

RELEASE_NOTES.md を見ると主な変更点は以下のようになっています.

2.87

Hide EmojiReacts from muted actors and blocked instances.

2.86

Truncate RSS titles at UTF-8 character boundaries (contributed by lxo).

Link contacts to single-user people pages. Also, user’s posts are shown (contributed by lxo).

Added emoji reactions (contributed by violette).

Mastodon API: Fix for some client notifications (contributed by violette), fix for a status visibility error (contributed by fruye).

If the query variable terse of a public post page is set to anything, no header is shown.

Fixed search failures when the query string has any leading blank.

絵文字リアクション

興味深い新機能としては絵文字リアクションの対応があります.これによりMastodon やMisskey などの絵文字リアクションに対応したサービスと絵文字リアクションのやり取りができるようになりました.

以下はsnac とMisskey でそれぞれ絵文字リアクションを行ったときのスクリーンショットです.snac からの送信時は絵文字の文字列を記述する必要があります.

snacから絵文字リアクション送信
Misskeyへの絵文字リアクション送信
絵文字リアクション受信

以下は実際の投稿.

どうもこの絵文字リアクションを使った嫌がらせが発生したようでそれの対策としてミュートしたアクターとブロックしたインスタンスからの絵文字リアクションを非表示にする機能が 2.87 としてリリースされました.

もし絵文字リアクション機能を使いたくない場合は 2.86, 2.87 をスキップして絵文字リアクションを設定で無効にできる変更を含んだリリースを待つのが良さそうです.

カスタム絵文字の登録については以下の記事を参照してください.

RRS タイトルをUTF-8 の境界で切り捨てる

RSS のtitle をUTF-8 境界で切り捨てるのは日本語で文字化けすることが無くなりそうです.以下ようにして確認できそうですが修正前の2.85 で確認したところ丁度問題のないタイミングだったようでこのときは問題ありませんでした.

$ curl -s https://snac.kagolug.org/matoken.rss | nkf | xmllint --format - | grep title | head

snac のアップグレード

特に問題なくいつもの手順でアップグレードできました.

snac のアップグレード例(source)

$ cd $SNAC-SRC
$ git pull
$ git checkout 2.87
Previous HEAD position was b84b92d Version 2.86 RELEASED.
HEAD is now at c2b050c Version 2.87 RELEASED.
$ make
$ ./snac | head -2
snac 2.87 - A simple, minimalistic ActivityPub instance
Copyright (c) 2022 - 2026 grunfink et al. / MIT license
$ sudo service snac2 stop
$ sudo -u snac tar cvf snac2-`date +%F_%T-$$`.tar ~snac/snac-data
$ sudo -u snac /home/snac/snac2/snac upgrade ~snac/snac-data
05:52:38 OK
$ sudo service snac2 start

snac のアップグレード例(Debian package)

$ snac | head -2
snac 2.85 - A simple, minimalistic ActivityPub instance
Copyright (c) 2022 - 2025 grunfink et al. / MIT license
$ sudo apt update
$ sudo apt upgrade
$ snac | head -2
snac 2.87 - A simple, minimalistic ActivityPub instance
Copyright (c) 2022 - 2026 grunfink et al. / MIT license
$ sudo service snac2 stop
$ sudo -u debian-snac tar cvf snac2-`date +%F_%T-$$`.tar /var/lib/snac2
$ sudo -u debian-snac snac upgrade /var/lib/snac2
18:56:22 Linux sandbox not compiled in
18:56:22 OK
$ sudo service snac2 start
]]>
https://matoken.org/blog/2026/01/12/snac-2-86-2-87/feed/ 0
NewYear2026 https://matoken.org/blog/2026/01/04/newyear2026/ https://matoken.org/blog/2026/01/04/newyear2026/#respond Sun, 04 Jan 2026 09:36:39 +0000 https://matoken.org/blog/?p=5127

new year2026

 _____________
( I'm pony... )
 -------------
     o      _^^
      o   _- oo\
          \----- \______
                \       )\
                ||-----|| \
                ||     ||
]]>
https://matoken.org/blog/2026/01/04/newyear2026/feed/ 0
Cloudflareの速度テストをTUIで https://matoken.org/blog/2025/12/31/cloudflare-speed-test-with-tui/ https://matoken.org/blog/2025/12/31/cloudflare-speed-test-with-tui/#respond Tue, 30 Dec 2025 22:45:08 +0000 https://matoken.org/blog/?p=5121

Cloudflare の速度計測サイトのspeed.cloudflare.com をTUI で計測できるcloudflare-speed-cli というものを知ったので試してみました.
cloudflare-speed-cli はRust 製でGPL-3.0 license です.

類似のもので,speedtest.net を計測できるspeedtest-cli をよく使っていますが,Cloudflare も使えると便利そうです.

cloudflare-speed-cli はGitHub Releases にはLinux x86_64, aarch64, macOS aarch64, x86_64, Windows x86_64 のバイナリがあります.しかし例によってRaspberry Pi bookworm armhf(Arm 32bit)でも試してみます.

Rust 関連はasciimena 3.0 をbuild したときに入れたものからrustup で1.92.0 にしたものを使います.

cargo install で時間が掛かりますが特につまづいたりせずbuild できました.

$ cargo --version
warning: `/home/matoken/.cargo/config` is deprecated in favor of `config.toml`
  |
  = help: if you need to support cargo 1.38 or earlier, you can symlink `config` to `config.toml`
cargo 1.92.0 (344c4567c 2025-10-21)
$ cargo install --git https://github.com/kavehtehrani/cloudflare-speed-cli --features tui
$ cloudflare-speed-cli --help
Cloudflare-based speed test with optional TUI

Usage: cloudflare-speed-cli [OPTIONS]

Options:
      --base-url <BASE_URL>
          Base URL for the Cloudflare speed test service [default: https://speed.cloudflare.com]
      --json
          Print JSON result and exit (no TUI)
      --text
          Print text summary and exit (no TUI)
      --download-duration <DOWNLOAD_DURATION>
          Download phase duration [default: 10s]
      --upload-duration <UPLOAD_DURATION>
          Upload phase duration [default: 10s]
      --idle-latency-duration <IDLE_LATENCY_DURATION>
          Idle latency probe duration (pre-test) [default: 2s]
      --concurrency <CONCURRENCY>
          Concurrency for download/upload workers [default: 6]
      --download-bytes-per-req <DOWNLOAD_BYTES_PER_REQ>
          Bytes per download request [default: 10000000]
      --upload-bytes-per-req <UPLOAD_BYTES_PER_REQ>
          Bytes per upload request [default: 5000000]
      --probe-interval-ms <PROBE_INTERVAL_MS>
          Probe interval in milliseconds [default: 250]
      --probe-timeout-ms <PROBE_TIMEOUT_MS>
          Probe timeout in milliseconds [default: 800]
      --experimental
          Enable experimental features (TURN fetch + UDP-like loss probe)
      --export-json <EXPORT_JSON>
          Export results as JSON
      --export-csv <EXPORT_CSV>
          Export results as CSV
      --auto-save <AUTO_SAVE>
          Use --auto-save true or --auto-save false to override (default: true) [default: true] [possible values: true, false]
      --interface <INTERFACE>
          Bind to a specific network interface (e.g., ens18, eth0)
      --source <SOURCE>
          Bind to a specific source IP address (e.g., 192.168.10.0)
      --certificate <CERTIFICATE>
          Path to a custom TLS certificate file (PEM or DER format)
  -h, --help
          Print help
  -V, --version
          Print version
$ cloudflare-speed-cli --version
cloudflare-speed-cli 0.3.1

早速試してみます.cloudflare-speed-cli をオプションなしで実行するとTUI で実行されます.起動してすぐに計測が始まり,既定値では計測結果が保存されます.tab key でHistory ページに遷移すると過去の計測結果を閲覧したりエクスポートしたりできます.

cloudflare speed cli TUI

--text オプションでcli モードですが,プログレスが大量に出てちょっと使いづらい感じです.

プロスレス部分はSTDERR なのでそれを捨ててしまってもいいかもしれません

$ cloudflare-speed-cli --text 2>/dev/null
IP/Colo/ASN: 133.106.160.49 / NRT / 138384 (-)
Download: 23.73 Mbps
Upload:   2.47 Mbps
Idle latency p50/p90/p99: 98.9/110.7/110.7 ms (loss 0.0%, jitter 10.2 ms)
Loaded latency (download) p50/p90/p99: 438.0/578.6/755.2 ms (loss 0.0%, jitter 130.1 ms)
Loaded latency (upload) p50/p90/p99: 654.8/794.1/794.1 ms (loss 45.5%, jitter 144.4 ms)

こんな感じで定期的に計測するのにも便利かもと思いましたが,cli モードでは既定値では結果を保存しないようです.

$ watch -n 3600 -- cloudflare-speed-cli --text

--auto-save true も追加すると結果が保存されます.

$ watch -n 3600 -- cloudflare-speed-cli --text --auto-save true

ただ,以下のようにTUI モードの計測時のログには --interface を指定してもInterface やAP 名は保存されないようです.

│ 3.   2025-12-31 06:30:11 +09:00  DL   20.69 Mbps  UL    4.66 Mbps  Idle p50  103.7 ms  -  (1)
│ 4.   2025-12-31 06:08:33 +09:00  DL   21.73 Mbps  UL    3.16 Mbps  Idle p50  100.7 ms  wlan0  TP-L13💻 (2)
  1. --text でcli モードで実行したときの結果

  2. TUI モードで実行したときの結果

SEE ALSO

$ speedtest-cli
Retrieving speedtest.net configuration...
Testing from Rakuten Mobile Network (133.106.160.42)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by GSL Networks (Tokyo) [0.26 km]: 60.882 ms
Testing download speed................................................................................
Download: 12.70 Mbit/s
Testing upload speed......................................................................................................
Upload: 2.69 Mbit/s
Speedtest CLI: Internet speed test for the command line ※Ookla公式だがプロプライエタリ
$ speedtest

   Speedtest by Ookla

      Server: IPA CyberLab 400G - Tokyo (id: 48463)
         ISP: Rakuten Mobile Network
Idle Latency:    50.15 ms   (jitter: 1.41ms, low: 48.98ms, high: 52.36ms)
    Download:    20.75 Mbps (data used: 19.9 MB)
                262.40 ms   (jitter: 71.32ms, low: 72.73ms, high: 398.26ms)
      Upload:     2.96 Mbps (data used: 1.6 MB)
                779.27 ms   (jitter: 95.79ms, low: 75.05ms, high: 1148.99ms)
 Packet Loss:     0.0%
  Result URL: https://www.speedtest.net/result/c/e1a349cf-53eb-4d63-b8f4-8550dabd772d
n8henrie/fastcli: Python3 speed test via Fast.com fast.com を使いcli で計測……2025-12-27にarchived されていた
$ python -m fastcli -v
Approximate download speed: 17.48 Mbps
]]>
https://matoken.org/blog/2025/12/31/cloudflare-speed-test-with-tui/feed/ 0
プロセスの情報をわかりやすく表示してくれるwitr https://matoken.org/blog/2025/12/29/witr_-why-is-this-running/ https://matoken.org/blog/2025/12/29/witr_-why-is-this-running/#respond Mon, 29 Dec 2025 12:31:39 +0000 https://matoken.org/blog/?p=5113

witr (why-is-this-running) はプロセス名,PID,ポート番号からそれがなぜ実行されているかを調べて表示してくれます.

witr ssh

例えば以下はport 22 を調べています.sshd が実行されていることなどがわかります.

$ sudo ./witr -port 22
Target      : sshd

Process     : sshd (pid 581)
User        : root
Command     : sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups
Started     : 4 days ago (Thu 2025-12-25 18:10:39 +09:00)

Why It Exists :
  systemd (pid 1)   sshd (pid 581)

Source      : systemd service (supervisor)

Working Dir : /
Listening   : 0.0.0.0:22
              :::22

Warnings    :
    Process is listening on a public interface
    Process is running as root
    Process is running from a suspicious working directory: /

メモリをたくさん使っている(1GB+)と警告が表示されたりもします

$ sudo ~/usr/local/bin/witr -pid 10522
Target      : firefox.real

Process     : firefox.real (pid 10522) [high-mem]
User        : matoken
Command     : /usr/bin/firefox.real
Started     : 2 days ago (Sat 2025-12-27 05:39:41 +09:00)

Why It Exists :
  systemd (pid 1) → firefox.real (pid 10522)

Source      : systemd service (supervisor)

Working Dir : /home/matoken

Warnings    :
  • Process is using high memory (>1GB RSS)

以下はプロセスID 524 からglance がcron から起動しているのがわかります.

$ ./witr -pid 524
Target      : glance

Process     : glance (pid 524) {forked}
User        : matoken
Command     : /home/matoken/bin/glance -config /home/matoken/.config/glance.yml
Started     : 4 days ago (Thu 2025-12-25 18:10:36 +09:00)
Restarts    : 1

Why It Exists :
  systemd (pid 1) → cron (pid 448) → cron (pid 492) → sh (pid 523 glance (pid 524)

Source      : systemd service (supervisor)

Working Dir : /home/matoken
Listening   : :::8080

Warnings    :
    Process is listening on a public interface

ポートスキャンしてopen しているポート全てに対してwitr を実行してみたりも.

$ sudo nmap -p 0-65535 localhost | grep open | cut -f1 -d\/ | xargs -n1 sudo ./witr -port

witr の導入

witr の導入はinstall.sh がおすすめされていますがあまり好みの方法ではありません.中を見るとGitHub Releases から環境にあったバイナリをダウンロードして, /usr/local/bin 以下にインストールしています.バイナリはLinux amd64, arm64 が用意してあります.
amd64 環境でには以下のような手順で手動で導入しました.

Note
v0.1.1 でmacOS amd64/arm64 も追加されました.
$ wget -c https://github.com/pranshuparmar/witr/releases/latest/download/witr-linux-amd64 (1)
$ install -m 755 ./witr-linux-amd64 ~/usr/local/bin/witr (2)
$ which witr
/home/matoken/usr/local/bin/witr
$ rm witr-linux-amd64
$ witr (3)
Usage: witr [--pid N | --port N | name] [--short] [--tree] [--json] [--warnings] [--no-color] [--env] [--help] [--version]
  --pid <n>         Explain a specific PID
  --port <n>        Explain port usage
  --short           One-line summary
  --tree            Show full process ancestry tree
  --json            Output result as JSON
  --warnings        Show only warnings
  --no-color        Disable colorized output
  --env             Show only environment variables for the process
  --help            Show this help message
  --version         Show version and exit
$ witr --version
witr v0.1.1 (commit b50f08b, built 2025-12-28)
  1. witr の最新のlinux amd64 バイナリ版をダウンロード

  2. 好みの場所にインストール

  3. USAGE

Linux armhf(arm 32bit) でも動かす

Raspberry Pi bookworm armhf でも動かしたいと思います.
build しようとしたらまずgolang が古いと言われたのでまずは新しいgolang の入手から.

package版golang は1.23 だが1.25.5+ が必要
$ /usr/bin/go build -ldflags "-X main.version=0.1.0 -X main.commit=$(git rev-parse --short HEAD) -X 'main.buildDate=$(date +%Y-%m-%d)'" -o witr-linux-arm32 ./cmd/witr
go: errors parsing go.mod:
/home/matoken/src/witr/go.mod:3: invalid go version '1.25.5': must match format 1.23
go.dev からarmv6 バイナリを入手してパスを通す
$ wget -c https://go.dev/dl/go1.25.5.linux-armv6l.tar.gz (1)
$ mkdir -p ~/usr/local
$ tar -C ~/usr/local -xzf go1.25.5.linux-armv6l.tar.gz (2)
$ rm go1.25.5.linux-armv6l.tar.gz
$ PATH=~/usr/local/go/bin:$PATH (3)
$ which go
/home/matoken/usr/local/go/bin/go
$ go version (4)
go version go1.25.5 linux/arm
$ cat << EOF > hello.go (5)
package main
import "fmt"
func main() {
	fmt.Println("Hello World")
}
EOF
$ go run hello.go (6)
Hello World
  1. Linux armv6l のバイナリをダウンロード

  2. アーカイブを適当な場所に展開

  3. パスを通しておく(一時的な例)

  4. バージョン確認

  5. hello world を用意

  6. 動作確認

witr をビルド
$ git clone https://github.com/pranshuparmar/witr/
$ cd witr
$ go build -ldflags "-X main.version=0.1.0 -X main.commit=$(git rev-parse --short HEAD) -X 'main.buildDate=$(date +%Y-%m-%d)'" -o witr-linux-arm32 ./cmd/witr
$ ./witr-linux-arm32 --version
witr 0.1.0 (commit a2dc413, built 2025-12-28)
]]>
https://matoken.org/blog/2025/12/29/witr_-why-is-this-running/feed/ 0
ssh tiny.christmas https://matoken.org/blog/2025/12/25/ssh-tiny-christmas/ https://matoken.org/blog/2025/12/25/ssh-tiny-christmas/#respond Wed, 24 Dec 2025 21:04:00 +0000 https://matoken.org/blog/?p=5097

去年はいくつかのターミナルクリスマスツリーを集めました.

ssh で接続するとツリーが表示されます.

$ ssh tiny.christmas

クリスマスツリーが表示され,「O Christmas Tree」の歌詞が流れます.
tree がUnicode点字を使って書かれているのが最近ぽいですね.

詳細は以下に.

]]>
https://matoken.org/blog/2025/12/25/ssh-tiny-christmas/feed/ 0
ターミナル特化MisskeyクライアントのsayakaちゃんとBlurHash https://matoken.org/blog/2025/12/24/sataka-and-blurhash/ https://matoken.org/blog/2025/12/24/sataka-and-blurhash/#respond Wed, 24 Dec 2025 13:37:08 +0000 https://matoken.org/blog/?p=5089

ターミナルに特化した Misskey ストリームクライアントのsayaka ちゃんというソフトウェアがあります.Sixel 対応端末で実行すると画像付きでMisskey をストリーミングしてとても楽しいです.

このsayaka ちゃんに --force-blurhash オプションが実装されたので少し試してみました.

BlurHash?

BlurHash はフードデリバリーサービスのWolt の開発した画像読み込みのプレースホルダーなどに利用できるコンパクトな20〜30文字で表せるぼかした画像です.
この容量の小さい画像をプレースホルダーに埋め込むと空っぽより彩りが豊かになったり,NSFW 画像をモザイクする代わりに使ったり出来ます.
BlurHash はJSON, HTML, Shell で安全な次のキャラクタを使ったBase 83 で表現されます.

0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz#$%*+,-.:;=?@[]^_{|}~

BlurHash はMITライセンスでたくさんの言語で実装されています.

以下はDebian logo をC 実装のBlurHash にコンポーネント数ごとにかけてみています.コンポーネント数により7〜133byteで表されています.

$ git clone https://github.com/woltapp/blurhash (1)
$ cd blurhash/C/
$ make blurhash_encoder (2)
$ make blurhash_decoder (3)
$ wget https://www.debian.org/logos/openlogo-nd-100.png (4)
$ file openlogo-nd-100.png
openlogo-nd-100.png: PNG image data, 101 x 124, 8-bit colormap, non-interlaced
$ for i in {1..8}; do ./blurhash_encoder $i $i openlogo-nd-100.png; done (5)
00SFLy
AJSFLyixHXx]
KJSFLyixR5HXx]kCWBj[%#
UJSFLyixR5xuHXx]kCofWBj[%#yDeTV@yXR5
eJSFLyixR5xuVsHXx]kCofj[WBj[%#yD%#eTV@yXR5tRV@o|%}kCRP
oJSFLyixR5xuVsiwHXx]kCofj[VsWBj[%#yD%#tleTV@yXR5tRofV@o|%}kCRPMJ%gV@ozozRPoz
yJSFLyixR5xuVsiwtlHXx]kCofj[VsozWBj[%#yD%#tlkCeTV@yXR5tRofkCV@o|%}kCRPMJMd%gV@ozozRPozRPozaytlR5H?kBRP
:JSFLyixR5xuVsiwtlt7HXx]kCofj[VsozVsWBj[%#yD%#tlkCj[eTV@yXR5tRofkCtRV@o|%}kCRPMJMdV@%gV@ozozRPozRPozozaytlR5H?kBRPtRxukCtRVsR5kCfkae
$ for i in {1..8}; do ./blurhash_encoder $i $i openlogo-nd-100.png | wc -c; done (6)
7
13
23
37
55
77
103
133
$ for i in {1..8}; do ./blurhash_decoder $( ./blurhash_encoder $i $i openlogo-nd-100.png ) 101 124 blur-$i.png; done (7)
$ lsix (8)
  1. BlurHash のsource 入手

  2. encoder build

  3. decoder build

  4. Debian logo file 入手

  5. プレースホルダー枚にBlurHash に変換

  6. バイト数確認

  7. BlurHash をpng に変換

  8. png に変換したBlurHash を表示

blurhash debian logo

昔はhtml のimg タグにlowsrc でサイズの小さい代替画像を指定したりしていましたが(現在は非推奨)それよりも小さくなると思います.

sayaka の –force-blurhash オプションを試す

sayaka ちゃんの –force-blurhash オプションを試してみます.
まずはbuild.
Linux でのbuild 時に引っかかりやすいのがGNU Make ではなくbmake を使うところ.

$ git checkout a4e143d50ceee29a61610d1ee76e4030b0bba273
Previous HEAD position was d76cb2c ver 3.8.1 (2024/09/21)
HEAD is now at a4e143d src/misskey: --force-blurhash オプションを実装してみる。 画像表示を Blurhash だけにするモード。
$ ./configure
$ bmake -DRELEASE all
$ src/sayaka
usage: sayaka <command> [<options...>]
 <command>
  -h,--home           : Home timeline mode (needs --server and --token)
  -l,--local          : Local timeline mode (needs --server)
  -p,--play=<file|->  : Playback mode
 <options>
  -s,--server=<host>  : Set misskey server
  -t,--token=<file>   : Set misskey access token file
  -c,--color=<color>  : 256,16,8,2,1 and gray[2-256] (default:256)
  --show-cw           : Open CW(Contents Warning) part
  --nsfw=<show|blur|alt|hide> : How to show NSFW contents (default:blur)
  --show-image=<yes|no|auto>  : Whether to show image or not (default:auto)
  -r,--record=<file>  : Record JSON to <file>
  --help-all          : More details

build 出来たので早速 --force-blurhash を試してみます.例えば misskey.io をこんな感じで.

$ src/sayaka --force-blurhash -l -s misskey.io

これまでは既定値ではNSFW コンテンツがBlurHash で表示されていましたが,--force-blurhash では全てのアイコン画像も添付画像もBlurHash になります.

sayaka blurhash

Note
アカウントや本文にはモザイクを掛けてあります.

BlurHash で画像サイズが小さくなるってことは通信料もデータ量も小さくなっていてプアな回線でもいい感じにストリーミングできそうな気がします.

BlurHash とSixel を60秒ずつ --record オプションでファイルに保存してみました.期待に反してBlurHash のほうが大分大きいです.

$ timeout 60 src/sayaka --record=blurhash.rec --force-blurhash -l -s misskey.io
$ timeout 60 src/sayaka --record=sixel.rec -l -s misskey.io
$ ls -s *.rec
436 blurhash.rec   44 sixel.rec

ttyrec でも同じような感じ.

$ ttyrec -f blurhash.ttyrec -- timeout 60 src/sayaka --force-blurhash -l -s misskey.io
$ ttyrec -f sixel.ttyrec -- timeout 60 src/sayaka -l -s misskey.io
$ ls -s *.ttyrec
1768 blurhash.ttyrec   228 sixel.ttyrec

通信量はどうだろうとnethogs コマンドで $ sudo nethogs -P $(pgrep sayaka) -l な感じで見てみるとやはりBlurHash のほうが通信量が多いような?

BlurHash
NetHogs version 0.8.8

    PID USER     PROGRAM          DEV                   SENT      RECEIVED
      ? root     unknown TCP                          435.079      11.067 kB/s
2782477 matoken  src/sayaka -..   enx349971e11a0f       0.252       6.934 kB/s

  TOTAL                                               435.331      18.001 kB/s
Sixel
NetHogs version 0.8.8

    PID USER     PROGRAM          DEV                   SENT      RECEIVED
      ? root     unknown TCP                          432.206      11.271 kB/s
2787797 matoken  src/sayaka -..   enx349971e11a0f       0.150       0.885 kB/s

  TOTAL                                               432.356      12.156 kB/s

録画データを見ると件数が違います.Sixel のときになにかボトルネックがありそうです.回線の問題?
後でVPS でも確認してみようと思います.

$ jq .body.type blurhash.rec | wc -l
119
$ jq .body.type sixel.rec | wc -l
10
]]>
https://matoken.org/blog/2025/12/24/sataka-and-blurhash/feed/ 0
ターミナルエミュレータのkittyで日本語入力 https://matoken.org/blog/2025/12/23/japanese-input-with-kitty/ https://matoken.org/blog/2025/12/23/japanese-input-with-kitty/#respond Tue, 23 Dec 2025 10:02:19 +0000 https://matoken.org/blog/?p=5082

icon 32x32

マルチプラットホーム,GPUベースなkitty というターミナルエミュレータがあります.

ターミナルグラフィックのkitty や同じターミナル内での文字サイズ変更など面白い機能もあったりしてGUI 環境でよく使っています.

新規環境でkitty で日本語入力が出来ず設定したのでこちらにもメモしておきます.

今回の環境はDebian trixue amd64 のほぼ初期環境,Wayland ではなくX.org にしてあります.kitty はDebian パッケージマネージャから導入して,日本語入力環境はfcitx + mozc です.
kitty 以外の環境では日本語入力は出来ていますが,kitty ではうまく行きません.

以下のissue を見ると GLFW_IM_MODULE=ibus をせっていすることでibus/fcitx 環境で日本語入力できるようです.

GLFW_IM_MODULE=ibus works for me with fcitx5.

とりあえず別の端末からこんな感じで環境変数を指定してkitty を起動すると日本語入力できます.

$ GLFW_IM_MODULE=ibus kitty

kitty の.desktop ファイルに環境変数を加えてGUI からのkitty 起動時に日本語入力できるようにしておきます.

$ dpkg -L kitty | grep desktop
/usr/share/applications/kitty.desktop
/usr/share/doc/kitty/examples/kitty-open.desktop
$ cp /usr/share/applications/kitty.desktop ~/.local/share/applications/
$ diff -u /usr/share/applications/kitty.desktop ~/.local/share/applications/kitty.desktop
--- /usr/share/applications/kitty.desktop       2025-06-23 03:52:56.000000000 +0900
+++ /home/matoken/.local/share/applications/kitty.desktop       2025-12-23 18:21:14.623247581 +0900
@@ -6,7 +6,7 @@
 Comment=Fast, feature-rich, GPU based terminal
 TryExec=kitty
 StartupNotify=true
-Exec=kitty
+Exec=env GLFW_IM_MODULE=ibus kitty
 Icon=kitty
 Categories=System;TerminalEmulator;
 X-TerminalArgExec=--

これでGUI からkitty を起動して日本語入力できるようになりました.

kitty im toot

環境
$ dpkg-query -W fcitx kitty
fcitx   1:4.2.9.9-2
kitty   0.41.1-2+b1
$ lsb_release -dr
Description:    Debian GNU/Linux 13 (trixie)
Release:        13
$ arch
x86_64
]]>
https://matoken.org/blog/2025/12/23/japanese-input-with-kitty/feed/ 0
bash scriptのflyoverで指定箇所の航空機情報を表示 https://matoken.org/blog/2025/12/22/flyover/ https://matoken.org/blog/2025/12/22/flyover/#respond Mon, 22 Dec 2025 11:57:20 +0000 https://matoken.org/blog/?p=5067

flyover は引数で指定した場所(地名や座標で指定可能)の(主に)航空機の情報をflightradar24 から取得して表示してくれるbash script です.

まずは依存関係のパッケージを導入します.

## Dependencies
curl jq
notify-send: (optional)

In a Debian-like distro, these can be installed with:

sudo apt install curl jq libnotify-bin
— README.mdより
$ sudo apt install curl jq libnotify-bin
Note
デスクトップ通知を利用しない場合は libnotify-bin は不要

bash script なのでscript を貰ってきてbash に渡せば動きます.

$ wget https://github.com/pvonmoradi/flyover-bash/raw/refs/heads/master/flyover
$ bash ./flyover -h
DESCRIPTION
    A simple client for flightradar24.com. Shows info of aircrafts flying
    overhead in a [latitude ± δ, longitude ± δ] vicinity

USAGE: flyover [OPTIONS]
OPTIONS
      [-s search_str]
        Search for city/region/place
        Use quotes for multi-word queries
      [-y latitude]
        Negative for south of equator and positive for north of equator
        Range: -90 <= latitude[float] <= +90
      [-x longitude]
        Negative for west of Prime Meridian and positive for east of Prime Meridian
        Range: -180 <= longitude[float] <= +180
      [-b bounds]
        Geographic bounds of the region of interest
        Format (comma-separated): "lat1,lon1,lat2,lon2"
      [-i flight_ids]
        flightradar24 flight_ids as a comma-separated list
        In this mode, only the corresponding flight details are queried
        Note: id is flightradar24's internal id (not ICAO or other standards)
        Format example: "id1,id2,id3"
      [-r delta_deg]
        δ in degrees in scan square : [latitude ± δ, longitude ± δ]
        Note: 1° of latitude ≈ 111 km
        Range: r[float] > 0
      [-o /path/to/detailed_flights]
        Set output path for detailed info of flights (json array)
        (implies 'detailed' mode)
      [-n]
        Use notification (implies 'detailed' mode)
      [-f]
        Set mode to 'brief', only print an augmented json
      [-v log_level]
        v = 0 : No logs. Equivalent to -q
        v = 1 : Set level to error
        v = 2 : Set level to warn
        v = 3 : Set level to info (default)
        v = 4 : Set level to debug
      [-q]
        Set log level to v = 0
      [-V]
        Print version
      [-h]
        Print help message

NOTES
    - latitude/longitude should be input in decimal degrees (not DMS)
    - Either use -s (geolocation service) OR (-y,-x) but NOT both
    - Default mode of operation is 'detailed'

EXAMPLES
    flyover -s "deylaman" -r 2
    flyover -s "قلعه گبری" -r 0.5 -n -v4
    flyover -y "-27.115" -x "-109.395" -r 24.15 -o /tmp/detailed.json
    flyover -s "深圳" -qf
    flyover -i "2b1abd2f,2b1cae23"
    flyover -b "43.58,58.72,46.58,61.72"

とりあえずhelp の下部に書かれているEXAMPLES を真似してみます.

$ bash ./flyover -s "tokyo" -r 2
[info ] Match found: "東京都, 日本"
[info ] 'tokyo' WGS84 coordinates at latitude=35.6768601, longitude=139.7638947
./flyover: line 264: bc: command not found
[error] Problem in generating bounds. Check -h

が,失敗しました. bc コマンドが足りないようです.
bc コマンドのパッケージを探して導入したら動くようになりました.

$ apt-file search -x bin/bc$
9base: /usr/lib/plan9/bin/bc
bc: /usr/bin/bc
$ sudo apt install bc
$ bash ./flyover -s "tokyo" -r 2
[info ] Match found: "東京都, 日本"
[info ] 'tokyo' WGS84 coordinates at latitude=35.6768601, longitude=139.7638947
[info ] Scan region for δ=2°: 37.676860,33.676860,137.763895,141.763895
———————
Air Canada, AC1/ACA1
✈ Boeing 777-333(ER)
↗ Canada, Toronto
↘ Japan, Tokyo
📅 Landed 20:29
📏 0km, 9km/h
https://www.flightradar24.com/ACA1/3d9afc99
———————
China Airlines, CI35/CAL035
✈ Airbus A350-941
↗ United States, Phoenix
↘ Taiwan, Taipei
📅 Delayed 22:47
📏 12km, 664km/h
https://www.flightradar24.com/CAL035/3d9b45e8
———————
Qantas, QF59/QFA59
✈ Airbus A330-303
↗ Australia, Sydney
↘ Japan, Tokyo
📅 Delayed 20:41
📏 1km, 494km/h
https://www.flightradar24.com/QFA59/3d9b996e
^C

README.md を修正したほうが良さそう.

$ git diff
diff --git a/README.md b/README.md
index cf34873..1847e02 100644
--- a/README.md
+++ b/README.md
@@ -16,13 +16,13 @@ latitude/longitude and δ.


 ## Dependencies
-- `curl jq`
+- `curl jq bc`
 - `notify-send`: (optional)

 In a Debian-like distro, these can be installed with:

 ``` shell
-sudo apt install curl jq libnotify-bin
+sudo apt install curl jq bc libnotify-bin
 ```

 ## Usage

-n のデスクトップ通知も試してみるとこんな感じで出てきます.

flyover n

常駐して指定範囲内に航空機が現れたらnotify が出せたりすると便利そうですがそういう機能は無さそうです.

自分の家のあたりは上空をたくさんの飛行機が通り,夜間帯などは航空機が通る音がよく聞こえます.そういうときにこのコマンドを叩くと何が飛んでいるかわかって楽しそうです.(自衛隊機もよく通りますがこれらはfr24に載らないのであまり面白くない……)

環境
$ dpkg-query -W bash curl jq bc libnotify-bin
bash    5.2.15-2+b9
bc      1.07.1-3
curl    7.88.1-10+rpi1+deb12u14
jq      1.6-2.1+deb12u1
libnotify-bin   0.8.1-1
$ lsb_release -dr
No LSB modules are available.
Description:    Raspbian GNU/Linux 12 (bookworm)
Release:        12
$ arch
armv7l

View on Mastodon

]]>
https://matoken.org/blog/2025/12/22/flyover/feed/ 0
鹿児島Linux勉強会2025.12に参加 https://matoken.org/blog/2025/12/21/kagolug-2025-12/ https://matoken.org/blog/2025/12/21/kagolug-2025-12/#respond Sun, 21 Dec 2025 14:48:03 +0000 https://matoken.org/blog/?p=5055

鹿児島らぐというLinux User Group で月一を目標に.「鹿児島Linux勉強会」という勉強会をしています.

最近はセルフホストしたビデオミーティングソフトウェアなどを利用してBoFやアンカンファレンスのような形式でネタのある人が発表,それにツッコミを入れていくような感じです.

12月の「鹿児島Linux勉強会 2025.12」では以下のような話題で盛り上がりました.

自分は「ActivityPub Server の snac その3」として10月,11月に発表したActivityPub Server のsnac の続きの話をしました.
このときの資料はこちら

鹿児島Linux勉強会次回は都市が変わって2026/01/18(日)の予定です.

]]>
https://matoken.org/blog/2025/12/21/kagolug-2025-12/feed/ 0
snacとBluesky連携 https://matoken.org/blog/2025/12/20/snac-bluesky-bridge/ https://matoken.org/blog/2025/12/20/snac-bluesky-bridge/#comments Sat, 20 Dec 2025 12:53:53 +0000 https://matoken.org/blog/?p=5033

snac susie

さくらのナレッジに軽量ActivityPub Server のsnac についての記事を寄稿しました.

ここに書かなかったsnac のことをいくつか書いていこうと思います.
今日はsnac とBluesky 連携について.

Bluesky はポストTwitter の一つでAT Protocol を利用した分散型SNS です.とはいえ現時点ではActivityPub ほど分散している感じはしません.
このBluesky とfediverse (snac のActivityPub も含む)とWeb を連携させるブリッジとしてBridgy Fed というサービスがあります.
Bridgy Fed を使ってsnac とBluesky を連携してみます,

ActivityPub から連携するには https://fed.brid.gy/login で認証後,「Enable」ボタンを押すとなっているのですがログインしてもボタンが見当たりません.Mastodon としてsnac のアカウントを認証したのでなにかAPI の違いや不足があるのかもしれません.

以下のページを見ると別の方法も紹介されています.

if login isn't supported for your fediverse server, search for and follow @bsky.brid.gy@bsky.brid.gy in the fediverse. That account will then follow you back. Accept its follow to make sure your fediverse posts get sent the bridge and make it into Bluesky. You can unfollow it afterward if you want, you'll still stay bridged. (Here's how to disable.)

snac の該当アカウントで @bsky.brid.gy@bsky.brid.gy をfollow します.するとこのアカウントからfollow が返されるので承認すると連携完了です.この後は unfollow しても連携は維持されるそうです.

このときの連携元アカウントが, @[user]@[instance] の場合Bluesky ブリッジアカウントのハンドルは [user].[instance].ap.brid.gy になります.

なにか投稿して確認しましょう.

snac bsky bridge

Bridgy Fed は単に投稿を転送するだけでなく返信やlikes, (元の投稿がブリッジされている場合は)repost なども連携されるようです.元の投稿を削除した場合も反映されます.

Which stuff of mine from the fediverse will get bridged?

Once you’ve enabled the bridge, anything that’s fully public and interacts with Bluesky users. This includes your posts, replies, likes, and reposts if the original post was bridged. Posts on Bluesky are limited to 300 characters, so longer posts from the fediverse are truncated and ellipsized. Hashtags, links, link previews, images, videos, and even alt text are also included.

ブリッジアカウントの削除を行いたい場合は,Bridgy Fedボットユーザー( @bsky.brid.gy@bsky.brid.gy )をブロックすることで削除できるようです.

If you’re on the fediverse or Bluesky, and you’ve opted in but now want to opt out, block the Bridgy Fed bot user for the network you want to opt out of. For example, on the fediverse, block @bsky.brid.gy@bsky.brid.gy. On Bluesky, block @ap.brid.gy.

(However, if you’re on a Pixelfed instance, DM the word stop to @bsky.brid.gy@bsky.brid.gy instead. Pixelfed doesn’t yet send the ActivityPub Block activity, so blocking won’t work. Hopefully they’ll fix that soon!)

If you’re on the web, email us from an address at your web site’s domain to show that you own it, or you can put the text #nobridge in the profile on your home page and then update your profile on your user page.

Once you’ve done this, Bridgy Fed will deactivate your bridged profile in that network, and it will no longer bridge any of your posts or interactions there.

You can undo this later and reactivate bridging for your account, but depending on the network, not everything will be perfectly restored. For example, when you disable bridging into the fediverse, the bridged fediverse account is deleted and all followers are disconnected. If you later re-enable it, fediverse users will have to search for your account by address manually to find and follow it again.

]]>
https://matoken.org/blog/2025/12/20/snac-bluesky-bridge/feed/ 1
snacの自動投稿機能 https://matoken.org/blog/2025/12/19/implementing-post-bots/ https://matoken.org/blog/2025/12/19/implementing-post-bots/#respond Fri, 19 Dec 2025 14:57:13 +0000 https://matoken.org/blog/?p=5024

snac susie

さくらのナレッジに軽量ActivityPub Server のsnac についての記事を寄稿しました.

ここに書かなかったsnac のことをいくつか書いていこうと思います.
今日はsnac のbot 向け投稿機能について.

bot やアナウンスなど向けのアカウントで自動投稿をしたいことがあります.
例えばいま考えているのはCalDav から今日のイベントを投稿するアカウント.現在はWebhook 経由でDiscord にpost したりしています.
snac でもいくつか自動投稿する機能があります.

Implementing post bots

snac makes very easy to post messages in a non-interactive manner. This example posts a string:

uptime | snac note $SNAC_BASEDIR $SNAC_USER –

You can setup a line like this from a crontab(5) or similar. Take note that you need a) command-line access to the same machine that hosts the snac instance, and b) write permissions to the storage directories and files.

You can also post non-interactively using the Mastodon API and a command-line http tool like curl(1) or similar. This has the advantage that you can do it remotely from any host, anywhere; the only thing you need is an API Token. This is an example:

curl -X POST https://$SNAC_HOST/api/v1/statuses \
–header “Authorization: Bearer ${TOKEN}” -d “status=$(uptime)”

You can obtain an API Token by connecting to the following URL:

— man(1) より
note basedir uid text [file file ... [-r inReplyTo [-d YYYYmmddHHMMSS]]]
        Enqueues a Create + Note message to all followers. If the text argument is -e, the external editor defined by  the  EDITOR  environment  variable
        will  be invoked to prepare a message; if it's - (a lonely hyphen), the post content will be read from stdin.  The rest of command line arguments
        are treated as media files to be attached to the post. The LANG environment variable (if defined) is used as the post language. An  optional  URL
        to  a  Fediverse post, prefixed by -r, can be specified for this note to be a reply to. If a date in YYYYmmddHHMMSS format is followed by -d, the
        note is scheduled for that moment instead of immediately posted (this date must be in the same timezone the user has configured in the web UI).
note_unlisted basedir uid text [file file ... [-r inReplyTo [-d YYYYmmddHHMMSS]]]
        Like the previous one, but creates an "unlisted" (or "quiet public") post.
note_mention basedir uid text [file file ... [-r inReplyTo [-d YYYYmmddHHMMSS]]]
        Like the previous one, but creates a post only for accounts mentioned in the post body.
block basedir instance_url
— man(1) より

snac note コマンドでの投稿

snac の動作している環境で実行できるのであればお手軽なsnac のnote コマンドがあります.
man(1) にある例を真似してみます.

uptime | snac note $SNAC_BASEDIR $SNAC_USER –

$ uptime | pee "./snac note snac-test test -" cat
 23:32:36 up 4 days, 10:17,  1 user,  load average: 1.56, 1.90, 1.69
23:32:36 [test] enqueue_message http://127.0.0.1:8001/test/p/1766154756.511450/Create
8       /�

投稿を確認するとこんな感じ.

snac note 1

日本語もそのままでok でした.

snac note 2

pfetch を流し込んでみるとこんな感じで整形を考えないとダメそう.

snac note 3

curl を使ってAPI 経由で投稿

こちらは一般的なネットワーク経由でリモートで投稿可能な方法です.token を入手してcurl コマンドで投稿します.

まず以下のようなURL でtoken を取得します.

以下のような画面になるので対象アカウントの情報を入手します.

snac get token

以下のようなトークンが取得できるのでメモします.

1f3ea50e9ab7cc85f5ff01b8f43fb1ae

後はcurl などで以下のようにPOST.
json で返り値が帰ってきます.

$ curl -X POST http://127.0.0.1:8001/api/v1/statuses --header "Authorization: Bearer 1f3ea50e9ab7cc85f5ff01b8f43fb1ae" -d "status=$(uptime)"
{
    "id": "1766155742b0f5ed692a273ff5b6ef59b696ddde76",
    "uri": "http://127.0.0.1:8001/test/p/1766155742.788170",
    "url": "http://127.0.0.1:8001/test/p/1766155742.788170",
    "account": {
        "id": "488d5ffe15e31aa0be5002853e8006f7",
        "username": "test",
        "display_name": "test",
        "discoverable": true,
        "group": false,
        "hide_collections": false,
        "indexable": true,
        "noindex": false,
        "roles": [
        ],
        "acct": "test@127.0.0.1:8001",
        "created_at": "2025-11-14T19:38:38Z",
        "last_status_at": "2025-12-19",
        "bot": false,
        "note": "<br>",
        "url": "http://127.0.0.1:8001/test",
        "uri": "http://127.0.0.1:8001/test",
        "avatar": "http://127.0.0.1:8001/susie.png",
        "avatar_static": "http://127.0.0.1:8001/susie.png",
        "header": "",
        "header_static": "",
        "emojis": [
        ],
        "locked": false,
        "followers_count": 0,
        "following_count": 0,
        "statuses_count": 0,
        "fields": [
        ]
    },
    "created_at": "2025-12-19T14:49:02.000Z",
    "content": "23:49:02 up 4 days, 10:34,  1 user,  load average: 1.48, 1.57, 1.68<br>",
    "visibility": "public",
    "sensitive": false,
    "spoiler_text": "",
    "media_attachments": [
    ],
    "mentions": [
    ],
    "tags": [
    ],
    "emojis": [
    ],
    "favourites_count": 0,
    "favourited": false,
    "reblogs_count": 0,
    "reblogged": false,
    "replies_count": 0,
    "in_reply_to_id": null,
    "in_reply_to_account_id": null,
    "reblog": null,
    "card": null,
    "language": "en",
    "filtered": [
    ],
    "muted": false,
    "text": " 23:49:02 up 4 days, 10:34,  1 user,  load average: 1.48, 1.57, 1.68",
    "edited_at": null,
    "poll": null,
    "bookmarked": false,
    "pinned": false
}
]]>
https://matoken.org/blog/2025/12/19/implementing-post-bots/feed/ 0
snacの通知について https://matoken.org/blog/2025/12/18/snac-notifigcations/ https://matoken.org/blog/2025/12/18/snac-notifigcations/#respond Thu, 18 Dec 2025 11:28:14 +0000 https://matoken.org/blog/?p=5007

snac susie

さくらのナレッジに軽量ActivityPub Server のsnac についての記事を寄稿しました.

ここに書かなかったsnac のことをいくつか書いていこうと思います.
今日はsnac の通知について.

snac の通知は以下のように「notifications」の横に数字で通知されます.「notifications」リンクをクリックすることで詳細が表示されます.

snac notifications

しかしこの通知はsnac のページが読み込まれたタイミングにならないと通知がわかりません.
しかし代替の通知がいくつか実装されています.これらを利用することでほぼリアルタイムな通知が可能となります.

e-mail

一般的なe-mail です.サーバーのメールシステムが設定済であればユーザーの「User Settings…​」から「Email address for notifications:」に宛先のe-main address を入力するることで利用可能です.
サーバーのメールシステムの設定がされていなかったり,外部のメールシステムを利用したい場合 server.json の以下の項目を設定することでもメールが送信できます.

Email address for notifications
        If this field is not empty, an email message will be sent to this address whenever a post written by you is liked, boosted or replied to.
— snac(1)より
smtp_url    Since version 2.76, email notifications can be sent via direct connection to an SMTP server instead of the traditional behaviour of piping the mes‐
            sage to /usr/sbin/sendmail.  Set this value to the SMTP url to be used for sending email notifications (for example, smtp://localhost). It may  in‐
            clude a port number if it's not running on the usual one, like in smtp://mail.example.com:587.
smtp_user
smtp_password
            To be filled if the SMTP server defined by the previous directive needs credentials.
— snac(8)より

snac notification email

Telegram で通知

インスタントメッセージアプリケーションのTelegram にも対応しています.ただ,Telegram bot を作成して利用する必要があるので期設定が少し初面倒です.

Telegram notifications
        To  enable  notifications  via Telegram, fill the two provided fields (Bot API key and Chat id). You need to create both a Telegram channel and a
        bot for this; the process is rather cumbersome but it's documented everywhere. The Bot API key is a long string of  alphanumeric  characters  and
        the chat id is a big, negative number.
— snac(1)より

以前Telegram bot をNextcloud のTOTP の通知設定に利用するために書いたエントリがあります.

Telegram bot が作成できたら各ユーザの「User Settings…​」の「Telegram notifications (bot key and chat id):」に設定することで利用できます.

ntfy で通知

OSS でセルフホスト可能でウェブブラウザやスマートフォンに通知ができるntfy というサービスがあります.これを利用してsnac の通知を行うことも可能です.

ntfy notifications
        To  enable  notifications  via  ntfy  (both self-hosted or standard ntfy.sh server), fill the two provided fields (ntfy server/topic and, if pro‐
        tected, the token).  You need to refer to the https://ntfy.sh web site for more information on this process.
— snac(1)より

セルフホスト可能ですが,とりあえずntfy.sh を利用して試すと良さそうです.

「User Settings…​」の「ntfy notifications (ntfy server and token):」に設定することで通知できるようになります.

Webhook で通知

色々なサービスが対応しているWebhook も利用可能です.

Notify webhook
        If this is set to an URL, an HTTP POST will be sent to it whenever a new notification happens (see the 'Webhook for notifications' section  below
        for more information).
— snac(1)より

例えばDiscord であれば,「チャンネルの編集」→「連携サービス」→「ウェブフックを作成」で生成されるURL を利用して通知できます.
これを「User Settings…​」の「Notify webhook:」に入力することで通知可能です.

mastodon アプリケーションでの通知

snac はmastodon API に対応しています.そのためmastodon アプリケーションが利用可能です.
mastodon アプリケーションの通知機能を使って通知を受けることが可能です.

]]>
https://matoken.org/blog/2025/12/18/snac-notifigcations/feed/ 0
snacのthemeを設定 https://matoken.org/blog/2025/12/17/snac-theme/ https://matoken.org/blog/2025/12/17/snac-theme/#respond Wed, 17 Dec 2025 12:04:10 +0000 https://matoken.org/blog/?p=4987

snac susie

さくらのナレッジに軽量ActivityPub Server のsnac についての記事を寄稿しました.

ここに書かなかったsnac のことをいくつか書いていこうと思います.
今日はsnac のtheme 変更.

snac はCSS ファイルを編集することでテーマを設定することが出来ます.
CSS ファイルは2種類あり,インスタンス全体のスタイルを設定する, {basedir}/style.css と,各ユーザー用のプライベートCSSファイルの {basedir}/user/{ユーザー名}}/static/style.css です.

Tip

手元のsnac 2.8.5 で試したところ,各ユーザーのプライベートCSSファイルはログインした状態でないと効かないようです.
つまり,各ユーザーの公開ページはグローバル設定が反映されます.
そして,設定にはtheme ファイルを該当場所に設定する必要がありますが,ウェブ上からは出来ないので管理者にお願いするなどの手間がかかります.

自分で設定しなくても, README.mdIncredibly awesome CSS themes for snac 部分にいくつかのtheme が紹介されているのでこれを使わせてもらったりそれを元にカスタマイズするのでも良さそうです.

$ grep -A5 'Incredibly awesome CSS themes for snac' README.md
## Incredibly awesome CSS themes for snac

- [A compilation of themes for snac (by Во )](https://codeberg.org/voron/snac-style).
- [A cool, elegant theme (by Haijo7)](https://codeberg.org/Haijo7/snac-custom-css).
- [A terminal-like theme (by Tetra)](https://codeberg.org/ERROR404NULLNOTFOUND/snac-terminal-theme).

以下は Pika というtheme を設定した例です.3ペインになり,PC等の横長画面での操作性が良さそうです.

snac theme pika

]]>
https://matoken.org/blog/2025/12/17/snac-theme/feed/ 0
DuckDuckGoのイースターエッグ https://matoken.org/blog/2025/12/16/ddg-easter-egg/ https://matoken.org/blog/2025/12/16/ddg-easter-egg/#respond Tue, 16 Dec 2025 11:13:39 +0000 https://matoken.org/blog/?p=4881

tumblrで見かけたのですが,検索エンジンのDuckDuckGoのイースターエッグを1つ知りました.

DuckDuckGoで「linux」と検索すると検索文字列の左のアヒルアイコンがペンギンになるというもの.

https://www.tumblr.com/matoken/802369996450906112/httpsduckduckgocomdistlogosdynamiclinuxpn

自分でも試してみるとたしかにペンギンに.

ddg qlinux

こちらのURL でいつでも確認できます.

ただし,いつも使っているJavaScript の必要ないhtml版( https://html.duckduckgo.com/html/ )だと変わりませんでした.

「BSD」だと特に何も変わらず.
tootしたところ,「FreeBSD」だとデーモンくんになると教えてもらいました.
その他「OpenBSD」もありました.

ddg linux
ddg freebsd
ddg openbsd

NetBSDは無さそう.旗はアイコンにしづらかった?

一部のボーカロイドもあるようです.
探せば他にもあるかもしれませんね.

]]>
https://matoken.org/blog/2025/12/16/ddg-easter-egg/feed/ 0
snacのWelcome pageを設定ファイルでカスタマイズ https://matoken.org/blog/2025/12/16/snac-welcome-page-costomsetting/ https://matoken.org/blog/2025/12/16/snac-welcome-page-costomsetting/#respond Tue, 16 Dec 2025 10:19:40 +0000 https://matoken.org/blog/?p=4973

snac susie

さくらのナレッジに軽量ActivityPub Server のsnac についての記事を寄稿しました.

ここに書かなかったsnac のことをいくつか書いていこうと思います.
今日はsnac でのWelcome pageのカスタマイズについてその2.
以前のカスタマイズではhtml ファイルの書き換えを行いましたが今回は設定ファイルでの書き換えです.

snac のtop page は以下のような挨拶ページが表示されます. greeting.html ファイルを書き換えることでこのページをカスタマイズ出来ますが,他にもサーバー設定ファイルの server.json でもカスタマイズ項目があります.

$ w3m -dump https://snac.kagolug.org/
snac.kagolug.org is a Fediverse instance that uses the ActivityPub protocol. In
other words, users at this host can communicate with people that use software
like Mastodon, Pleroma, Friendica, etc. all around the world.

This server runs the snac software and there is no automatic sign-up process.

The following users are part of this community:

    @info@snac.kagolug.org (info)
    @matoken@snac.kagolug.org (matoken)

This site is powered by snac.

snac greeting page

show_instance_timeline これを true に設定するとWelcome page に最新のユーザーが投稿したタイムラインが表示されるようになります.
また,以下の設定項目が設定されていた場合それも表示されます.

admin_email
インスタンス管理者の電子メールアドレス

admin_account
インスタンス管理者のアカウント

title
インスタンスのタイトル

short_description
インスタンスに対する短い説明

short_description_raw
short_description を生の文字列として解釈するか,HTML に変換するか

例えばこの様に設定すると,

$ grep -A5 show_instance_timeline snac-data/server.json
    "show_instance_timeline": true,
    "admin_email": "",
    "admin_account": "matoken",
    "title": "🐈🐈🐈",
    "short_description": "matokenの個人ActivityPub インスタンスです.",
    "short_description_raw": false,

こんな感じになりました.

snac welcome page customsettings

注意点として,show_instance_timelinetrue にすると greeting.html は無視されるようです.用途や好みに合わせてどちらかを利用する感じでしょうか.

]]>
https://matoken.org/blog/2025/12/16/snac-welcome-page-costomsetting/feed/ 0
snacでのSPAM対策 https://matoken.org/blog/2025/12/15/snac-spam-mitigation/ https://matoken.org/blog/2025/12/15/snac-spam-mitigation/#respond Mon, 15 Dec 2025 10:50:27 +0000 https://matoken.org/blog/?p=4962

snac susie

さくらのナレッジに軽量ActivityPub Server のsnac についての記事を寄稿しました.

ここに書かなかったsnac のことをいくつか書いていこうと思います.
今日はsnac でのSPAM 対策について.

SPAM が来ないに越したことはありませんがActivityPub でも偶に見かけます.もしSPAM が来るときのことを考えて対策を確認しておきます.
snac では2つの対策があるようです.

SPAM Mitigation
    There have been some SPAM attacks on the Fediverse and, as too many instances and server implementations out there still allow automatic account creation, it will only get worse.  snac includes some (not very strong) tools for try‐
    ing to survive the SPAM flood that will eventually happen.
The  min_account_age field in the main configuration file allows setting a minimum age (in seconds) to consider too recently created accounts suspicious of being a potential source of SPAM. This is a naïve assumption, because spam‐
mers can create accounts, let them dormant for a while and then start to use them. Also, some ActivityPub implementations don't even bother to return a creation date for their accounts, so this is not very useful.
From version 2.50, post content can be filtered out by regular expressions.  These weapons of mass destruction can be written into the filter_reject.txt file in the server base directory, one per line;  if  this  file  exists,  all
posts'  content  will  be  matched (after being stripped of HTML tags) against these regexes, one by one, and any match will make the post to be rejected. Use lower case, the regex will be case insensitive by default.  If you don't
know about regular expressions, don't use this option (or learn about them inw some tutorial, there are gazillions of them out there), as you and your users may start missing posts. Also, given that every regular expression  imple‐
mentation supports a different set of features, consider reading the documentation about the one implemented in your system.
— snac(8) より

アカウント作成から日の浅いアカウントを拒否

1つ目はメイン設定ファイルの server.json で設定できる min_account_age で,投稿を受け付けるアカウントが作成されてからの時間が設定できます.
ただし,SPAM アカウントを作成して寝かせてから運用したり,アカウントの作成日を返さない実装もあるらしいのであまり役に立たないようです.
既定値は 0 になっています.

$ jq .min_account_age server.json
0

投稿内容を正規表現でフィルタリング

2つめは投稿内容を正規表現でフィルタリングできるようです.snac データディレクトリに filter_reject.txt を用意してこのファイル中に1行ずつ記述できるようです.これにより全ての投稿をHTML タグを取り除いた後正規表現と1つずつ照合され一致する投稿は拒否されます.
正規表現なのでテストを十分して設定したほうが良さそうです.

Reverse proxy やFirewall などsnac の外で対策も考えられます.その他以下のようなものもあるようです.e-mail もこんな感じで多段にしたりしますね.そうなるとReceived のようなものが見たいなと思ったりも.

]]>
https://matoken.org/blog/2025/12/15/snac-spam-mitigation/feed/ 0
snacのrobots.txt https://matoken.org/blog/2025/12/14/snac-robots-txt/ https://matoken.org/blog/2025/12/14/snac-robots-txt/#respond Sun, 14 Dec 2025 09:26:00 +0000 https://matoken.org/blog/?p=4953

susie64 cool

さくらのナレッジに軽量ActivityPub Server のsnac についての記事を寄稿しました.

ここに書かなかったsnac のことをいくつか書いていこうと思います.
今日はsnac でのrobots.txt について.

検索エンジンで「site:snac.kagolug.org」のように検索してみると何も出てきません.運用開始からそう時間が経っていないからかな?と思いつつ念の為 robots.txt を確認するとこんな感じで全て拒否るすようになっていました.

$ w3m -dump https://snac.kagolug.org/robots.txt
User-agent: *
Disallow: /

source を確認すると httpd.c の中でハードコーディングされているようです.

$ grep -n -A5 robots.txt httpd.c
321:    if (strcmp(q_path, "/robots.txt") == 0) {
322-        status = HTTP_STATUS_OK;
323-        *ctype = "text/plain";
324-        *body  = xs_str_new("User-agent: *\n"
325-                            "Disallow: /\n");
326-    }

snac の設定でどうにかできればいいですが恐らく無理.ISSUE を探すと以下のものが.404エラーが邪魔なので用意しているだけでカスタマイズしたい人は前段のhttp proxy でルールを追加する感じのようです.

ISSUE を立てた方はnginx でカスタムrobots.txt を返すようにしているようです.

Actually, I am able to work around this by returning a custom robots.txt with nginx:

location = /robots.txt {
		return 200 'User-agent: FediFetcher\nAllow: /\nUser-agent: *\nDisallow: /\n';
}

自分の環境はApache2 httpd ですが同じような設定はできるので設定してみます.

Apache2 httpd のAlias でrobots.txt を設定

以前Nitter を公開していたときにもやっていたのでこれを参考に設定します.

Apache2 httpd のsnac 部分の設定を以下のように修正しました.これでLinux ファイルシステム内の /var/lib/snac2/robots.txt/robots.txt になるはずです.

$ sudo git diff /etc/apache2/sites-available/011-snac.kagolug.org.conf
diff --git a/apache2/sites-available/011-snac.kagolug.org.conf b/apache2/sites-available/011-snac.kagolug.org.conf
index f5b5c7f..7bb72c1 100644
--- a/apache2/sites-available/011-snac.kagolug.org.conf
+++ b/apache2/sites-available/011-snac.kagolug.org.conf
@@ -58,6 +58,11 @@
        </Location>

        Alias /static /var/www/static
+       Alias /robots.txt /var/lib/snac2/robots.txt
+       <Location "/robots.txt">
+               ProxyPass !
+               Require all granted
+       </Location>

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.

設定を確認してから反映します.

$ sudo apache2ctl configtest
$ sudo systemctl reload apache2

このファイルが,

$ sudo -u www-data cat /var/lib/snac2/robots.txt
User-agent: *
Allow: /

/robots.txt に反映されました.

$ w3m -dump https://snac.kagolug.org/robots.txt
User-agent: *
Allow: /

これで各種bot からのアクセスが許可されました.

source 書き換え

source からbuild している環境ではsource 書き換えでもrobots.txt をカスタマイズできました.でもアップデートのたびにパッチを当てるのは面倒なのでやはりproxy で設定するほうが良さそうです.

robots.txt を無くす(404 エラーがたくさんなのであまり良く無さそう)
$ git diff httpd.c
diff --git a/httpd.c b/httpd.c
index a8cd849..976fdd6 100644
--- a/httpd.c
+++ b/httpd.c
@@ -318,13 +318,6 @@ int server_get_handler(xs_dict *req, const char *q_path,
         *body  = xs_json_dumps(j, 4);
     }
     else
-    if (strcmp(q_path, "/robots.txt") == 0) {
-        status = HTTP_STATUS_OK;
-        *ctype = "text/plain";
-        *body  = xs_str_new("User-agent: *\n"
-                            "Disallow: /\n");
-    }
-    else
     if (strcmp(q_path, "/style.css") == 0) {
         FILE *f;
         xs *css_fn = xs_fmt("%s/style.css", srv_basedir);
$ w3m -dump https://snac.matoken.org/robots.txt
404 Not Found (snac/2.85)
全て許可に書き換え
$ git diff httpd.c
diff --git a/httpd.c b/httpd.c
index a8cd849..c0bcaef 100644
--- a/httpd.c
+++ b/httpd.c
@@ -322,7 +322,7 @@ int server_get_handler(xs_dict *req, const char *q_path,
         status = HTTP_STATUS_OK;
         *ctype = "text/plain";
         *body  = xs_str_new("User-agent: *\n"
-                            "Disallow: /\n");
+                            "Allow: /\n");
     }
     else
     if (strcmp(q_path, "/style.css") == 0) {
$ w3m -dump https://snac.matoken.org/robots.txt
User-agent: *
Allow: /
]]>
https://matoken.org/blog/2025/12/14/snac-robots-txt/feed/ 0