matoken's blog https://matoken.org/blog Is there no plan B? Thu, 18 Dec 2025 11:28:15 +0000 ja hourly 1 https://wordpress.org/?v=6.9 https://matoken.org/blog/wp-content/uploads/2025/03/cropped-1865f695c4eecc844385acef2f078255036adccd42c254580ea3844543ab56d9-32x32.jpeg matoken's blog https://matoken.org/blog 32 32 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
snacのWelcome pageのhtmlファイルカスタマイズ https://matoken.org/blog/2025/12/13/snac-welcome-page/ https://matoken.org/blog/2025/12/13/snac-welcome-page/#respond Sat, 13 Dec 2025 09:43:34 +0000 https://matoken.org/blog/?p=4937

snac susie

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

ここに書かなかったsnac のことをいくつか書いていこうと思います.
今日はsnac でのWelcome page のhtml ファイルカスタマイズについて.

snac のtop page は以下のような挨拶ページが表示されます.このページをカスタマイズしてみます.

$ 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

このページは greeting.html を読み込んでいるようです.

greeting.html
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<link rel="icon" type="image/x-icon" href="https://%host%/favicon.ico"/>
<style>*{color-scheme:light dark}body{margin:auto;max-width:50em}</style>
<title>Welcome to %host%</title>
</head>
<body>
<p><b>%host%</b> is a <a href="https://en.wikipedia.org/wiki/Fediverse">Fediverse</a> instance that uses the <a href="https://en.wikipedia.org/wiki/ActivityPub">ActivityPub</a> protocol. In other words, users at this host can communicate with people that use software like Mastodon, Pleroma, Friendica, etc. all around the world.</p>
<p>This server runs the <a href="https://comam.es/what-is-snac">snac</a> software and there is no automatic sign-up process.</p>
<p>The following users are part of this community:</p>

%userlist%

<p>This site is powered by <abbr title="Social Networks Are Crap">snac</abbr>.</p>
</body></html>

例えば日本語にしたり,ユーザーリストを隠したりといったカスタマイズが出来ます.このhtml ファイルを保存した時点で反映されます.

$ w3m -dump https://snac.kagolug.org/
snac.kagolug.orgはActivityPubプロトコルを利用したFediverseインスタンスです.こ
のホストのユーザーは世界中のMastodon, Pleroma, Friendica, などのソフトウェアを
利用している人々とコミニュケーションを取ることが出来ます.

このサーバーはsnac ソフトウェアを利用しています.自動登録プロセスはありません.

以下のユーザーがこのコミュニティに参加しています:

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

This site is powered by snac.

snac greeting page ja

今回とりあえず日本語にしましたが,LUG の説明なども入れたいところです.

]]>
https://matoken.org/blog/2025/12/13/snac-welcome-page/feed/ 0
月の満ち欠けをTUIで表示するASCII Moon https://matoken.org/blog/2025/12/12/ascii_moon/ https://matoken.org/blog/2025/12/12/ascii_moon/#respond Fri, 12 Dec 2025 11:07:15 +0000 https://matoken.org/blog/?p=4923

asciimoon.com という月の満ち欠けがasciiart で表現されたサイトがあります.ただしJavaScriptが無いと満ち欠けは分からずw3m などでは今ひとつな感じでした.

ASCII Moon はそのsiteにインスパイアされた月の満ち欠けをTUI で表示するコマンドです.

ASCII Moon はReleases page にLinux/macOS/Windows のamd64 版のバイナリが置いてあります.
Linux armhf ではどうだろうと今回はsource からbuild しました.

$ git clone https://github.com/rockydd/ascii_moon.git
$ cd ascii_moon
$ cargo build --release
$ ./target/release/ascii_moon
$ ./target/release/ascii_moon --help
A TUI to show the moon phase

Usage: ascii_moon [OPTIONS]

Options:
  -d, --date <DATE>    Date in YYYY-MM-DD format (defaults to today)
      --lines <LINES>  Render the moon to a specific number of lines (non-interactive)
  -h, --help           Print help
  -V, --version        Print version
$ ./target/release/ascii_moon --version
ascii_moon 0.2.0

オプション無しでインタラクティブモード.
-d, --date <日付(YYY-MM-DD)> で特定の日付で起動.
--lines <行数> はscript やMOTD など向けで指定した行数で月のAsciiArt を出力します.
-d, --date--lines は一緒に指定できます.

ascii moon

インタラクティブモードではカーソル左右で1日単位で日付を操作できます.l key で地名のラベルのon/off,L key でラベルの言語変更,i key で下部の情報のon/off ができます.
インタラクティブモードの動作の状態は以下のasciinema で確認できます.

TUI でもこのAscii Moon, astroterm, tracker など面白い天文アプリが増えている感じがします.

環境
$ ./target/release/ascii_moon --version
ascii_moon 0.2.0
$ 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 build --release
$ lsb_release -dr
No LSB modules are available.
Description:    Raspbian GNU/Linux 12 (bookworm)
Release:        12
$ arch
armv7l
$ cat /sys/firmware/devicetree/base/model
Raspberry Pi 3 Model B Rev 1.2

View on Mastodon

]]>
https://matoken.org/blog/2025/12/12/ascii_moon/feed/ 0
Debian 13 trixieでbackportsを使い最新のsnacを利用 https://matoken.org/blog/2025/12/11/latest-snac-using-debian-backports/ https://matoken.org/blog/2025/12/11/latest-snac-using-debian-backports/#respond Thu, 11 Dec 2025 09:35:57 +0000 https://matoken.org/blog/?p=4909

snac susie

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

ここに書かなかったsnac のことをいくつか書いていこうと思います.
今日はDebian trixie backports のsnac パッケージを使うよう設定してみます.

Debian でのsnac2 パッケージのバージョン

snac2 はDebian パッケージになっています.しかし,stable のDebian 13 trixie のsnac2 パッケージのバージョンは 2.75-2 で少し古いバージョンです.
stable-backports のパッケージのバージョンは現在の上流の最新と同じ 2.85 なのでこれを利用してみます.

$ rmadison snac2| grep -v debug
snac2      | 2.75-2~bpo12+1 | oldstable-backports       | source, amd64, arm64, armel, armhf, i386, mips64el, mipsel, ppc64el, s390x
snac2      | 2.75-2         | stable                    | source, amd64, arm64, armel, armhf, i386, ppc64el, riscv64, s390x
snac2      | 2.84-3~bpo13+1 | stable-backports          | source, riscv64
snac2      | 2.85-1~bpo13+1 | stable-backports          | source, amd64, arm64, armel, armhf, i386, ppc64el, s390x
snac2      | 2.85-1         | testing                   | source, amd64, arm64, armhf, i386, ppc64el, riscv64, s390x
snac2      | 2.85-1         | unstable                  | source, amd64, arm64, armhf, i386, ppc64el, riscv64, s390x

