sid – matoken's blog https://matoken.org/blog Is there no plan B? Mon, 25 May 2026 22:18:04 +0000 ja hourly 1 https://wordpress.org/?v=7.0 https://matoken.org/blog/wp-content/uploads/2025/03/cropped-1865f695c4eecc844385acef2f078255036adccd42c254580ea3844543ab56d9-32x32.jpeg sid – matoken's blog https://matoken.org/blog 32 32 virsh consoleで仮想マシンに接続できない https://matoken.org/blog/2026/05/26/virsh-console-console-connection-failed/ https://matoken.org/blog/2026/05/26/virsh-console-console-connection-failed/#respond Mon, 25 May 2026 22:16:34 +0000 https://matoken.org/blog/?p=5486
virt manager

virsh consoleコマンドでvmに繋がらなくなりました.

$ virsh console openbsd7.9
error: operation failed: Active console session exists for this domain

エラーメッセージから検索してdaemonを再起動したり,hostを再起動しても駄目です.

virshのmanを見るとこんなオプションが.

Option‐ally the --force flag may be specified, requesting to disconnect any existing sessions, such as in a case of a broken connection.
— `man 1 virsh`

--force オプションをを付けると繋がり,一度繋がると --force 無しでも繋がるようになりました.

$ virsh console openbsd7.9 --force
Connected to domain 'openbsd7.9'
Escape character is ^] (Ctrl + ])
^]
$ virsh console openbsd7.9
Connected to domain 'openbsd7.9'
Escape character is ^] (Ctrl + ])

fugu$ pfetch
      _____       matoken@fugu.matoken.org
    \-     -/     os     OpenBSD 7.9
 \_/         \    host   pc-i440fx-9.1
 |        O O |   uptime 1h 56m
 |_  <   )  3 )   pkgs   117
 / \         /    memory 169M / 989M
    /-_____-\

fugu$

恐らく電池切れでホストのOSが強制終了したときに既存のセッション情報が残ってしまい今回のような状態になったのだと思います.

環境
$ dpkg-query -W libvirt-clients libvirt-daemon
libvirt-clients 12.3.0-1
libvirt-daemon  12.3.0-1
$ uname -rm
7.0.9+deb14-amd64 x86_64
$ lsb_release -dr
Description:    Debian GNU/Linux forky/sid
Release:        n/a
$ arch
x86_64
]]>
https://matoken.org/blog/2026/05/26/virsh-console-console-connection-failed/feed/ 0
外付けHDDのゴミ箱を有効にする https://matoken.org/blog/2026/05/06/enable-hdd-trash-can/ https://matoken.org/blog/2026/05/06/enable-hdd-trash-can/#respond Tue, 05 May 2026 21:12:52 +0000 https://matoken.org/blog/?p=5455

猫がキーボードの上を歩くことがよくあります.いつの間にかCapsLockとかNumLockとかが掛かってしまったりします.
その程度ならいいのですが,先日ファイラーが開いた状態でDel key を押されファイルが消えてしまいました.外付HDD でゴミ箱も設定していなかったのでゴミ箱からの復活もできません.

外付けHDDのゴミ箱を有効にしました.

freedesktop.orgに文章がありそうです.

It MAY also choose to provide trashing in the “top directories” of some or all mounted resources. This trashing is done in two ways, described below as (1) and (2).
(1) An administrator can create an $topdir/.Trash directory. The permissions on this directories should permit all users who can trash files at all to write in it.; and the “sticky bit” in the permissions must be set, if the file system supports it.
:
(2) If an $topdir/.Trash directory is absent, an $topdir/.Trash-$uid directory is to be used as the user’s trash directory for this device/partition. $uid is the user’s numeric identifier.
:

自分しか使わないので,HDDのrootに,.Trash-$uid というディレクトリを作っておけば良さそうです.

$ cd /run/media/matoken/6f12b6e0-e167-4afc-b30b-ad30c2c9f446 (1)
$ sudo install -d -m 700 -o "$(id -u)" -g "$(id -g)" ./.Trash-"$(id -u)" (2)
$ ls -A | grep .Trash-
.Trash-1000
$ id --user
1000
  1. 対象のHDDのtop dirに移動

  2. 自分用ゴミ箱ディレクトリを作成

この状態でファイラー(今回はPCManFM-Qt)でHDD内のファイルを削除するとゴミ箱に移動するようになりました.
これでまた猫にファイルが消されても復旧しやすくなりました🐈🐾

環境
$ dpkg-query -W pcmanfm-qt*
pcmanfm-qt	2.3.0-1
pcmanfm-qt-l10n	2.3.0-1
$ lsb_release -dr
Description:	Debian GNU/Linux forky/sid
Release:	n/a
$ arch
x86_64
]]>
https://matoken.org/blog/2026/05/06/enable-hdd-trash-can/feed/ 0
vnStatでトラフィックが計測できなくなっていた https://matoken.org/blog/2026/04/22/traffic-could-no-longer-be-measured-with-vnstat/ https://matoken.org/blog/2026/04/22/traffic-could-no-longer-be-measured-with-vnstat/#respond Tue, 21 Apr 2026 22:11:23 +0000 https://matoken.org/blog/?p=5442

しばらく前からvnStat というツールでネットワークトラフィックを計測してもらっていました.

ビデオミーティングの通信料を確認したりといったことに使っています.
しかし先日ビデオミーティング後に通信料を確認しようとしたらうまく行きません.

レンジを間違えたかなと思いましたがインターフェイス以外同じオプションで他の端末で実行すると出て来るのでレンジは正しそう.

$ vnstat -i enx349971e11a0f -b '2026-04-19 14:00' -e '2026-04-20 00:40' -h
No hourly data available for given date range.

-l でライブモードだとうまく動いていそうですが, -h-5 を叩くと動くけど古いデータしか出てきません.

$ vnstat -i enx349971e11a0f -h

 enx349971e11a0f  /  hourly

         hour        rx      |     tx      |    total    |   avg. rate
     ------------------------+-------------+-------------+---------------
     2026-04-04
         17:00    218.69 MiB |   18.13 MiB |  236.82 MiB |  551.83 kbit/s
         18:00      1.65 GiB |   72.64 MiB |    1.72 GiB |    4.11 Mbit/s
         19:00    756.85 MiB |   42.89 MiB |  799.74 MiB |    1.86 Mbit/s
         20:00    140.48 MiB |   12.13 MiB |  152.61 MiB |  355.61 kbit/s
         21:00      8.02 MiB |    3.54 MiB |   11.56 MiB |   26.93 kbit/s
         22:00      7.24 MiB |    3.89 MiB |   11.13 MiB |   25.93 kbit/s
         23:00      6.15 MiB |    3.66 MiB |    9.81 MiB |   22.85 kbit/s
     2026-04-05
         00:00      4.99 MiB |    3.47 MiB |    8.46 MiB |   19.71 kbit/s
         01:00      5.71 MiB |    3.51 MiB |    9.22 MiB |   21.49 kbit/s
         02:00      2.87 MiB |    3.32 MiB |    6.19 MiB |   14.42 kbit/s
         03:00     11.47 MiB |   22.75 MiB |   34.22 MiB |   79.74 kbit/s
         04:00    784.37 MiB |   39.35 MiB |  823.72 MiB |    1.92 Mbit/s
         05:00    626.25 MiB |   32.25 MiB |  658.50 MiB |    1.53 Mbit/s
         06:00     38.78 MiB |   11.54 MiB |   50.32 MiB |  117.26 kbit/s
         07:00     16.57 MiB |    4.71 MiB |   21.29 MiB |   49.60 kbit/s
         08:00     12.33 MiB |    4.39 MiB |   16.71 MiB |   38.95 kbit/s
         09:00     12.20 MiB |    4.78 MiB |   16.98 MiB |   39.56 kbit/s
         10:00    104.22 MiB |    6.25 MiB |  110.47 MiB |  257.41 kbit/s
         16:00     14.04 MiB |   10.51 MiB |   24.55 MiB |   57.20 kbit/s
         17:00     47.55 MiB |   10.81 MiB |   58.36 MiB |  135.99 kbit/s
         18:00     93.25 MiB |   13.96 MiB |  107.21 MiB |  249.82 kbit/s
         19:00    133.44 MiB |   19.54 MiB |  152.98 MiB |  356.47 kbit/s
         20:00     53.40 MiB |    6.77 MiB |   60.17 MiB |  140.21 kbit/s
         21:00      3.52 MiB |    1.28 MiB |    4.80 MiB |   11.19 kbit/s
     ------------------------+-------------+-------------+---------------