Debian 13 trixie に backports を設定

Debian backports はDebian stable で一部のtesting パッケージを利用できるよう調整されたもので対応したパッケージであればstable より新しいバージョンが利用できます.

これを利用するためにはbackports 情報を sources.list に追加する必要があります.
ここでは公式ドキュメントと同じ /etc/apt/sources.list.d/debian-backports.sources としてファイルを作成しました.

/etc/apt/sources.list.d/debian-backports.sources を作成
Types: deb deb-src
URIs: http://deb.debian.org/debian
Suites: trixie-backports
Components: main
Enabled: yes
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg

続いてパッケージ情報をbackports を含む最新状態にします.

パッケージ情報更新
$ sudo apt update

backports の snac を導入

backpots のパッケージは通常のインストールでは導入されません.backports のパッケージを導入するにはパッケージ名に /trixie-backports を付けて導入します.

$ sudo apt install snac2/trixie-backports

もしくは -t trixie-backports を付けて導入すると不足した依存関係も導入されるようです.

$ sudo apt install -t trixie-backports snac2
$ dpkg-query -W snac2
snac2   2.85-1~bpo13+1
$ snac version
snac 2.85 - A simple, minimalistic ActivityPub instance
Copyright (c) 2022 - 2025 grunfink et al. / MIT license

upgrade {basedir}                    Upgrade to a new version

導入されたbackports パッケージは通常と同じ優先度100に固定されるので導入後はいつもの apt upgrade でbackports パッケージも更新されます.つまり通常の運用で大丈夫です.

snac アップグレード操作

snac のバージョンアップ時にディスク構成が変わることがあり,その場合snac が起動しないようです.その場合snac の upgrade コマンドを実行する必要があるようです.
自分は念の為毎回実行しています.

snac(8)より
Upgrading to a new version
    Sometimes, the data storage disk layout changes between versions. If there is such a change, snac will refuse to run and require an upgrade. Do this by running
snac upgrade $HOME/snac-data
Take special care to execute this upgrade operation without any snac processes serving on the same folder. You can break everything. I know this because Tyler knows this.
$ snac | grep upgrade
upgrade {basedir}                    Upgrade to a new version

upgrade コマンドはデーモンが起動していない状態で実行する必要があるので一旦snac を停止してから実行,その後snac を起動します.

$ sudo service snac2 stop (1)
$ sudo -u debian-snac snac upgrade /var/lib/snac2/ (2)
19:45:50 Linux sandbox not compiled in
19:45:50 OK
$ sudo service snac2 start (3)
$ w3m -dump https://snac.kagolug.org/info | tail -1 (4)
about this site - powered by snac/2.83
  1. snac 停止

  2. snac upgrade

  3. snac 起動

  4. バージョン確認

という感じでDebian stable でも最新のsnac が利用できています.一旦設定すると通常のDebian パッケージ更新操作で追従してくれるので運用もいつもと変わりません.更新タイミングも公式と見比べると結構すぐ対応してくれているようです.

]]>
https://matoken.org/blog/2025/12/11/latest-snac-using-debian-backports/feed/ 0
snac でカスタム絵文字を利用 https://matoken.org/blog/2025/12/10/snac-emoji/ https://matoken.org/blog/2025/12/10/snac-emoji/#respond Wed, 10 Dec 2025 10:09:41 +0000 https://matoken.org/blog/?p=4889

snac susie

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

ここに書かなかったsnac のことをいくつか書いていこうと思います.
今日はカスタム絵文字について.

ActivityPub 各インスタンスでよく使われているカスタム絵文字というものがあります.misskey.io なんかでは特に多用されているようです.
snac もカスタム絵文字に対応しています.

既定値で設定されているものとして例えばtoot 本文中に :-) と入力することで「🙂」が, :beer: と入力することで「🍺」が表示されます.他に :shrug2: で「¯\_(ツ)_/¯」なんでものも.でもこのあたりのUnicode絵文字などは日本語入力環境があるとあまり有り難みは感じなそうです.でも画像ファイルも利用できます.

自分で用意した絵文字を追加してみましょう.

カスタム絵文字を追加するにはsnac のデータディレクトリにある emojis.json を編集することでカスタマイズできます.

emojis.json の既定値はこんな感じです.
toot 本文中に記述するkey と,実際に評される値の組み合わせです.key は保管性を保つために : で囲むことが推奨されています.値は以下では数値文字参照及び文字列ですが,URL を指定することも出来ます.

{
    ":-)": "&#128578;",
    ":-D": "&#128512;",
    "X-D": "&#128518;",
    ";-)": "&#128521;",
    "B-)": "&#128526;",
    ">:-(": "&#128545;",
    ":-(": "&#128542;",
    ":-*": "&#128536;",
    ":-/": "&#128533;",
    "8-o": "&#128562;",
    "%-)": "&#129322;",
    ":_(": "&#128546;",
    ":-|": "&#128528;",
    "<3": "&#10084;&#65039;",
    ":facepalm:": "&#129318;",
    ":shrug:": "&#129335;",
    ":shrug2:": "&#175;\\_(&#12484;)_/&#175;",
    ":eyeroll:": "&#128580;",
    ":beer:": "&#127866;",
    ":beers:": "&#127867;",
    ":munch:": "&#128561;",
    ":thumb:": "&#128077;"
}

ここにsnac デフォルトアイコンを追加してみます.snac のベースurl の下の /susie.png (kagolug では https://snac.kagolug.org/susie.png )にアクセスするとsnac デフォルトアイコンのsusie が表示されます.これを利用してみます.

emojis.json を以下のように書き換えます.

     ":beer:": "&#127866;",
     ":beers:": "&#127867;",
     ":munch:": "&#128561;",
-    ":thumb:": "&#128077;"
+    ":thumb:": "&#128077;",
+    ":susie:": "https://snac.kagolug.org/susie.png"
 }
Tip

emojis.json は保存した時点で内容が反映されます.中途半端な状態で保存すると全てのカスタム絵文字が利用できなくなったりするので注意しましょう.

これで :susie: と入力することで snac susie が表示されるようになります.

更にペンギンのTux とタスマニアデビルのTuz を追加してみます.
アイコンの画像ファイルを用意し,静的環境に設置,そのurl をemojis.json ファイルに記述します.
今回以下のようになりました.

     ":beer:": "&#127866;",
     ":beers:": "&#127867;",
     ":munch:": "&#128561;",
-    ":thumb:": "&#128077;"
+    ":thumb:": "&#128077;",
+    ":susie:": "https://snac.kagolug.org/susie.png",
+    ":tux:": "https://www.kagolug.org/snac-emoji/Tux.png",
+    ":tuz:": "https://www.kagolug.org/snac-emoji/Tuz.png"
 }

これで :susie:, :tux:, :tuz: の3つの絵文字が利用できるようになりました.
toot して確認できます.
もしくは以下のようなサイトでMastodon カスタム絵文字API経由で絵文字一覧を確認することも出来ます.

snac emojos.in ]

snac のカスタム絵文字についての詳細はsnac(8) を参照してください.

Custom Emojis
    From version 2.51, support for customized Emojis in posts is available (previously, they were hardcoded). Emojis are read from the emojis.json file in the instance base directory, as a JSON object of key / value pairs (if this file
    does not exist, it will be created with the predefined set). Each key in the object contains the text to be found (e.g., the :-) for a smiling face), and its associated value, the text string that will replace it (in  this  example
    case, the HTML entity for the Unicode codepoint for the smiley or the Emoji itself as text).
Emoji values can also be URLs to image files; in this case, they will not be substituted in the post content, but added to the 'tag' array as an ActivityPub standard 'Emoji' object (it's recommendable that the Emoji key be enclosed
in colons for maximum compatibility with other ActivityPub implementations, like e.g. :happydoggo:). These images can be served from an external source or from the static directory of the instance admin.
If you want to disable any Emoji substitution, change the file to contain just an empty JSON object ({}).
]]>
https://matoken.org/blog/2025/12/10/snac-emoji/feed/ 0
さくらインターネットのさくらのナレッジにsnacの記事を寄稿 https://matoken.org/blog/2025/12/09/sakura-knowledge/ https://matoken.org/blog/2025/12/09/sakura-knowledge/#comments Tue, 09 Dec 2025 10:49:03 +0000 https://matoken.org/blog/?p=4863

5 1 mark rgb whiteback

さくらインターネットのさくらのナレッジにsnacの記事を寄稿しました.

鹿児島らぐというLinux User GroupのVPSをさくらインターネットさんにコミニュティ支援として提供していただいています.この縁でさくらのナレッジに記事を寄稿することになりました.
今回の内容は軽量なActivityPub Server のsnac を設定したときの記録をまとめたものです.
元は鹿児島Linux勉強会 2025.10 で発表したものを元にしたものです.

興味があれば読んでもらえると嬉しいです.

]]>
https://matoken.org/blog/2025/12/09/sakura-knowledge/feed/ 7
鹿児島Linux勉強会 2025.11に参加 https://matoken.org/blog/2025/12/08/kagolug-2025-11/ https://matoken.org/blog/2025/12/08/kagolug-2025-11/#respond Mon, 08 Dec 2025 14:56:33 +0000 https://matoken.org/blog/?p=4854

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

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

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

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

第一弾の先月の資料はこちら.

最近自宅で圏内になるSoftBank回線の基地局の機材が変わったのか設定が変わったかで上り下りの速度が非対称になり下りは早くなりましたが,上りがとても細くなりビデオミーティングに接続してもすぐ切れてしまう状態に.ということで少し標高が高くdocomo/au の電波が入る裏山から参加しました.まだ多少蚊が出るので蚊帳を被ってポータブルバッテリーから給電しつつの参加.
雨やこれから寒くなることを考えるとどうにかしたいところ…….

kagolug2025.11 01

イベントは18:00迄ですが,その後は懇親会というか雑談タイムです.今回は一旦時間を開けて19:00より開始,最終的には24:00を過ぎていました…….
自分は自動車で道の駅まで行って自動車内から参加しました.自動車の椅子は腰に悪い感じがしますね.
自動車のハンドルに引っ掛けるテーブルを100円ショップで入手したので今回これも試してみましたが100円だけあって打鍵時に揺れてちょっと使いづらい.クッションテーブルがいいのではと教えてもらったので次回までに考えておこうと思います.

kagolug2025.11 02

鹿児島Linux勉強会次回は12/21(日)の予定です.

]]>
https://matoken.org/blog/2025/12/08/kagolug-2025-11/feed/ 0
コマンドラインシステム観察,情報表示,ベンチマークツールのsot https://matoken.org/blog/2025/12/08/sot/ https://matoken.org/blog/2025/12/08/sot/#respond Sun, 07 Dec 2025 15:02:11 +0000 https://matoken.org/blog/?p=4819

sot logo

top みたいなシステム観察の他にscreenfetch のようなシステム情報,更にベンチマーク機能のあるsot というツールを試してみました.

sot 導入

sot はいくつかの導入方法があります. curl | bash が最初にお勧めとして紹介されていますが個人的にこれは好きではないのでuv で導入しました.

$ uv tool install sot
$ which sot
/home/matoken/.local/bin/sot
$ sot --version
╭──────────────────── System Observation Tool ────────────────────╮
│                                                                 │
│        ▄▀▀  ▄▀▀▄  ▀█▀                                           │
│        ▀▀▄  █  █   █                                            │
│        ▄▄▀  ▀▄▄▀   █                                            │
│                                                                 │
│  System Observation Tool                                        │
│                                                                 │
╰─────────────────────────────────────────────────────────────────╯

╭──────────────────── 📋 Version Information ─────────────────────╮
│                                                                 │
│   Version:      5.0.0                                           │
│   Python:       3.13.11                                         │
│   Platform:     Linux (Debian GNU/Linux n/a)                    │
│   Architectur…  x86_64                                          │
│                                                                 │
╰─────────────────────────────────────────────────────────────────╯

╭─────────────────────────────────────────────────────────────────╮
│  MIT License © 2024-2025 Kumar Anirudha                         │
│  🔗 https://github.com/anistark/sot | 📖 sot --help | 🚀 sot    │
╰─────────────────────────────────────────────────────────────────╯

sot version

Note

sot 4.4.2 で試したときはuv 及びpipx での導入時にシステム情報表示機能の info option や
benchmark 機能の bench option が出てこず使えませんでした.source から導入したらok.

sot: error: unrecognized arguments: info
sot: error: unrecognized arguments: bench

sot 実行

まずはオプション無しでsot 実行.top のような動きです.
o key で並べ替えモードになり矢印キーで設定,Enter で総巡航順変更, q で並べ替えモードから抜けます.
Ctrl+q で終了です.
カラフルで楽しいです.

sot top

sot システム情報表示(info)

次にシステム情報表示の info オプションを試します.

$ sot info
       _,met$$$$$gg.            Host        -  matoken@tp-l13
    ,g$$$$$$$$$$$$$$$P.
  ,g$$P"     """Y$$."`.         OS          -  Debian GNU/Linux n/a
 ,$$P'              `$$$.       Kernel      -  6.17.10+deb14-amd64
',$$P       ,ggs.     `$$b:     DE          -  i3
`d$$'     ,$P"'   .    $$$      WM          -  x11
 $$P      d$'     ,    $$P      Shell       -  bash
 $$:      $$.   -    ,d$$'      Terminal    -  xterm-kitty
 $$;      Y$b._   _,d$P'
 Y$$.    `.`"Y$$$$P"'           Memory      -  9 GiB / 15 GiB
 `$$b      "-.__
  `Y$$
   `Y$$.                        Uptime      -  8h 53m
     `$$b.                      Battery     -  100% & Discharging
       `Y$$b.