vnStat への登録インターフェイスを一旦削除して登録し直してみます.

$ sudo vnstat --remove -i enx349971e11a0f --force (1)
$ sudo vnstat --add -i enx349971e11a0f (2)
$ vnstat -5
No 5 minute data available.
  1. vnStat から enx349971e11a0f を削除

  2. enx349971e11a0f を追加し直し

数時間後確認してもデータが見えません…….

$ vnstat -5
No 5 minute data available.

よく見るとvnStat の結果の1行目に変な日付があります.

$ vnstat -i enx349971e11a0f
Database updated: 2026-05-05 08:08:00

   enx349971e11a0f since 2026-04-21

          rx:  0 B      tx:  0 B      total:  0 B

   monthly
                     rx      |     tx      |    total    |   avg. rate
     ------------------------+-------------+-------------+---------------
                                no data available
     ------------------------+-------------+-------------+---------------
     estimated       --      |     --      |     --      |

   daily
                     rx      |     tx      |    total    |   avg. rate
     ------------------------+-------------+-------------+---------------
                                no data available
     ------------------------+-------------+-------------+---------------
     estimated       --      |     --      |     --      |

db が未来の日付になっています.

Database updated: 2026-05-05 08:08:00

この端末はRTC のバックアップバッテリが死んでいるようでバッテリ切れで落ちると時計が飛んでしまいます.その次の起動時にUEFI で時計を合わせて起動して,システム起動後にntp で時計合わせしてもらっているのですが,恐らくそのときに5/5にしてしまいvnStat のdb がおかしくなったのかもしれません.

データベースがおかしそうなのでデータベースを作り直してみます.

$ sudo service vnstat stop (1)
$ sudo -u vnstat mv /var/lib/vnstat/vnstat.db /var/lib/vnstat/vnstat.db.bak (2)
$ sudo service vnstat start (3)
$ vnstat -i enx349971e11a0f (4)
 enx349971e11a0f: No data. Timestamp of last update is same 2026-04-22 05:37:54 as of database creation.
  1. vnStat を一旦停止

  2. データベースを退避

  3. vnStat を起動

しばらく後に確認するとこんな感じでちゃんと動き始めたようです.

$ vnstat -i enx349971e11a0f -h

 enx349971e11a0f  /  hourly

         hour        rx      |     tx      |    total    |   avg. rate
     ------------------------+-------------+-------------+---------------
     2026-04-22
         05:00     66.23 MiB |    9.14 MiB |   75.37 MiB |  175.62 kbit/s
         06:00     13.89 MiB |    4.69 MiB |   18.58 MiB |   86.61 kbit/s
     ------------------------+-------------+-------------+---------------
$ vnstat -i enx349971e11a0f -5

 enx349971e11a0f  /  5 minute

         time        rx      |     tx      |    total    |   avg. rate
     ------------------------+-------------+-------------+---------------
     2026-04-22
         05:35    201.93 KiB |  113.63 KiB |  315.56 KiB |    8.62 kbit/s
         05:40     10.26 MiB |    1.57 MiB |   11.84 MiB |  330.99 kbit/s
         05:45      7.15 MiB |    2.31 MiB |    9.46 MiB |  264.57 kbit/s
         05:50     38.63 MiB |    4.22 MiB |   42.85 MiB |    1.20 Mbit/s
         05:55      9.99 MiB |  949.36 KiB |   10.91 MiB |  305.14 kbit/s
         06:00      8.72 MiB |    1.32 MiB |   10.04 MiB |  280.77 kbit/s
         06:05      1.35 MiB |  858.75 KiB |    2.19 MiB |   61.13 kbit/s
         06:10    725.47 KiB |  429.95 KiB |    1.13 MiB |   31.55 kbit/s
         06:15    637.71 KiB |  431.47 KiB |    1.04 MiB |   29.20 kbit/s
         06:20      0.98 MiB |  989.68 KiB |    1.95 MiB |   54.39 kbit/s
         06:25      1.52 MiB |  736.79 KiB |    2.24 MiB |   62.61 kbit/s
     ------------------------+-------------+-------------+---------------

過去のデータは失われましたが,とりあえずまた計測できるようになりました.

またおかしくなる前に電池を交換したほうがいいかもしれません.

このようなcron を設定してみました.1日1回vnStat のdb をバックアップして古いバックアップを消そうとしています.

$ sudo -u vnstat crontab -l | grep vnstat
@daily  cp --backup=numbered /var/lib/vnstat/vnstat.db /var/lib/vnstat/vnstat.db.bak && find /var/lib/vnstat/ -name "vnstat.db.bak*" -ctime 14 -exec rm {} \;
環境
$ dpkg-query -W vnstat* cron
cron    3.0pl1-208
vnstat  2.13-1
vnstati 2.13-1
$ lsb_release -dr
Description:    Debian GNU/Linux forky/sid
Release:        n/a
$ arch
x86_64
]]>
https://matoken.org/blog/2026/04/22/traffic-could-no-longer-be-measured-with-vnstat/feed/ 0
ファイルマネージャーアプリのPCManFM-Qtのコンテキストメニューに画像変換Scriptを登録 https://matoken.org/blog/2026/04/03/pcmanfm-qt-action/ https://matoken.org/blog/2026/04/03/pcmanfm-qt-action/#respond Thu, 02 Apr 2026 21:22:49 +0000 https://matoken.org/blog/?p=5415
pcmanfm qt

最近デスクトップ環境でのファイルマネージャーアプリにPCManFM-Qt を使っています.以前はNautilus を使っていて,画像のフォーマット変換などにコンテキストメニューに変換script を登録して利用していました.PCManFM-Qt でも同様のことができないか試してみました.

Nautilus ではこんな感じで変換したい画像の上で右クリックしてコンテキストメニューの Scripts の中に画像変換Script を設定していました.

nautilus script01
nautilus script02

PCManFM-Qt ではこの設定は効かないので,LX-Image-Qt やImagemagick の convert コマンドなどで変換していましたが面倒.

PCManFM-Qt では ~/.local/share/file-manager/actions/ 以下にアクション定義の .desktop ファイルを置くことでコンテキストメニューに登録できるようです.