Battery があるのは珍しいですね.でも値は間違っていそう?
logoの種類は以下の通り.少し少なめ.

macOS: Apple logo

Linux Distributions:

Ubuntu
Debian
Fedora
Red Hat / RHEL
Arch Linux
Manjaro
Pop!_OS
CentOS
Generic Linux/Tux (fallback)

Windows: Windows logo

sot ベンチマーク(bench)

次にベンチマークの bench オプション.
実行時にシステム内のディスクが表示されるのでベンチ対象をカーソルで選択しベンチマークを実行します.

Use arrow keys (↑↓) to navigate, Enter to select, or 'q' to quit:

  ❯ 0: System - 450.9 GiB total, 4.6 GiB free
    1: efi - 511.0 MiB total, 501.9 MiB free
    2: boot - 455.1 MiB total, 338.7 MiB free
    3: 068d2d0a-235d-4c86-839e-4d37081979a2 - 457.4 GiB total, 197.5 MiB free

✓ Selected: System
  Using partition: /dev/mapper/tp--l13--vg-root (/)

Running benchmarks on System...

Per-benchmark duration: 10.0s

Benchmarking... ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 00:01:31.39


╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────── System ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────│ Disk ID: /dev/mapper/tp--l13--vg-root (System)                                                                                                                                                                                              │
│ Total Capacity: 450.9 GiB                                                                                                                                                                                                                   │
│ Free Space: 4.6 GiB                                                                                                                                                                                                                         │
│ Cache Directory: /home/matoken/.sot/bench                                                                                                                                                                                                   │
│                                                                                                                                                                                                                                             │
│ Partitions:                                                                                                                                                                                                                                 │
│   • /dev/mapper/tp--l13--vg-root → /                                                                                                                                                                                                       │   • /dev/mapper/tp--l13--vg-root → /run/schroot/mount/bookworm-i386-53c15ea2-b9a4-4693-b02b-be7786ca929f                                                                                                                                   │   • /dev/mapper/tp--l13--vg-root → /run/schroot/mount/bookworm-i386-53c15ea2-b9a4-4693-b02b-be7786ca929f/home                                                                                                                              ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────                                     Benchmark Results
┏━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━┓
┃ Test              ┃ Throughput/IOPS ┃ Avg Latency ┃ p95 Latency ┃ p99 Latency ┃ Duration ┃
┡━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━┩
│ Sequential Read   │ 245.9 MB/s      │ 4.06 ms     │ 11.76 ms    │ 24.01 ms    │ 10.00 s  │
│ Sequential Write  │ 177.7 MB/s      │ 5.59 ms     │ 9.13 ms     │ 12.46 ms    │ 10.00 s  │
│ Random Read IOPS  │ 40.61 KIO/s     │ 20.43 µs    │ 107.53 µs   │ 211.48 µs   │ 10.00 s  │
│ Random Write IOPS │ 834.60 IO/s     │ 1.18 ms     │ 2.59 ms     │ 5.12 ms     │ 10.00 s  │
└───────────────────┴─────────────────┴─────────────┴─────────────┴─────────────┴──────────┘

✓ Benchmarking completed successfully

簡易的なベンチに良さそうです.

sot ディスク情報(disk)

もう一つdisk オプション.これは最近追加されたオプションのようでディスク情報をインタラクティブに表示するもののようです.
カーソルでディスクを選択してEnter で情報が見れます.

$ sot disk

sot disk

]]>
https://matoken.org/blog/2025/12/08/sot/feed/ 0
スマホを使って手軽にMapillary とKartaView に写真アップロード https://matoken.org/blog/2025/12/06/mapillary-and-kartaview/ https://matoken.org/blog/2025/12/06/mapillary-and-kartaview/#respond Sat, 06 Dec 2025 10:47:35 +0000 https://matoken.org/blog/?p=4807

しばらく前から月に1〜4回位の頻度で歯医者に通っています.いつもは暗い時間帯に移動するので明るい時間に移動するのが新鮮.ということで久々にMapillary をやってみようと思い立ちました.

Mapillary はジオタグ付きの写真を共有しいぇGoogle オープンストリートマップのようなものをみんなでつくるようなものです.Mapillary にUp されたデータはCC-BY-SA-4.0 のもとで利用することが出来ます.また,OpenStreetMap に投稿するために写真からデータを取り出すためには特別な許可を得ているのでOpenStreetMap のマッピングにも利用できます.

以前はアクションカム+GPSロガーなんかを使っていましたが壊れて久しいです.とりあえずサブで医療している少し古いAndroidスマートフォン+Mapillary アプリを利用することに.画質や画角はいまいちな感じがしますが,自分の行動圏内を見るとほぼ真っ白なので何もないよりはましだろうと思っています.

Mapillary アプリを久々に起動すると認証に失敗します.タイミングが悪かったかなと思い時間をずらして何度か試しましたが数週間してもだめです.

mapillary login fail

アプリストアのレビューを見てみようと思いアクセスすると,アプリ名の後ろに「discontinued」 と付いています.え,と思いMapillary のsite からアクセスすると app.mapillary → com.mapillary.app と違うアプリになっています.

この新しい方のアプリを導入することで認証も成功し,ログインできるようになりました.アイコンも微妙に変わっています.

mapillary icons

ということでMapillary アプリが利用できるようになったので自動車のダッシュボードに置いて撮影してみました.
撮影時はこんな感じ.

View on Mastodon

自動車のシガーソケットからUSBに変換したものからケーブルを引っ張って給電しつつダイソーのスマホスタンドにスマートフォンを立てかけてMapillary アプリで撮影しています.
この状態だとカーブでずれるので現在は滑り止めを敷いています.

これで少し早めに家を出て少し回り道をしつつ移動してみています.

帰宅後アップロードを試みますが1枚もアップロードできません.

mapillary upload fail

これは回線の問題(楽天モバイルauローミングエリアの端っこ)のようでモバイルルーターを都会に持ち出してそこでアップロードを試みることでアップロードできました.

アップロード後しばらくしてからMapillary にアクセスすると反映されています.

というような話を鹿児島Linux勉強会 2025.11(オンライン開催)終了後の雑談時に話していたら「(Mapillary は)META 参加なのですね」といわれ確認すると2020年6月にFacebook(現META)へ売却されていました.

そういえば類似サービスのOpenStreetCam は?と確認すると旧OpenStreetCam およびOpenStreetView はKartaView というサービスになっているようです.
KartaView もアップロードされたデータはCC-BY-SA-4.0 になるようです.

KartaView を少し確認すると,BETA ですが,KartaView からMapillary への連携機能があるようです.これを有効にするとKartaView にアップロードした写真がMapillary にアップロードされます.KartaView にアップロードするだけで両方にUp できるので良さそうです.
リンク手順はログインしてユーザページに入ることで可能です.

kartaview mapillary link

KartaView にもiOS/Android アプリがあります.Mapillary に無い機能としてOBD2 連携機能ああります.トンネルなどのGNSS 電波の届かない,弱い場所でOBD2 のデータで補強して制度を上げることができるようです.
恐らくさいきんの自動車であれば以下のようなものを取り付けることで制度が上がると思います編み確認です.自分は切り通しや木々で囲まれた道路をよく通りGNSS 電波を見失うことがよくあるので試してみたいところです.

Amazon JP を眺めると日本で適法で利用できそうなものはこの辺でしょうか.¥3,132 税込.

ということでこれからはKartaView アプリを利用することにしました.

Note

今日はState of the Map Japan 2025 開催日ということで少し関連しそうな記事にしてみました.後で動画を視聴したいところ.

]]>
https://matoken.org/blog/2025/12/06/mapillary-and-kartaview/feed/ 0
pdfファイルを直接grepできるpdfgrep https://matoken.org/blog/2025/12/05/pdfgrep/ https://matoken.org/blog/2025/12/05/pdfgrep/#respond Fri, 05 Dec 2025 11:27:51 +0000 https://matoken.org/blog/?p=4794

Terminal Trove でpdfgrep というツールを知ったので試してみました.

pdfgrep はpdf ファイルをgrep と同様パターンにマッチする行を表示してくれるものです.オプションは GNU grep をある程度踏襲しています.

Debian sid 環境でsource からbuild する例
$ sudo apt install libgcrypt20-dev libpoppler-cpp-dev
$ git clone https://gitlab.com/pdfgrep/pdfgrep
$ cd pdfgrep
$ ./autogen.sh
$ ./configure --prefix=$HOME/usr/local
$ make
$ make install
help
$ pdfgrep --help
Usage: ./src/pdfgrep [OPTION]... PATTERN FILE...

Search for PATTERN in each FILE.
PATTERN is, by default, an extended regular expression.

Commonly used options:
 -i, --ignore-case              Ignore case distinctions
 -P, --perl-regexp              Use Perl compatible regular expressions (PCRE)
 -H, --with-filename            Print the file name for each match
 -h, --no-filename              Suppress the prefixing of file name on output
 -n, --page-number              Print page number with output lines
 -c, --count                    Print only a count of matches per file
     --color WHEN               Use colors for highlighting;
                                WHEN can be `always', `never' or `auto'
 -p, --page-count               Print only a count of matches per page
 -m, --max-count NUM            Stop reading after NUM matching lines (per file)
 -q, --quiet                    Suppress normal output
 -r, --recursive                Search directories recursively
 -R, --dereference-recursive    Likewise, but follow all symlinks
     --cache                    Use cache for faster operation
     --help                     Print this help
 -V, --version                  Show version information

The above list is only a selection of commonly used options. Please refer
to the man page for a complete list.
適当なpdf ファイルをgrep
$ pdfgrep raspberry ~/Downloads/MagPi128.pdf | head
raspberrypi.com
                       magpi@raspberrypi.com
                       forums.raspberrypi.com
                                                     lucy@raspberrypi.com
                                                     rob@raspberrypi.com
                                                     charlotte.milligan@raspberrypi.com
                                                     brian.jepson@raspberrypi.com
 Learn Sense HAT             magpi@raspberrypi.com             (CC BY-NC-SA 3.0).
GNU grep でよく使うオプションを利用
$ pdfgrep -m5 -n -i raspberry ~/Downloads/MagPi128.pdf
1:Issue 128     April 2023   magpi.cc    The official Raspberry Pi magazine
1:   Discover coding with Raspberry Pi
1:            NEW! RASPBERRY PI GLOBAL SHUTTER CAMERA
2: Industrial Raspberry Pi
3:(page 44) can help you out on this journey. I hope you take it.                 Raspberry Pi office
                                     This Month in Raspberry Pi
日本語もok
$ pdfgrep -r -m1 -n サーバー ~/Nextcloud_matoken\@files.matoken.org/Linux/2025/
/home/matoken/Nextcloud_matoken@files.matoken.org/Linux/2025//sakura-cominuty-2025/snac-kagolug.pdf:2:サーバー設定ファイルの server.json を編集します。 "protocol" を
/home/matoken/Nextcloud_matoken@files.matoken.org/Linux/2025//kagolug2025.08/slide/slide.pdf:1:  ルサーバーの
/home/matoken/Nextcloud_matoken@files.matoken.org/Linux/2025//kagolug2025.09/slide/slide.pdf:19:ActivityPubも少し探したが,自分とサーバーの落ちているものしか
/home/matoken/Nextcloud_matoken@files.matoken.org/Linux/2025//kagolug2025.09/slide/matoken-slide.pdf:19:ActivityPubも少し探したが,自分とサーバーの落ちているものしか
/home/matoken/Nextcloud_matoken@files.matoken.org/Linux/2025//kagolug2025.10/slide/slide.pdf:10:     2     サーバー設定ファイルを編集."protocol" を "http"

オプションの詳細は以下を.

これまではpdf ファイルをpdftotext などでテキストに変換しつつgrep などしていましたがこれだとどのページ化が分かりづらかったです.pdfgrep だと -n オプションが行数ではなくページ数になるのでこのあたりがわかりやすくなって良さそうです.

$ pdftotext ~/Downloads/RetroBSD_and_LiteBSD.pdf - | grep -m5 -n -i retro
1:RetroBSD and LiteBSD:
15:  Contributing to RetroBSD since 2013
30:  RetroBSD: an OS from the past in 128k RAM
35:
   RetroBSD and LiteBSD: an overview
39:  RetroBSD: PIC32MX
$ pdfgrep -m5 -n -i retro ~/Downloads/RetroBSD_and_LiteBSD.pdf
1:RetroBSD and LiteBSD:
3:  Contributing to RetroBSD since 2013
4:  RetroBSD: an OS from the past in 128k RAM
5:RetroBSD and LiteBSD: an overview
5:     RetroBSD: PIC32MX

と,一通り遊んでから気づいたのですが,debian にはpdfgrep パッケージが結構前から存在していました.

$ apt-cache search pdfgrep
pdfgrep - 正規表現にマッチする文字列を pdf ファイル内で検索
$ rmadison pdfgrep
pdfgrep    | 2.1.2-1       | oldoldstable   | source, amd64, arm64, armhf, i386
pdfgrep    | 2.1.2-1       | oldstable      | source, amd64, arm64, armel, armhf, i386, mips64el, mipsel, ppc64el, s390x
pdfgrep    | 2.2.0-0.1     | stable         | source
pdfgrep    | 2.2.0-0.1     | testing        | source
pdfgrep    | 2.2.0-0.1     | unstable       | source
pdfgrep    | 2.2.0-0.1     | unstable-debug | source
pdfgrep    | 2.2.0-0.1+b2  | stable         | amd64, arm64, armel, armhf, i386, ppc64el, riscv64, s390x
pdfgrep    | 2.2.0-0.1+b2  | testing        | amd64, arm64, armhf, i386, ppc64el, riscv64, s390x
pdfgrep    | 2.2.0-0.1+b2  | unstable       | amd64, arm64, armhf, i386, ppc64el, riscv64, s390x
$ sudo apt install pdfgrep
$ /usr/bin/pdfgrep -V
This is pdfgrep version 2.2.0.