直に .desktop ファイルでもいいのですが,複数ファイル対応などもしたいのでShell Script を用意して,それを .desktop ファイルから呼ぶことにします.

先ずは適当な場所に変換Script を用意します.指定したファイルをImageMagick のconvert コマンドでwebp 形式に変換するものです.

~/bin/pcmanfm-convert2webp.sh
#!/bin/sh

for file in "$@"; do
  [ -f "$file" ] || continue
  out="${file%.*}.webp"
  convert "$file" "$out"
done

実行権を付与しておきます.

$ chmod u+x ~/bin/pcmanfm-convert2webp.sh

動作を確認します.大丈夫そうです.

$ ~/bin/pcmanfm-convert2webp.sh /home/matoken/Pictures/screenshots/2026-03-31_18:02:35-1365093-selected.png
$ ls -1 /home/matoken/Pictures/screenshots/2026-03-31_18:02:35-1365093-selected.*
/home/matoken/Pictures/screenshots/2026-03-31_18:02:35-1365093-selected.png
/home/matoken/Pictures/screenshots/2026-03-31_18:02:35-1365093-selected.webp

次に .desktop ファイルを用意します.このファイルは ~/.local/share/file-manager/actions/ に置く必要があります.
MimeTypes で画像の場合にこの .decktop が有効になるようにします.Exec に上のScript を書いて実行できるように.このとき複数ファイルの %F を渡します.

~/.local/share/file-manager/actions/convert2webp.desktop
[Desktop Entry]
Type=Action
Name=image2webp
Name[ja]=画像をwebpに変換
Profiles=convert;
Icon=application-default-icon