Using poppler version 25.03.0
Using libpcre2 version 10.46 2025-08-27
環境
$ pdfgrep -V
This is pdfgrep version 2.2.0.

Using poppler version 25.03.0
Using libpcre2 version 10.46 2025-08-27
Built from git-commit v2.2.0-7-gaa71955
$ /usr/bin/pdfgrep -V
This is pdfgrep version 2.2.0.

Using poppler version 25.03.0
Using libpcre2 version 10.46 2025-08-27
$ dpkg-query -W poppler-utils
poppler-utils   25.03.0-11.1+b1
$ pdftotext -v
pdftotext version 25.03.0
Copyright 2005-2025 The Poppler Developers - http://poppler.freedesktop.org
Copyright 1996-2011, 2022 Glyph & Cog, LLC
$ lsb_release -dr
Description:    Debian GNU/Linux forky/sid
Release:        n/a
$ arch
x86_64
]]>
https://matoken.org/blog/2025/12/05/pdfgrep/feed/ 0
PCManFM-Qt のコンテキストメニューにカスタム項目を追加 https://matoken.org/blog/2025/12/04/pcmanfm-qt-custom-actions/ https://matoken.org/blog/2025/12/04/pcmanfm-qt-custom-actions/#respond Thu, 04 Dec 2025 11:00:13 +0000 https://matoken.org/blog/?p=4778

pcmanfm qt icon

最近ファイルマネージャーにPCManFM-Qt を利用しています.

naitilus だとコンテキストメニューにカスタムスクリプトを設定できて便利だったのでPCManFM-Qt でも出来ないかなと調べてみました.

公式ドキュメントが見えたら無かったので以下のあたりを参考にしました.

~/.local/share/file-manager/actions/ 以下に .desktop ファイルを作成して実現できるようです.

ディレクトリの作成
$ mkdir -p ~/.local/share/file-manager/actions/

次にやりたいことを.decktop ファイルに書きます.

~/.local/share/file-manager/actions/fuse-archive.desktop
[Desktop Entry]
Type=Action
Profiles=profile_id
Name=archive file mount
Icon=application-default-icon