[X-Action-Profile convert]
MimeTypes=image/*;
Exec=/home/matoken/bin/pcmanfm-convert2webp.sh %F
Categories=Graphics;

この状態でPCmanFm-Qt を終了して新たに起動して画像の上で右クリックで convert2webp が実行できるようになりました.変換もok.画像以外のファイルの上で右クリックすると出てきません.

pcmanfm qt script

かなり便利になりました :)

環境
$ dpkg-query -W pcmanfm-qt imagemagick
imagemagick     8:7.1.2.18+dfsg1-1
pcmanfm-qt      2.3.0-1
$ lsb_release -dr
Description:    Debian GNU/Linux forky/sid
Release:        n/a
$ arch
x86_64
]]>
https://matoken.org/blog/2026/04/03/pcmanfm-qt-action/feed/ 0
Twitterで配信された動画アーカイブをダウンロード https://matoken.org/blog/2026/04/01/twitter-broadcast-download/ https://matoken.org/blog/2026/04/01/twitter-broadcast-download/#respond Tue, 31 Mar 2026 22:10:47 +0000 https://matoken.org/blog/?p=5405

Twitterで配信されたライブ動画のアーカイブをダウンロードしてみました.

とあるイベントがTwitter で配信されていたらしくYouTube にもあるのではと思ったけど見当たりません.Twitter にアーカイブが残っているのですが,なんか再生がすぐ止まるので辛い.
ということでダウンロードできないかなと検索するとX/Twitter Broadcast Downloader というものを見つけました.これでダウンロードしてみました.

venv 環境に導入して試す.
$ git clone https://github.com/offish/twitter-x-broadcast-downloader (1)
$ cd twitter-x-broadcast-downloader
$ python3 -m venv venv (2)
$ source venv/bin/activate (3)
$ pip install -r "requirements.txt" (4)
$ python main.py (5)
What is the broadcast URL? https://x.com/i/broadcasts/1qGvvkWeqdBGB (6)
Got media key 28_2038539604165640192
Got playback URL https://prod-fastly-ap-northeast-1.video.pscp.tv/Transcoding/v1/hls/PTdVIXd-pzzuOcGNlng6TG9haAxe5-rcN7QaIridcZbNbingfwGFrSiqe9DsliGqOpoLNO8lZ2Pk9a_owkY3aw/non_transcode/ap-northeast-1/periscope-replay-direct-prod-ap-northeast-1-public/master_dynamic_16671870457049479117.m3u8?type=replay
Downloading the broadcast as 28_2038539604165640192.mp4...
[generic] Extracting URL: https://prod-fastly-ap-northeast-1.video.pscp.tv/Transcoding/v1/hls/PTdVIXd-pzzuOcGNlng6TG9haAxe5...117.m3u8?type=replay
[generic] master_dynamic_16671870457049479117: Downloading webpage
[generic] master_dynamic_16671870457049479117: Downloading m3u8 information
[generic] master_dynamic_16671870457049479117: Checking m3u8 live status
[info] master_dynamic_16671870457049479117: Downloading 1 format(s): 5500
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 6385
[download] Destination: /home/matoken/src/twitter-x-broadcast-downloader/downloads/28_2038539604165640192.mp4
[download] 100% of    3.64GiB in 00:03:49 at 16.24MiB/s
[FixupM3u8] Fixing MPEG-TS in MP4 container of "/home/matoken/src/twitter-x-broadcast-downloader/downloads/28_2038539604165640192.mp4"


What is the broadcast URL? (7)
  1. source clone

  2. venv 環境を作る

  3. venv を有効に

  4. venv 環境にインストール

  5. X/Twitter Broadcast Downloader を実行

  6. ダウンロードしたいURL を渡す

  7. 次のダウンロードしたいURL 待ち

ダウンロードできました.

$ ls -lA downloads/
total 3722204
-rw-rw-r-- 1 matoken matoken 3811532277 Mar 31 18:03 28_2038539604165640192.mp4
-rw-rw-r-- 1 matoken matoken          0 Mar 31 17:57 .gitkeep
$ ffprobe downloads/28_2038539604165640192.mp4 2>&1 | grep -A 99 ^Input
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'downloads/28_2038539604165640192.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf61.7.100
  Duration: 03:35:23.76, start: 0.000000, bitrate: 2359 kb/s
  Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 1920x1080, 2187 kb/s, 30 fps, 30 tbr, 90k tbn (default)
      Metadata:
        handler_name    : VideoHandler
        vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 160 kb/s (default)
      Metadata:
        handler_name    : SoundHandler
        vendor_id       : [0][0][0][0]

以下余録.

リモートのVPS でダウンロードしたのですが結構大きいので小さくしてダウンロードします.

ffmpeg コマンドで動画を小さく
$ ffmpeg -i downloads/28_2038539604165640192.mp4 -vcodec libx264 -crf 33 -vf "scale=720:-2" -c:a copy downloads/28_2038539604165640192-720.mp4
$ ls -1s downloads/
total 4172176
 449972 28_2038539604165640192-720.mp4
3722204 28_2038539604165640192.mp4
動画の音声を取り出してWhisper.cpp で字幕作成
$ ffmpeg -i ~/Downloads/28_2038539604165640192-720.mp4 -ar 44100 -ac 1 -sample_fmt s16 -af silenceremove=1:0:-50dB  clawcon.wav
$ ./build/bin/whisper-cli -m ./models/ggml-large-v3-turbo.bin --output-srt --language auto -f ./clawcon.wav
$ ls -1s clawcon.wav*
1067548 clawcon.wav
    152 clawcon.wav.srt
$ head  clawcon.wav.srt
1
00:00:00,000 --> 00:00:06,660
Alright everyone, we'll be starting in 10 minutes. Please make your way to the stage area. We'll be starting in 10 minutes.

2
00:00:30,000 --> 00:00:59,980
 Thank you.

3
00:01:00,000 --> 00:01:29,980
ダウンロード環境
$ dpkg-query -W python3 python3-venv ffmpeg
ffmpeg  7:7.1.3-0+deb13u1
python3 3.13.5-1
python3-venv    3.13.5-1
$ lsb_release -dr
Description:    Debian GNU/Linux 13 (trixie)
Release:        13
$ arch
x86_64
動画編集,文字起こし環境
$ dpkg-query -W ffmpeg
ffmpeg  7:8.1-3+b1
a$ git remote -v
origin  https://github.com/ggerganov/whisper.cpp.git (fetch)
origin  https://github.com/ggerganov/whisper.cpp.git (push)
$ git log --pretty=oneline -1
95ea8f9bfb03a15db08a8989966fd1ae3361e20d (HEAD -> master, origin/master, origin/HEAD) sync : ggml
$ lsb_release -dr
Description:    Debian GNU/Linux forky/sid
Release:        n/a
$ arch
x86_64
]]>
https://matoken.org/blog/2026/04/01/twitter-broadcast-download/feed/ 0
FirefoxのAIチャットボットプロバイダーをDuck.aiに変更してみる https://matoken.org/blog/2026/03/31/firefox-duck-ai/ https://matoken.org/blog/2026/03/31/firefox-duck-ai/#respond Mon, 30 Mar 2026 21:15:21 +0000 https://matoken.org/blog/?p=5399

ウェブブラウザのFirefox 133 からサイドバーにAIチャットボットを利用できるようになっています.

チャットボットは複数から選択できますが,プリセットのもの以外の別のチャットボットを追加できないか確認してduck.ai を追加してみました.
Duck.ai はDuckDuckGo 経由でプライバシーをある程度保ったまま利用できるのが個人的に好きです.DuckDuckGo やDuck.ai はTor 経由でも利用できるのでいつもはそちらから使っています.

以下にduck.ai の追加の要望が出ていて,コメントにワークアラウンドの書かれたコメントがあるので真似してみます.

まず,設定から「AI 制御」→「サイドバーの AI チャットボットプロバイダー」から「サイドバーのチャットボット」を「利用可能」にしておきます.

firefox chatbot duck01

次にアドレスバーに about:config を入力して「高度な設定」を開きます.警告が表示されますが,「危険性を承知の上で使用する」を押して強行します.

firefox chatbot duck02

検索欄に browser.ml.chat.provider を入力,鉛筆アイコンをクリックしてテキストボックスに, https://duck.ai/ を入力してEnter を押して確定します.

firefox chatbot duck03

設定のチャットボットが https://duck.ai/ に変わりました.とりあえずこれでOK です.

firefox chatbot duck04
Tip

NoScript などの拡張機能でJavaScript を無効にしている場合,duck.ai のJavaScript を許可する必要があります.

firefox chatbot duck05

サイドバーの AI チャットボットを開くとこんな感じ,これを真に受けるならDuckDuckGo 経由で各チャットボットに接続して匿名を保ってくれるし,データの保持もローカルに,そしてチャット内容はAIトレーニングに利用されないとなっています.

firefox chatbot duck06

この記事を書いている時点で選択できるチャットモデルは,「GPT-5 mini」,「GPT-40 mini」,「gpt-oss120B」,「Llama 4 Scout」,「Claude Haiku 4.5」,「Mistral Small 3」の6つ.ここは偶に変わるようです.

firefox chatbot duck07

以下は記事の要約を行ったときの例です.

firefox chatbot duck08

ちなみにこの設定はチャットボットを変更したり無効にしたら消えてしまうので再度設定し直しが必要そうです.検索エンジンのように設定から任意の複数のチャットボットプロバイダーを追加できるようになるといいですね.

環境
$ dpkg-query -W firefox firefox-l10n-ja
firefox 149.0-1
firefox-l10n-ja 149.0-1
$ lsb_release -dr
Description:    Debian GNU/Linux forky/sid
Release:        n/a
$ arch
x86_64
]]>
https://matoken.org/blog/2026/03/31/firefox-duck-ai/feed/ 0
Firefox 149のタブノート機能とエクスポート方法 https://matoken.org/blog/2026/03/29/firefox-149_tabnote/ https://matoken.org/blog/2026/03/29/firefox-149_tabnote/#respond Sat, 28 Mar 2026 22:01:24 +0000 https://matoken.org/blog/?p=5381

MozillaのウェブブラウザのFirefox 149がリリースされました.新機能の一つのタブノートを少し試してみました.

タブノートを有効にする

タブノートを利用するには設定で有効にする必要があるようです.
右上の「≡」アイコン→「設定」で設定画面を開き,左側の「Firefox Labs」をクリック,「タブノート」にチェックで有効にできます.

Firefox149 tabnote setting

タブノートの利用

ノートを追加したい該当タブで右クリック→「ノートを追加」か,該当タブホバー→「ノートを追加」でタブノートが書けます.
編集,削除は右クリックから「ノートを更新」→「ノートを更新」 or 「ノートを削除」で行えます.
タブを閉じた後また開くとちゃんとメモは残っていました.

Firefox149 addnote1
Firefox149 addnote2
Firefox149 printnote

タブノートのエクスポート

タブノートを書き出してみます.
タイムスタンプを見ると,プロファイルディレクトリ以下の tabnotes.sqlite がそれっぽいです.以下のようにしてcsv で書き出しができました.

Firefox が実行中だとロックされているので適当な場所にコピー
$ cp ~/.mozilla/firefox/4q5mj0jg.default-release-2/tabnotes.sqlite /tmp/
id, URL, 能登とテキスト,作成日をcsv で書き出し
$ sqlite3 -readonly -header -csv /tmp/tabnotes.sqlite "SELECT id, canonical_url, note_text, datetime(created,'unixepoch','localtime') AS created FROM tabnotes ORDER BY created DESC;"
id,canonical_url,note_text,created
4,https://snac.matoken.org/matoken/admin,"個人用snac","2026-03-29 05:58:56"
3,https://codeberg.org/grunfink/snac2,"軽量ActivityPub server `snac' のリポジトリ","2026-03-27 19:52:19"
2,https://www.sony.jp/tablet/products/P1/specification.html,"2画面コンパクトAndroid タブレット","2026-03-27 19:48:17"
1,https://ja.wikipedia.org/wiki/%E6%96%B9%E9%89%9B%E9%89%B1,"方鉛鉱","2026-03-27 19:37:41"
Tip

Firefox のプロファイルについてはこちらを参考にしてください.

環境

$ dpkg-query -W firefox firefox-l10n-ja
firefox 149.0-1
firefox-l10n-ja 149.0-1
$ lsb_release -dr
Description:    Debian GNU/Linux forky/sid
Release:        n/a
$ arch
x86_64
]]>
https://matoken.org/blog/2026/03/29/firefox-149_tabnote/feed/ 0
Web上のActivityPub投稿をsnacで使いやすくするFirefox拡張機能のSnacWer https://matoken.org/blog/2026/03/13/firefox-extension-snapwer/ https://matoken.org/blog/2026/03/13/firefox-extension-snapwer/#respond Thu, 12 Mar 2026 21:45:02 +0000 https://matoken.org/blog/?p=5332

snac susie

軽量ActivityPub server のsnac用Firefox addon を知ったので試してみました.

このAddOn作者の方のtootをsnacの作者がboostしていたので知りました.

Hello #snac users. If you enjoy exploring the Fediverse via the web, you might find this #FirefoxExtension I created helpful. It lets you interact with almost any post more easily. It also works, of course, on Firefox derivates.

Feel free to take a look.

Webでsnacを利用しているときに便利になる拡張機能のようです.
早速導入してみます.

以下からFirefoxに拡張機能を登録します.

拡張機能の設定から自分のsnacアドレスを登録します.これで準備完了です.

snacwer00

試しに使ってみましょう.MastodonなどのActivityPubの公開投稿を開きます.すると,アドレスバーの右側にsnacのアイコンが表示されます.

snacwer01

snacのアイコンをクリックすると設定した自分のsnacでその投稿が開かれます.ここでLikeやBoostなどの操作ができます.URLをコピーしてsnacに持っていったりするより便利です :)

snacwer02

環境

SnacWer バージョン 1.0.1

$ dpkg-query -W firefox
firefox 148.0.2-1
$ lsb_release -dr
Description:    Debian GNU/Linux forky/sid
Release:        n/a
$ arch
x86_64
]]>
https://matoken.org/blog/2026/03/13/firefox-extension-snapwer/feed/ 0
dGPUがなくても動作する国立国会図書館のNDLOCR-Liteが公開されていたので試す https://matoken.org/blog/2026/03/02/ndlocr-lite/ https://matoken.org/blog/2026/03/02/ndlocr-lite/#respond Mon, 02 Mar 2026 14:15:44 +0000 https://matoken.org/blog/?p=5297

国立国会図書館がNDLラボでNDLOCR-Lite を公開しました.
元々NDLOCR が公開されていましたがCUDA 対応のNVIDIA GPU が必須でした.今回のNDLOCR-Lite はdGPU の無いPC でも動作するようなので試してみました.

NDLOCR-Liteは、NDLOCRの軽量版を目指して開発したOCRであり、ノートパソコン等の一般的な家庭用コンピュータやOS環境で、図書や雑誌といった資料のデジタル化画像からテキストデータが作成できるOCRです。

GPU(Graphics Processing Unit。画像描画等の高度な並列計算を処理する装置。)を必要とせず、軽量なOCR処理が可能です。

また、NDLOCRが不得意としていた英文や手書き文字等についても実験的に対応しています。

実際のリポジトリはこちら.

類似のものにNDL古典籍OCR-Lite というものもあります.これもdGPU の必要ないOCR で自分では読めない古典をOCR で読めるようになったりして面白いです.
以下は以前 #kagokug で発表した関連資料です.

  • NDLOCR 要NVIDIA GPU

    • NDL古典籍OCR-LiteのようにNDLOCR-Liteが出ないかな?

このときこんなことを書いていましたが実現しました :)

GUI版を試す

Windows版は以下に使い方があります.自分はLinux版を試しましたが起動後の操作は同じだと思います.

GitHub のReleases から最新のバイナリを入手します.v1.1.0 時点ではLinux amd64 / macOS arm64, amd64 / Windows(amd64?) が用意されているようです.ここではLinux版.

$ wget -c https://github.com/ndl-lab/ndlocr-lite/releases/download/1.1.0/ndlocr_lite_v1.1.0_linux.tar.gz (1)
$ sha512sum ndlocr_lite_v1.1.0_linux.tar.gz (2)
61faed1fc843266095852697bbf29a721db4fb5a054f6d66ae8850301d22a4b1e29535eed150e439f7fd35760a17790a39cf0d45afd7c0ed72e7a3928e47ed93  ndlocr_lite_v1.1.0_linux.tar.gz
$ fuse-archive ndlocr_lite_v1.1.0_linux.tar.gz (3)
$ file ndlocr_lite_v1.1.0_linux/linux/ndlocr_lite_gui (4)
ndlocr_lite_v1.1.0_linux/linux/ndlocr_lite_gui: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=55e769c1bfe893353a55cdddbe7066033dc540bf, for GNU/Linux 3.2.0, not stripped
$ ndlocr_lite_v1.1.0_linux/linux/ndlocr_lite_gui (5)
  1. バイナリアーカイブを入手

  2. hash

  3. fuse-archive でアドホックに展開

  4. ファイル形式を確認

  5. NDLOCR-Lite 実行

NDL古典籍OCR-Lite と同じように扱える感じです.画像ファイル,画像ファイルの格納されたディレクトリから一括処理などが可能です.
その他,画面の指定した範囲をキャプチャしてOCR するキャプチャモードも便利です.ただ,このモードのキャプチャはi3 wm では別のworkspace はキャプチャできなさそうで少し使い勝手が悪いです.

NDLOCR Lite gui01

Note
画像の出典:納谷友一 訳註『黒猫』,健文社,1952. 国立国会図書館デジタルコレクション https://dl.ndl.go.jp/pid/2436688

CLI版を使う

CLI版はPython 3.10+ が必要です.今回はDebian sid amd64 のパッケージで導入したPython 3.13.12 を利用しました.
README.md にはpip での導入と,uv での導入が紹介されています.頻繁に使う場合はuv の方がいいかもしれませんがお好みの方で.

pip でvenv 以下に導入した例
$ git clone https://github.com/ndl-lab/ndlocr-lite
$ cd ndlocr-lite
$ python -m venv venv
$ source venv/bin/activate
$ pip install -r requirements.txt
$ python3 src/ocr.py -h
usage: ocr.py [-h] [--sourcedir SOURCEDIR] [--sourceimg SOURCEIMG] --output OUTPUT [--viz VIZ] [--det-weights DET_WEIGHTS] [--det-classes DET_CLASSES] [--det-score-threshold DET_SCORE_THRESHOLD] [--det-conf-threshold DET_CONF_THRESHOLD]
              [--det-iou-threshold DET_IOU_THRESHOLD] [--simple-mode SIMPLE_MODE] [--rec-weights30 REC_WEIGHTS30] [--rec-weights50 REC_WEIGHTS50] [--rec-weights REC_WEIGHTS] [--rec-classes REC_CLASSES] [--device {cpu,cuda}]

Arguments for NDLkotenOCR-Lite

options:
  -h, --help            show this help message and exit
  --sourcedir SOURCEDIR
                        Path to image directory
  --sourceimg SOURCEIMG
                        Path to image directory
  --output OUTPUT       Path to output directory
  --viz VIZ             Save visualized image
  --det-weights DET_WEIGHTS
                        Path to deim onnx file
  --det-classes DET_CLASSES
                        Path to list of class in yaml file
  --det-score-threshold DET_SCORE_THRESHOLD
  --det-conf-threshold DET_CONF_THRESHOLD
  --det-iou-threshold DET_IOU_THRESHOLD
  --simple-mode SIMPLE_MODE
                        Read line with one model(Setting this option to True will slow down processing, but it simplifies the architecture and may slightly improve accuracy.)
  --rec-weights30 REC_WEIGHTS30
                        Path to parseq-tiny onnx file
  --rec-weights50 REC_WEIGHTS50
                        Path to parseq-tiny onnx file
  --rec-weights REC_WEIGHTS
                        Path to parseq-tiny onnx file
  --rec-classes REC_CLASSES
                        Path to list of class in yaml file
  --device {cpu,cuda}   Device use (cpu or cuda)
uv で導入した例
$ git clone https://github.com/ndl-lab/ndlocr-lite
$ cd ndlocr-lite
$ uv tool install .
$ which ndlocr-lite
/home/matoken/.local/bin/ndlocr-lite
$ ndlocr-lite --help
usage: ndlocr-lite [-h] [--sourcedir SOURCEDIR] [--sourceimg SOURCEIMG] --output OUTPUT [--viz VIZ] [--det-weights DET_WEIGHTS] [--det-classes DET_CLASSES] [--det-score-threshold DET_SCORE_THRESHOLD]
                   [--det-conf-threshold DET_CONF_THRESHOLD] [--det-iou-threshold DET_IOU_THRESHOLD] [--simple-mode SIMPLE_MODE] [--rec-weights30 REC_WEIGHTS30] [--rec-weights50 REC_WEIGHTS50] [--rec-weights REC_WEIGHTS]
                   [--rec-classes REC_CLASSES] [--device {cpu,cuda}]

Arguments for NDLkotenOCR-Lite

options:
  -h, --help            show this help message and exit
  --sourcedir SOURCEDIR
                        Path to image directory
  --sourceimg SOURCEIMG
                        Path to image directory
  --output OUTPUT       Path to output directory
  --viz VIZ             Save visualized image
  --det-weights DET_WEIGHTS
                        Path to deim onnx file
  --det-classes DET_CLASSES
                        Path to list of class in yaml file
  --det-score-threshold DET_SCORE_THRESHOLD
  --det-conf-threshold DET_CONF_THRESHOLD
  --det-iou-threshold DET_IOU_THRESHOLD
  --simple-mode SIMPLE_MODE
                        Read line with one model(Setting this option to True will slow down processing, but it simplifies the architecture and may slightly improve accuracy.)
  --rec-weights30 REC_WEIGHTS30
                        Path to parseq-tiny onnx file
  --rec-weights50 REC_WEIGHTS50
                        Path to parseq-tiny onnx file
  --rec-weights REC_WEIGHTS
                        Path to parseq-tiny onnx file
  --rec-classes REC_CLASSES
                        Path to list of class in yaml file
  --device {cpu,cuda}   Device use (cpu or cuda)

もしcuda 対応GPU のある環境であればコマンドラインオプションに --device cuda を渡すことで速くなると思います.

cli版実行例

--sourcedir (ディレクトリ内の複数画像)か --sourceimg (1つの画像ファイル)で処理対象ディレクトリか処理対象ファイルを指定, --output で結果の出力先を指定,--viz True で可視化画像を有効にして実行(オプション)

$ time ndlocr-lite --sourcedir . --output . --viz True
[INFO] Intialize Model
[INFO] Inference Image
69
[INFO] Saving result on ./viz_digidepo_2436688_0001-0.jpg
Total calculation time (Detection + Recognition): 13.220851182937622
  :
real    2m15.882s
user    10m16.273s
sys     0m5.189s
$ ls
digidepo_2436688_0001-0.jpg   digidepo_2436688_0001-4.json  digidepo_2436688_0001-8.txt
digidepo_2436688_0001-0.json  digidepo_2436688_0001-4.txt   digidepo_2436688_0001-8.xml
digidepo_2436688_0001-0.txt   digidepo_2436688_0001-4.xml   digidepo_2436688_0001-9.jpg
digidepo_2436688_0001-0.xml   digidepo_2436688_0001-5.jpg   digidepo_2436688_0001-9.json
digidepo_2436688_0001-1.jpg   digidepo_2436688_0001-5.json  digidepo_2436688_0001-9.txt
digidepo_2436688_0001-1.json  digidepo_2436688_0001-5.txt   digidepo_2436688_0001-9.xml
digidepo_2436688_0001-1.txt   digidepo_2436688_0001-5.xml   viz_digidepo_2436688_0001-0.jpg
digidepo_2436688_0001-1.xml   digidepo_2436688_0001-6.jpg   viz_digidepo_2436688_0001-1.jpg
digidepo_2436688_0001-2.jpg   digidepo_2436688_0001-6.json  viz_digidepo_2436688_0001-2.jpg
digidepo_2436688_0001-2.json  digidepo_2436688_0001-6.txt   viz_digidepo_2436688_0001-3.jpg
digidepo_2436688_0001-2.txt   digidepo_2436688_0001-6.xml   viz_digidepo_2436688_0001-4.jpg
digidepo_2436688_0001-2.xml   digidepo_2436688_0001-7.jpg   viz_digidepo_2436688_0001-5.jpg
digidepo_2436688_0001-3.jpg   digidepo_2436688_0001-7.json  viz_digidepo_2436688_0001-6.jpg
digidepo_2436688_0001-3.json  digidepo_2436688_0001-7.txt   viz_digidepo_2436688_0001-7.jpg
digidepo_2436688_0001-3.txt   digidepo_2436688_0001-7.xml   viz_digidepo_2436688_0001-8.jpg
digidepo_2436688_0001-3.xml   digidepo_2436688_0001-8.jpg   viz_digidepo_2436688_0001-9.jpg
digidepo_2436688_0001-4.jpg   digidepo_2436688_0001-8.json

ここでのファイル群は以下のようになっています.

digidepo_2436688_0001-“${N}”.jpg

OCR 対象画像

digidepo_2436688_0001-“${N}”.json, digidepo_2436688_0001-“${N}”.txt, digidepo_2436688_0001-“${N}”.xml

OCR 結果

viz_digidepo_2436688_0001-“${N}”.jpg

可視化画像(オプション)

国立国会図書館からダウンロードしたpdf の10コマ(20ページ分)をImagemagick でjpeg 画像に変換したものに対して実行したところ2分16秒ほど掛かりました.1画像あたり13.6秒,1ページあたり6.8秒ほど.英語日本語混じりでも精度良さそうです.
OCR 環境は,LENOVO ThinkPad L13 (G1), CPU: Intel® Core™ i7-10510U CPU @ 1.80GHz, RAM: DDR4 16GB, SSD: NVMe TOSHIBA KXG6AZNV512G にDebian sid amd64 を導入した環境です.

スキャンした画像データはこんな感じ(1コマ2ページ分)

$ file viz_digidepo_2436688_0001-0.jpg
viz_digidepo_2436688_0001-0.jpg: JPEG image data, JFIF standard 1.01, aspect ratio, density 1x1, segment length 16, baseline, precision 8, 2481x1761, components 3

GNU time の -f %M でRAM の利用量を見たところこの画像1枚の処理で600MB 近く,10枚で860MB 程でした.

NDLOCR Lite cli01

Note
画像の出典:納谷友一 訳註『黒猫』,健文社,1952. 国立国会図書館デジタルコレクション https://dl.ndl.go.jp/pid/2436688

Linuxデスクトップでキャプチャモード

NDLOCR-Lite GUI版にはキャプチャモードがあり便利そうですが,NDLOCR-Lite を起動しておく必要があります.
同じようなことを以前から tesseract-ocr でやっていました.これはデスクトップ環境に登録したショートカットでスクリーンキャプチャとOCR を行い,クリップボードに結果を返すものでした.これをNDLOCR-Lite で動くように書き換えてみました.

$ cat ~/bin/ndlocr-lite.bash
#!/bin/bash

TMPDIR=$(mktemp -d)
IMAGEFILE="$(mktemp).png"
import png:"${IMAGEFILE}" (1)
#sixelv "${IMAGEFILE}"
convert "${IMAGEFILE}" sixel: (2)
ndlocr-lite --sourceimg "${IMAGEFILE}" --output "${TMPDIR}" (3)

if [ $? ]; then
  cat "${TMPDIR}"/*.txt | pee cat "xsel -b" (4)
  notify-send 'ocr📋(primary)' (5)
else
  notify-send 'ocr error'
  exit 1
fi

rm "${IMAGEFILE}" (6)
rm -r "${TMPDIR}"
  1. Imagemagick のimport コマンドで任意の場所をキャプチャ

  2. デバッグ用に画像出力

  3. NDLOCR-Lite で文字起こし

  4. クリップボードに格納

  5. notify-send でデスクトップに通知

実行するとこんな感じ.動画内のスライドをキャプチャしています.解像度が低いといまいちですが解像度が高いといい感じです.termial で叩くとデバッグ用にSixel でキャプチャ画像も出すようにしました.

NDLOCR Lite bash

Note
画像の出典:オープンソースカンファレンス2026 Tokyo/Spring 2日目ライトニングトークのオープニングより https://www.youtube.com/watch?v=xtb3ZFb6WvA

このbash script をWindowManager に登録しておきます.以下はi3 wm で Super+Shift+o で呼び出せるようにしています.

~/.config/i3/config

$ grep ocr ~/.config/i3/config
#OCR https://gitlab.com/matoken/kagolug-2022.05/-/blob/main/slide/ocr.adoc
bindsym $mod+Shift+o exec --no-startup-id ~/bin/ndlocr-lite.bash

ということで便利に使えそうです.
国立国会図書館の遠隔送信サービスで閲覧可能な書籍などを小さなスマートフォンなどの端末で読むのはいまいちと思っていたのですが,これで文字起こしして読んでみるのもありかもしれません,

環境

$ git log --pretty=oneline -1
4f0748be4244a2e36d4dd43af05d6eebded3d56d (HEAD -> master, origin/master, origin/HEAD) Merge pull request #13 from mattn/fallback-line
$ pipx list | grep uv
   package uv 0.10.7, installed using Python 3.13.3
    - uv
    - uvx
$ dpkg-query -W python3 python3-venv
python3 3.13.9-3
python3-venv    3.13.9-3
$ lsb_release -dr
Description:    Debian GNU/Linux forky/sid
Release:        n/a
$ arch
x86_64
]]>
https://matoken.org/blog/2026/03/02/ndlocr-lite/feed/ 0
ChangeDetection.ioを更新したらプライベートIPを利用したURLがエラーになる https://matoken.org/blog/2026/02/25/changedetection-io/ https://matoken.org/blog/2026/02/25/changedetection-io/#respond Tue, 24 Feb 2026 22:19:29 +0000 https://matoken.org/blog/?p=5284

ChangeDetection.io を更新したらルーターのアドレスがエラーになってしまいました.

ChangeDetection.io ははてなアンテナのように登録サイトを定期的に巡回して更新を教えてくれるアプリケーションおよびサービスです.
自分はローカルPC に入れて動かしています.

#kagolug 2025.03 で発表したときの資料はこちら.

今回更新通知が来ていたので最新に更新しました.v0.54.1 になりました.

$ w3m -dump http://100.121.84.16:5000/ | grep ^v
v0.54.1

するとrouter の設定が以下のようなエラーになってログが取れなくなっています.

 > DISABLED
> Exception: Invalid URL 'DISABLED': No scheme supplied. Perhaps you meant https://DISABLED?
[Create a link to share watch config with others]

changedetection.io Invalid URL

Edit ボタンを押して編集画面に遷移すると問題なさそう.でも上書き保存しようとしたら怒られます.
エラーメッセージからはURL がおかしそうですが,このURL は普通に開けるしそもそもバージョンアップまでは動いていたものです.

* Watch protocol is not permitted or invalid URL format

changedetection.io edit invalid URL

なんかバグ踏んだ?前バージョンから今回までのdiff 見るか……と思ったのですが,SSRF 対策でプライベートIP が無効にされるようになったようです.

ALLOW_IANA_RESTRICTED_ADDRESSES=true で逃げられるようなので設定してみます.

docker-compose で運用しているので,docker-compose.yml を開き,changedetection 部分の environment:ALLOW_IANA_RESTRICTED_ADDRESSES=true を追加しました.そしてup することでプライベートIP アドレスのURL もまた動作するようになりました.

$ docker compose --file ~/src/changedetection.io/docker-compose.yml up -d

これこのアドレスだけ許可のような設定もできると良さそうですね.

環境

$ docker images ghcr.io/dgtlmoon/changedetection.io:latest
                                                                                                                                                                   i Info     U  In Use
IMAGE                                        ID             DISK USAGE   CONTENT SIZE   EXTRA
ghcr.io/dgtlmoon/changedetection.io:latest   cf4a98d2a980        889MB             0B    U
$ w3m http://127.0.0.1:5000/ | grep ^v
v0.54.1
$ dpkg-query -W docker.io docker-compose-plugin
docker-compose-plugin   5.1.0-1~debian.12~bookworm
docker.io       26.1.5+dfsg1-4+b1
$ lsb_release -dr
Description:    Debian GNU/Linux forky/sid
Release:        n/a
$ arch
x86_64
]]>
https://matoken.org/blog/2026/02/25/changedetection-io/feed/ 0
yt-dlpでYouTubeの字幕ファイルのダウンロードに失敗(HTTP Error 429: Too Many Requests) https://matoken.org/blog/2026/02/20/yt-dlp_subtitle_429error/ https://matoken.org/blog/2026/02/20/yt-dlp_subtitle_429error/#respond Thu, 19 Feb 2026 22:17:00 +0000 https://matoken.org/blog/?p=5258

Tokyo Linux Users Group のTechnical Meeting のビデオがYouTube にアップロードされていると先日の #kagolug で教えてもらったので観てみようと思いました.
でもTLUG は英語です.以前はWisper.cpp で文字起こし & 機械翻訳で字幕を作っていましたが最近のYouTube の文字起こしは大分良くなっているのでそれを使おうとローカルにビデオと字幕をdl しようとしたところ字幕のダウンロードに失敗しました.

適当な解像度のビデオとオーディオ,それと英語の文字起こし字幕と,それを日本語に翻訳したものをダウンロードしようとしました.

$ yt-dlp -f 244+251 yYgF87nqyKI --write-auto-subs --sub-langs ja,en_orig
[youtube] Extracting URL: yYgF87nqyKI
[youtube] yYgF87nqyKI: Downloading webpage
[youtube] yYgF87nqyKI: Downloading android vr player API JSON
[youtube] yYgF87nqyKI: Downloading web safari player API JSON
[youtube] yYgF87nqyKI: Downloading player 4c5cf06a-tv
[youtube] [jsc:deno] Solving JS challenges using deno
[youtube] yYgF87nqyKI: Downloading m3u8 information
[info] yYgF87nqyKI: Downloading subtitles: ja
[info] yYgF87nqyKI: Downloading 1 format(s): 244+251
[info] Writing video subtitles to: CDImage - Cam [yYgF87nqyKI].ja.vtt
WARNING: The extractor specified to use impersonation for this download, but no impersonate target is available. If you encounter errors, then see  https://github.com/yt-dlp/yt-dlp#impersonation  for information on installing the required dependencies
ERROR: Unable to download video subtitles for 'ja': HTTP Error 429: Too Many Requests

*Too Many Requests* とか言われてしまいました.今日初めて実行したのになんで?

--verbose オプションを付けてみましたがよくわかりません

[info] Writing video subtitles to: CDImage - Cam [yYgF87nqyKI].ja.vtt
[debug] Invoking http downloader on "https://www.youtube.com/api/timedtext?v=yYgF87nqyKI&ei=M4WXaZnECfax2roP_YqAqAc&caps=asr&opi=112496729&xoaf=5&xowf=1&xospf=1&hl=en&ip=0.0.0.0&ipbits=0&expire=1771562915&sparams=ip%2Cipbits%2Cexpire%2Cv%2Cei%2Ccaps%2Copi%2Cxoaf&signature=1B0AC6AA8FB20AFE9B45B2F66DBB1000F04DE626.909918AF43ACD2AFD3E0C2C61E53A3C72E49AB6C&key=yt8&kind=asr&lang=en&fmt=vtt&tlang=ja"
WARNING: The extractor specified to use impersonation for this download, but no impersonate target is available. If you encounter errors, then see  https://github.com/yt-dlp/yt-dlp#impersonation  for information on installing the required dependencies
ERROR: Unable to download video subtitles for 'ja': HTTP Error 429: Too Many Requests
Traceback (most recent call last):
  File "/home/matoken/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 4449, in _write_subtitles
    self.dl(sub_filename, sub_copy, subtitle=True)
    ~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/matoken/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 3285, in dl
    return fd.download(name, new_info, subtitle)
           ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/matoken/bin/yt-dlp/yt_dlp/downloader/common.py", line 480, in download
    ret = self.real_download(filename, info_dict)
  File "/home/matoken/bin/yt-dlp/yt_dlp/downloader/http.py", line 362, in real_download
    establish_connection()
    ~~~~~~~~~~~~~~~~~~~~^^
  File "/home/matoken/bin/yt-dlp/yt_dlp/downloader/http.py", line 119, in establish_connection
    ctx.data = self.ydl.urlopen(request)
               ~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/home/matoken/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 4260, in urlopen
    return self._request_director.send(req)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^
  File "/home/matoken/bin/yt-dlp/yt_dlp/networking/common.py", line 117, in send
    response = handler.send(request)
  File "/home/matoken/bin/yt-dlp/yt_dlp/networking/_helper.py", line 194, in wrapper
    return func(self, *args, **kwargs)
  File "/home/matoken/bin/yt-dlp/yt_dlp/networking/common.py", line 359, in send
    return self._send(request)
           ~~~~~~~~~~^^^^^^^^^
  File "/home/matoken/bin/yt-dlp/yt_dlp/networking/_requests.py", line 361, in _send
    raise HTTPError(res, redirect_loop=max_redirects_exceeded)
yt_dlp.networking.exceptions.HTTPError: HTTP Error 429: Too Many Requests

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/matoken/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 1698, in wrapper
    return func(self, *args, **kwargs)
  File "/home/matoken/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 1854, in __extract_info
    return self.process_ie_result(ie_result, download, extra_info)
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/matoken/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 1913, in process_ie_result
    ie_result = self.process_video_result(ie_result, download=download)
  File "/home/matoken/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 3096, in process_video_result
    self.process_info(new_info)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^
  File "/home/matoken/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 189, in wrapper
    return func(self, *args, **kwargs)
  File "/home/matoken/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 3353, in process_info
    sub_files = self._write_subtitles(info_dict, temp_filename)
  File "/home/matoken/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 4457, in _write_subtitles
    raise DownloadError(msg)
yt_dlp.utils.DownloadError: Unable to download video subtitles for 'ja': HTTP Error 429: Too Many Requests

ISSUES を探すと既知の問題のようでワークアラウンドがありました.

FreeTube is adding a PO token to their subtitles requests. But FreeTube doesn’t use auto-translated subs AFAICT.
# Manual subtitles and original language automatic captions are not affected by this HTTP Error 429 issue.

Only subtitles/captions that have been automatically translated into another language are affected. So you may be able to get the subs you want without a problem if you are precise with your --sub-langs and --write-subs vs --write-auto-subs arguments.

But if you want translated auto subs,
# there are 2 known ways of avoiding this HTTP Error 429:

  • Pass fresh cookies to yt-dlp from a browser session where you’ve very recently loaded auto-translated subs

  • Wait ~60 seconds after extraction and before downloading the auto subs, e.g. --sleep-subtitles 60

(Either of these 2 methods will work individually, you do not need to combine them)

ということでとりあえず --sleep-subtitles 60 を付けて実行することで字幕ダウンロード時にsleep して怒られずに字幕をダウンロードすることができました.

$ yt-dlp -f 244+251 yYgF87nqyKI --write-auto-subs --sub-langs ja,en_orig --sleep-subtitles 60

そしてmpv 等でこんな感じで字幕を2つ表示しながら視聴可能に :)

$ mpv --sub-files='CDImage - Cam [yYgF87nqyKI].en.vtt:CDImage - Cam [yYgF87nqyKI].ja.vtt' --secondary-sid=2 'CDImage - Cam [yYgF87nqyKI].webm'

mpv 2subs

環境
$ yt-dlp --version
2026.02.04
$ deno --version
deno 2.6.8 (stable, release, x86_64-unknown-linux-gnu)
v8 14.5.201.2-rusty
typescript 5.9.2
$ lsb_release -dr
Description:    Debian GNU/Linux forky/sid
Release:        n/a
$ arch
x86_64
]]>
https://matoken.org/blog/2026/02/20/yt-dlp_subtitle_429error/feed/ 0
Firefoxの指定タブを保護(ビデオミーティング離脱防止) https://matoken.org/blog/2026/02/16/firefox-lock-tab/ https://matoken.org/blog/2026/02/16/firefox-lock-tab/#respond Mon, 16 Feb 2026 10:03:27 +0000 https://matoken.org/blog/?p=5235

2683779 64

この土日ウェブブラウザでビデオミーティングに参加していました.1つはzoom.us, もう1つはGalene でした.
どちらも参加中に操作ミスでビデオミーティングのタブから移動してしまいビデオミーティングから離脱してしまいました.
タブを拡張機能で保護できないか試してみました.

はじめ試したのはこちらの「Tabloc」.text chat のリンクを押すと新しいタブで開かれるしこれでいいかと思ったのですが,右上のメニューの履歴から復元したら駄目です.

次に試したのは以下の「タブのページをロックする」.こちらだと履歴を復元しようとしあたりタブを中クリックで閉じようとすると「このページから移動しますか?入力した情報は保存されません。」というポップアップですぐには閉じなくなりました.

fx tablock02
fx tablock01

保護したタブには🔒アイコンが表示されます.

環境
タブのページをロックする: バージョン 1.2025.1227.0
$ dpkg-query -W firefox
firefox 147.0.3-1+b1
$ lsb_release -dr
Description:    Debian GNU/Linux forky/sid
Release:        n/a
$ arch
x86_64
]]>
https://matoken.org/blog/2026/02/16/firefox-lock-tab/feed/ 0
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
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
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
ターミナル特化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