[X-Action-Profile profile_id]
MimeTypes=application/*;
Exec=fuse-archive %f

MimeTypes に書いたtype に一致するときに表示されるようなのでちゃんと書いたほうがいいのですが,今回は対象がアーカイブファイルで対象ファイルが大量ですとりあえず MimeTypes=application/*; にしておきました.

この後PCManFM-Qt を起動し直すと該当の .desktop が認識され,利用できるようになります.
nautilug は即反映されていたので少し面倒ですね.

pcmanfm qt fuse archive

環境
$ dpkg-query -W pcmanfm-qt
pcmanfm-qt      2.2.0-1
$ fuse-archive --version
fuse-archive version: 1.7
libarchive version: libarchive 3.7.4
bzlib version: 1.0.8, 13-Jul-2019
liblz4 version: 1.10.0
liblzma version: 5.8.1
libzstd version: 1.5.7
zlib version: 1.3.1
FUSE library version: 2.9.9
fusermount3 version: 3.17.4
using FUSE kernel interface version 7.19
$ lsb_release -dr
Description:    Debian GNU/Linux forky/sid
Release:        n/a
$ arch
x86_64
]]>
https://matoken.org/blog/2025/12/04/pcmanfm-qt-custom-actions/feed/ 0
かわいいcli 天気アプリのstarlit https://matoken.org/blog/2025/12/03/cute-cli-weather-app-starlit/ https://matoken.org/blog/2025/12/03/cute-cli-weather-app-starlit/#respond Tue, 02 Dec 2025 21:22:00 +0000 https://matoken.org/blog/?p=4769

小さく可愛いCLI 天気アプリケーションのstarlit を少し試してみました.
starlit はPython製,ライセンスは不明です.

pipx で導入しました.

$ pipx install starlit-cli
  installed package starlit-cli 0.2.3, installed using Python 3.13.9
  These apps are now globally available
    - starlit
done! ✨ 🌟 ✨
$ starlit --help

Starlit is a minimal, cute and customizable weather cli.
Weather forecasts, beautifully styled for your terminal!

USAGE


  starlit [city] [--flags]


EXAMPLES


   # Get weather for default city
   starlit

   # Get weather for a specific city
   starlit tokyo

   # Start interactive mode
   starlit --interactive


FLAGS

  -s --setup                Create configuration folder with .env file
  -e --edit                 Open configuration file in default editor
  -c --config               View configuration settings in terminal
  -i --interactive          Start interactive mode
  -v --version              Show starlit version
  -h --help                 Show this help message

--setup オプションで設定ファイルを設定します.設定ファイルは $HOME/.config/starlit/.env に作られます.

$ starlit --setup

 DONE  Config created at `/home/matoken/.config/starlit/.env`

Would you like to edit the config now? (y/n): y

 EDIT  Opened .env file in default editor

設定ファイルを編集して最低限 API_KEY (OpenWeatherMap API key) と DEFAULT_CITY (既定値の都市)を指定します.

OpenWeatherMap API key は以下から,

都市は以下のあたりで確認します.

実行します.実際はカラフルでアニメーションで表示されます.

$ starlit

Forecast for Kanoya, JP ☁

               weather  ›   cloudy (16.1°C)
    .--.      sunset   ›   05:13 PM
  .-(    ).    wind     ›   13.6 km/h ↖
 (___.__)__)   humidity ›   72%
               precip   ›   0mm | 0%

Tue. Dec 2  07:26 PM (gmt+9)

 🐻 MSG  a chill playlist kinda day

starlit

オプションや環境変数で都市を指定すると特定の都市が表示されます.

starlit shibushi

その他interactive mode も.

いつもは類似アプリとしてwego を利用することが多いのですがstarlit も良さそうです.天気プロバイダが増えると便利かもです.

環境
$ starlit --version

 V0.2.3  starlit version
$ dpkg-query -W pipx python3
pipx    1.8.0-1
python3 3.13.7-1
$ lsb_release -dr
Description:    Debian GNU/Linux forky/sid
Release:        n/a
$ arch
x86_64
]]>
https://matoken.org/blog/2025/12/03/cute-cli-weather-app-starlit/feed/ 0
Squawker 3.8.4 で再度認証可能に https://matoken.org/blog/2025/12/02/squawker-3-8-4-allows-authentication-again/ https://matoken.org/blog/2025/12/02/squawker-3-8-4-allows-authentication-again/#respond Tue, 02 Dec 2025 09:45:00 +0000 https://matoken.org/blog/?p=4761

squawker logo

非公式Twitter client の Squawker バージョン 3.8.4 がリリースされました.

今回のリリースで仕様変更による認証情報の取得 異失敗する問題が解決されています.

Implement a new way to log (via the X web page, inspired by QuaX).

QuaX を参考にして実装されたようです.
今回の問題でQuaX に乗り換えようかとも思ったのですが,Squawker からのデータ移行は出来ましたがたくさんのアカウントの読み込みがうまく行かなかったりと自分の使い方ではSquawker のほうが良さそうです.

ということで早速更新.
F-Froid から導入していたので,F-Droid アプリで更新を行いました.

起動するとセッションの切れた認証情報を消しておいたせいか Not logged in と言われます Login から認証を行おうとしましたが,

squawker login

回線がプアなせいで何度かタイムアウト

squawker timeout

とかやっていたら Not logged in 画面を消してしまいました.右上の歯車→account からアカウントを追加しました.

squawker addaccount

Web認証画面に遷移するので認証を行うとSquawker にアカウントが登録できます.

squawker xlogin

アカウントの登録ができると時系列でTweet を見たり出来ます.

squawker matoken1

Nitter と組み合わせて使っていこうかと思います.

環境
$ adb shell dumpsys package org.ca.squawker | grep versionName=
    versionName=3.8.4
$ adb shell dumpsys package org.fdroid.fdroid | grep versionName=
    versionName=1.23.1
$ adb shell getprop ro.build.version.release
14
$ adb shell getprop ro.build.version.sdk
34
$ adb shell getprop ro.build.id
UTAS34.82-113-2
$ adb shell getprop ro.product.model
moto g24
追記

今回入った以下のバグのせいで使いづらく.前者は指でどうにか操作できますが後者は指でタップしておいても強制的にtop に移動してしまうのでスレッドの投稿が読めません.v3.8.5 で治る予定とのことなのでリリースを待ちましょう.

追記2

v3.8.5 がリリースされました.Issue #391 は治っていそう?

]]>
https://matoken.org/blog/2025/12/02/squawker-3-8-4-allows-authentication-again/feed/ 0
Pandoc 3.8.3 でasciidoc 入力に対応 https://matoken.org/blog/2025/12/01/pandoc-3-8-3-now-supports-asciidoc-input/ https://matoken.org/blog/2025/12/01/pandoc-3-8-3-now-supports-asciidoc-input/#respond Mon, 01 Dec 2025 14:20:48 +0000 https://matoken.org/blog/?p=4747

たくさんの文章形式に対応した文章変換ツールのPandoc のバージョン3.8.3 がリリースされました.
個人的にはasciidoc 形式の入力対応が嬉しいです.

Add asciidoc as an input format (#1456).

個人的にasciidoc 形式は好きなのですが,これまでPandoc ではasciidoc への変換は出来てもasciidoc からの変換が出来ないという一方通行でしたがこれで相互変換できそうです.

これまでのpandoc のasciidoc 対応状況
$ pandoc --version
pandoc 3.1.11.1
Features: -server +lua
Scripting engine: Lua 5.4
User data directory: /home/matoken/.local/share/pandoc
Copyright (C) 2006-2023 John MacFarlane. Web: https://pandoc.org
This is free software; see the source for copying conditions. There is no
warranty, not even for merchantability or fitness for a particular purpose.
$ pandoc --list-input-formats | grep -i asciidoc
$ pandoc --list-output-formats | grep -i asciidoc
asciidoc
asciidoc_legacy
asciidoctor

早速pandoc 3.8.3 を試します.
とりあえずGitHub Releases の.deb を’もらってきて導入.

$ wget -c https://github.com/jgm/pandoc/releases/download/3.8.3/pandoc-3.8.3-1-amd64.deb (1)
$ sha256sum pandoc-3.8.3-1-amd64.deb  (2)
d7fac78b58b8c8da39254955eff321233ab97d74e8b2d461c0f0719a1fb5f357  pandoc-3.8.3-1-amd64.deb
$ sudo apt install ./pandoc-3.8.3-1-amd64.deb (3)
$ which pandoc
/usr/bin/pandoc
$ pandoc -v (4)
pandoc 3.8.3
Features: +server +lua
Scripting engine: Lua 5.4
User data directory: /home/matoken/.local/share/pandoc
Copyright (C) 2006-2025 John MacFarlane. Web:  https://pandoc.org
This is free software; see the source for copying conditions. There is no
warranty, not even for merchantability or fitness for a particular purpose.
$ pandoc --list-input-formats | grep -i asciidoc (5)
asciidoc
$ pandoc --list-output-formats | grep -i asciidoc
asciidoc
asciidoc_legacy
asciidoctor
$ pandoc slide/slide.adoc -o /tmp/out.pdf -f asciidoc -t pdf --pdf-engine=weasyprint (6)
  1. pandoc debian amd64 package を入手

  2. hash 確認

  3. system に導入

  4. バージョン確認

  5. 入力フォーマットにasciidoc があるのを確認

  6. 適当なasciidoc をpdf に変換してみる

asciidoc からpdf への変換が出来ました.

pandoc 3.8.3 adoc2pdf

ちなみに現時点での対応フォーマットは入力51,出力75 のようです.この中にはhtml/html4/html5 のようなバージョン違いのようなものも含まれます.

$ pandoc --list-input-formats | wc -l
51
$ pandoc --list-output-formats | wc -l
75

ということでこれまでも便利だったPandoc ですがasciidoc 入力対応でまた一つ便利になりました.

環境
$ pandoc -v
pandoc 3.8.3
Features: +server +lua
Scripting engine: Lua 5.4
User data directory: /home/matoken/.local/share/pandoc
Copyright (C) 2006-2025 John MacFarlane. Web:  https://pandoc.org
This is free software; see the source for copying conditions. There is no
warranty, not even for merchantability or fitness for a particular purpose.
$ dpkg-query -W pandoc
pandoc  3.8.3-1
$ lsb_release -dr
Description:    Debian GNU/Linux forky/sid
Release:        n/a
$ arch
x86_64
]]>
https://matoken.org/blog/2025/12/01/pandoc-3-8-3-now-supports-asciidoc-input/feed/ 0
tmux 3.6 リリース https://matoken.org/blog/2025/11/27/tmux-3-6-release/ https://matoken.org/blog/2025/11/27/tmux-3-6-release/#respond Thu, 27 Nov 2025 10:05:18 +0000 https://matoken.org/blog/?p=4741

ターミナルマルチプレクサのtmux 3.6 が出ていました.

早速ビルドしてみます.今回はgit リポジトリから導入します.
$ git pull
$ git checkout 3.6
$ ./autogen.sh
$ ./configure --enable-sixel --prefix=$HOME/usr/local (1)
$ make
$ ./tmux -V
tmux 3.6
  1. sixel を有効にし,$HOME/usr/local 以下に導入

tmux が起動しない?旧tmux が生きていたせいでした.
$ ./tmux
open terminal failed: not a terminal
$ pgrep tmux
14030
$ tmux kill-server
$ ./tmux
$ ./tmux kill-server
intall
$ make install
$ which tmux
/home/matoken/local/bin/tmux
$ tmux -V
tmux 3.6

tmux 3.6

環境
$ tmux -V
tmux 3.6
$ dpkg-query -W autoconf automake pkg-config libevent-dev ncurses-bin
autoconf        2.72-3.1
automake        1:1.18.1-3
libevent-dev    2.1.12-stable-10+b1
ncurses-bin     6.5+20251123-1
pkg-config:amd64        1.8.1-4
$ lsb_release -dr
Description:    Debian GNU/Linux forky/sid
Release:        n/a
$ arch
x86_64
追記

Debian sid にtmux 3.6 が降りてきました.sixel も有効になっています.パッケージ名にaがつくのはなんでだろう?tmux 3.5a が存在したようにtmux 3.6a がリリースされたら当たりそうだなとも.

$ /usr/bin/tmux -V
tmux 3.6
$ zgrep -B99 -m1 — – /usr/share/doc/tmux/NEWS.Debian.gz
tmux (3.6a-1) unstable; urgency=medium

Please restart tmux entirely after upgrading to 3.6: an old server and
a new client will not be fully compatible with each other and the new
client may hang.
Note: if necessary the old client can be used via /proc/pid/exe to
talk to the old server, e.g. `/proc/$(pgrep "tmux: server")/exe attach'.
 -- Sébastien Delafond <seb@debian.org>  Mon, 01 Dec 2025 16:44:38 +0100
$ rmadison tmux
tmux       | 3.1c-1+deb11u1 | oldoldstable              | source, amd64, arm64, armhf, i386
tmux       | 3.1c-1+deb11u1 | oldoldstable-debug        | source
tmux       | 3.3a-3         | oldstable                 | source, amd64, arm64, armel, armhf, i386, mips64el, mipsel, ppc64el, s390x
tmux       | 3.5a-2~bpo12+1 | oldstable-backports       | source, amd64, arm64, armel, armhf, i386, mips64el, mipsel, ppc64el, s390x
tmux       | 3.5a-2~bpo12+1 | oldstable-backports-debug | source
tmux       | 3.5a-3         | stable                    | source, amd64, arm64, armel, armhf, i386, ppc64el, riscv64, s390x
tmux       | 3.5a-3         | testing                   | source, amd64, arm64, armhf, i386, ppc64el, riscv64, s390x
tmux       | 3.6a-2         | unstable                  | source, amd64, arm64, armhf, i386, ppc64el, riscv64, s390x
tmux       | 3.6a-2         | unstable-debug            | source
]]>
https://matoken.org/blog/2025/11/27/tmux-3-6-release/feed/ 0
イタリアの X.org スポット https://matoken.org/blog/2025/10/11/x-org-spotted-in-italy/ https://matoken.org/blog/2025/10/11/x-org-spotted-in-italy/#respond Sat, 11 Oct 2025 11:13:08 +0000 https://matoken.org/blog/?p=4730 \u3053\u306e\u30b5\u30a4\u30c8\u3067\u91cd\u5927\u306a\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f\u3002<\/p>

WordPress \u306e\u30c8\u30e9\u30d6\u30eb\u30b7\u30e5\u30fc\u30c6\u30a3\u30f3\u30b0\u306b\u3064\u3044\u3066\u306f\u3053\u3061\u3089\u3092\u3054\u89a7\u304f\u3060\u3055\u3044\u3002<\/a><\/p>","data":{"status":500,"error":{"type":1,"message":"Uncaught Error: Call to undefined method WP_Error::get_webfinger() in \/var\/lib\/wordpress\/wp-content\/plugins\/activitypub\/includes\/collection\/class-remote-actors.php:476\nStack trace:\n#0 \/var\/lib\/wordpress\/wp-content\/plugins\/activitypub\/includes\/class-mention.php(74): Activitypub\\Collection\\Remote_Actors::get_actor()\n#1 [internal function]: Activitypub\\Mention::replace_with_links()\n#2 \/var\/lib\/wordpress\/wp-content\/plugins\/activitypub\/includes\/functions.php(1256): preg_replace_callback()\n#3 \/var\/lib\/wordpress\/wp-content\/plugins\/activitypub\/includes\/class-mention.php(57): Activitypub\\enrich_content_data()\n#4 \/usr\/share\/wordpress\/wp-includes\/class-wp-hook.php(341): Activitypub\\Mention::the_content()\n#5 \/usr\/share\/wordpress\/wp-includes\/plugin.php(205): WP_Hook->apply_filters()\n#6 \/usr\/share\/wordpress\/wp-includes\/formatting.php(3992): apply_filters()\n#7 \/usr\/share\/wordpress\/wp-includes\/class-wp-hook.php(341): wp_trim_excerpt()\n#8 \/usr\/share\/wordpress\/wp-includes\/plugin.php(205): WP_Hook->apply_filters()\n#9 \/usr\/share\/wordpress\/wp-includes\/post-template.php(436): apply_filters()\n#10 \/usr\/share\/wordpress\/wp-includes\/feed.php(228): get_the_excerpt()\n#11 \/usr\/share\/wordpress\/wp-includes\/feed-rss2.php(103): the_excerpt_rss()\n#12 \/usr\/share\/wordpress\/wp-includes\/template.php(814): require_once('...')\n#13 \/usr\/share\/wordpress\/wp-includes\/functions.php(1679): load_template()\n#14 \/usr\/share\/wordpress\/wp-includes\/class-wp-hook.php(343): do_feed_rss2()\n#15 \/usr\/share\/wordpress\/wp-includes\/class-wp-hook.php(365): WP_Hook->apply_filters()\n#16 \/usr\/share\/wordpress\/wp-includes\/plugin.php(522): WP_Hook->do_action()\n#17 \/usr\/share\/wordpress\/wp-includes\/functions.php(1641): do_action()\n#18 \/usr\/share\/wordpress\/wp-includes\/template-loader.php(58): do_feed()\n#19 \/usr\/share\/wordpress\/wp-blog-header.php(19): require_once('...')\n#20 \/usr\/share\/wordpress\/index.php(17): require('...')\n#21 {main}\n thrown","file":"\/var\/lib\/wordpress\/wp-content\/plugins\/activitypub\/includes\/collection\/class-remote-actors.php","line":476}},"additional_errors":[]}