bookworm – matoken's blog https://matoken.org/blog Is there no plan B? Mon, 14 Oct 2024 22:39:35 +0000 ja hourly 1 https://wordpress.org/?v=6.8.1 https://matoken.org/blog/wp-content/uploads/2025/03/cropped-1865f695c4eecc844385acef2f078255036adccd42c254580ea3844543ab56d9-32x32.jpeg bookworm – matoken's blog https://matoken.org/blog 32 32 DebianをParrotOSに変換してみる https://matoken.org/blog/2024/10/15/converting-debian-to-parrotos/ https://matoken.org/blog/2024/10/15/converting-debian-to-parrotos/#respond Mon, 14 Oct 2024 22:39:32 +0000 https://matoken.org/blog/?p=4135

Debian から ParrotOS に変換する Debian Conversion Script を試してみました.

ParrotOS のダウンロードページでいろいろな選択肢があるなと見ていると,

Choose the right edition for you
Follow the steps below to determine the edition of ParrotOS that best suits your needs and preferences.

Debian Conversion Script というのを見かけて試してみました.

Debian Conversion Script

Quick script to convert an existing Debian installation to Parrot (all editions).

まず Debian stable 12.7.0 を netinst iso(debian-12.7.0-amd64-netinst.iso)から導入して起動しました.

そしてこちらのリポジトリの script を利用します.

初期状態では入っていない git を導入して clone,インストールスクリプトに実行権を付けて実行します.

$ sudo apt install git
$ git clone https://gitlab.com/parrotsec/project/debian-conversion-script.git
$ cd debian-conversion-script
$ sudo chmod +x ./install.sh
$ script
$ sudo ./install.sh

以下のような選択肢が出てくるので好みの Edition を選択します.今回はまず 2 のデスクトップの日常用途を選びました.

========== ParrotOS Editions Installer ==========
1) Install Core Edition: Minimal installation for server use.
2) Install Home Edition: Full desktop environment for daily use.
3) Install Security Edition: Tools for security testing and auditing.
4) Install Hack The Box Edition: Customized environment for Hack The Box labs.
5) Install Headless Edition: Minimal installation without GUI for servers.
6) Exit
=================================================
Enter the option number: 2

しばらく待つと導入されるので再起動して ParrotOS になっているのを確認します.
Xfce でしたが,MATE になり壁紙なども Parrot に.Home Edition だとアプリケーションなどはあまり変わらなそうです.パッケージリストは ./config/packages/ 以下に Edition ごとに置いてあります.

parrotos
parrotos neofetch

という感じで簡単に ParrotOS になりました.再度インストール script を実行して他の Edition を選択し直すこともできました.

Debian でも forensics-* あたりの metapackage を入れれば良いのではと思ったりしますがしばらく ParrotOS も試してみようと思います.

$ apt-cache search ^forensic
foremost - forensic program to recover lost files
forensic-artifacts - knowledge base of forensic artifacts (data files)
forensics-all - Debian Forensics Environment - essential components (metapackage)
forensics-all-gui - Debian Forensics Environment - GUI components (metapackage)
forensics-colorize - show differences between files using color graphics
forensics-extra - Forensics Environment - extra console components (metapackage)
forensics-extra-gui - Forensics Environment - extra GUI components (metapackage)
forensics-full - Full forensics station (metapackage)
forensics-samples-all - Set of files to help learn/test forensics tools and techniques (metapackage)
forensics-samples-btrfs - Set of files to help learn/test forensics tools and techniques (btrfs)
forensics-samples-exfat - Set of files to help learn/test forensics tools and techniques (exFAT)
forensics-samples-ext2 - Set of files to help learn/test forensics tools and techniques (ext2)
forensics-samples-ext4 - Set of files to help learn/test forensics tools and techniques (ext4)
forensics-samples-files - Set of files to help learn/test forensics tools and techniques (files)
forensics-samples-multiple - Set of files to help learn/test forensics tools and techniques (multiple FS)
forensics-samples-ntfs - Set of files to help learn/test forensics tools and techniques (ntfs)
forensics-samples-tools - Set of files to help learn/test forensics tools and techniques (tools)
forensics-samples-vfat - Set of files to help learn/test forensics tools and techniques (vfat)
guymager - Forensic imaging tool based on Qt
unhide - forensic tool to find hidden processes and ports
unhide.rb - Forensics tool to find processes hidden by rootkits
vinetto - forensics tool to examine Thumbs.db files
]]>
https://matoken.org/blog/2024/10/15/converting-debian-to-parrotos/feed/ 0
Android版 Nextcloudアプリを QR code で認証 https://matoken.org/blog/2024/08/17/authenticate-android-version-nextcloud-app-with-qr-code/ https://matoken.org/blog/2024/08/17/authenticate-android-version-nextcloud-app-with-qr-code/#respond Fri, 16 Aug 2024 21:50:15 +0000 https://matoken.org/blog/?p=4089

Android 端末をセットアップしています.Nextcloid アプリで以前から QR code でも認証できそうだけどどうやって認証用の QR code を作るんだろうと思いながら手動で入力していました.

NC QR Android02

今回やり方に気づきました.

Nextcloud の認証に他要素認証を使っている環境なので,Web の Nextcloud でアプリケーションパスワードを生成します.

NC QR01

このとき下の方に「モバイルアプリのQRコードを表示する」ボタンがあるのでこれを押すと QR code が表示されます.

NC QR02

Android アプリ側で「ログイン」

NC QR Android01

下の QR code ぽい画像をタップ.QR code 読み取り用のカメラが起動するので先程のアプリパスワードの QR code を読み取ります.

NC QR Android02

お手軽ですね :)

Nextcloud環境
$ sudo -u www-data php ./occ --version
Nextcloud 29.0.4
$ lsb_release -dr
No LSB modules are available.
Description:    Debian GNU/Linux 12 (bookworm)
Release:        12
$ arch
x86_64
Android環境
$ adb shell dumpsys package com.nextcloud.client | grep versionName=
    versionName=3.29.2
$ adb shell getprop ro.build.version.release
14
$ adb shell getprop ro.build.version.sdk
34
$ adb shell getprop ro.build.id
UTA34.82-73
$ adb shell getprop ro.product.model
moto g24
]]>
https://matoken.org/blog/2024/08/17/authenticate-android-version-nextcloud-app-with-qr-code/feed/ 0
軽量ウェブブラウザの Raphael を試す https://matoken.org/blog/2024/06/30/try-the-lightweight-web-browser-raphael/ https://matoken.org/blog/2024/06/30/try-the-lightweight-web-browser-raphael/#respond Sun, 30 Jun 2024 13:28:41 +0000 https://matoken.org/blog/?p=4027

最近のウェブブラウザはとてもリソース食いです.特にメモリ.いくらあっても足りません><

軽量ウェブブラウザもありますが,機能が足りず動かないサイトが多いです.

  • Dillo (最近reboot)
  • NetSurf
  • Midori(WebKit版)
  • :

Midori はWebKit版の頃は軽量だけど大抵のsite は動いていた記憶があります.しかしその後 Electron(Blink)ベース(Midori 10),Firefox(Gekko)ベースの Floorp ベース(Midori 11) となり重量級に.
今回 Midori WebKit版時代からのフォークのRaphael を知ったので試してみました.

Raphael はデスクトップ向けBSD のMidnightBSD がメンテしているようです.

Debian bookworm amd64 / Raspberry Pi OS bookworm armhf で build

とりあえず,手元の Debian bookworm amd64 / Raspberry Pi OS bookworm armhf で build しました.依存パッケージを入れたらさくっと通りました.

$ sudo apt install cmake valac libwebkit2gtk-4.0-dev libgcr-3-dev libpeas-dev \
  libsqlite3-dev libjson-glib-dev libarchive-dev intltool libxml2-utils
$ wget -c https://github.com/MidnightBSD/raphael/archive/refs/tags/9.1.tar.gz
$ tar xf 9.1.tar.gz
$ cd raphael-9.1
$ mkdir _build && cd _build
$ cmake -DCMAKE_INSTALL_PREFIX=/usr/local ..
$ make
$ sudo make install

起動

普通に起動.

raphael about

日本語も問題ありません

raphael yahoo

動画も再生できます

raphael youtube
raphael abema

SNS なんかも

raphael misskey

その他,いろいろなウェブサービスを試しましたがだいたい問題なかったです.しかし Zoom.us では「オーディオに接続中」のメッセージから進まず参加できませんでした.

raphael zoomng

メモリ消費量

Raphael くらいしか動かしてないのに RAM 減ってるなと htop 見ると WebKit* なプロセスが居ます.Raphael から 呼んでいるようです.

raphael resource

$ pstree -pTZ `pgrep raphael` | awk -F\( '{print $2}'| awk -F, '{print $1}' | xargs -I{} grep VmHWM /proc/{}/status | awk '{a+=$2} END{print a;}'
888836

WebKitは最近のウェブブラウザと違いタブ毎にプロセスが起動しないと思っていたのですが,WebKit 2.26 からタブ毎にプロセスが起動するようになったようです.
ちなみに環境変数 WEBKIT_USE_SINGLE_WEB_PROCESS=1 でプロセス増えないように出来ました.

For 2.26 you can set the env var WEBKIT_USE_SINGLE_WEB_PROCESS=1. This
is a temporary solution, only available in 2.26, to give apps more time
to adapt to the multiprocess model.

Re: [webkit-gtk Deprecation of shared-secondary-process mode]

Add WEBKIT_USE_SINGLE_WEB_PROCESS environment variable to force single process model in all WebKitWebContext. This is a temporary solution for applications still depending on the single process mode behavior. It will be only available in 2.26 series.

Webkit process limit

Since Webkit 2.26, the webkit engine used in luakit is creating a new process for each tab. This has the benefit that a webkit webview crash will only crash one tab. The downside is lower performance and increased memory use.

If you value speed over stability, you can ask webkit to use one process for all tabs by setting WEBKIT_USE_SINGLE_WEB_PROCESS before starting luakit:

$ export WEBKIT_USE_SINGLE_WEB_PROCESS=1

WEBKIT_USE_SINGLE_WEB_PROCESS=1 で昔のようにプロセス増えないようにできましたが1タブしか開いてなくても 800MB〜1GB くらいは消費してしまう感じです.思ったより消費します…….

拡張機能

Raphael にはいくつかの拡張機能が組み込まれていて,設定から確認ができます.

raphael extentions

いつも Firefox や Chromium で沢山の拡張機能を使っていると足りなく感じます.拡張機能を追加するにはちゃんと調べていませんが恐らくビルド時に組み込まないといけなさそう?
パスワードマネージャがほしいとこです.

ちなみに Raphael の拡張機能はVala で書かれているようです.

類似ウェブブラウザ

WebKitベースの類似ウェブブラウザです.

どちらもDebian packageがあるのでこれらのほうがお手軽に試せるのでいいかもしれません.

]]>
https://matoken.org/blog/2024/06/30/try-the-lightweight-web-browser-raphael/feed/ 0
軽量ウェブブラウザの Dillo が約9年ぶりにリリース https://matoken.org/blog/2024/05/06/dillo-a-lightweight-web-browser-new-release/ https://matoken.org/blog/2024/05/06/dillo-a-lightweight-web-browser-new-release/#respond Sun, 05 May 2024 21:53:26 +0000 https://matoken.org/blog/?p=4020

とても小さく軽いグラフィカルウェブブラウザの Dillo が新しいメンテナに引き継がれ 2015年から約9年ぶりのリリースされたらしいです.
試しに手元で build してみました.



$ wget -c https://github.com/dillo-browser/dillo/releases/download/v3.1.0/dillo-3.1.0.tar.bz2 \
          https://github.com/dillo-browser/dillo/releases/download/v3.1.0/dillo-3.1.0.tar.bz2.asc (1)
$ gpg --verify dillo-3.1.0.tar.bz2.asc (2)
gpg: assuming signed data in 'dillo-3.1.0.tar.bz2'
gpg: Signature made Sun 05 May 2024 05:16:32 AM JST
gpg:                using RSA key 32E65EC501A1B6FDF8190D293EE6BA977EB2A253
gpg: Can't check signature: No public key
$ sudo apt build-dep dillo (3)
$ tar tvf dillo-3.1.0.tar.bz2
$ tar xf dillo-3.1.0.tar.bz2 (4)
$ cd dillo-3.1.0
$ ./configure --prefix=/usr/local/ (5)

    :
Configuration summary:

  CXX     : g++
  CXXFLAGS: -g -O2 -Wall -W -Wno-unused-parameter -fno-rtti -fno-exceptions

  TLS enabled: yes
  TLS library: OpenSSL
  TLS flags  : -lcrypto -lssl

  Cookies enabled: yes
  XEmbed enabled : yes
  RTFL enabled   : no
  JPEG enabled   : yes
  PNG enabled    : yes
  GIF enabled    : yes

  HTML tests     : no

$ make (6)
$ sudo make install (7)
  1. source tar ball と署名ファイルを入手
  2. 署名確認※公開鍵が見当たらない
  3. build に必要なパッケージ入手
  4. source 展開
  5. prefix を指定して configure
  6. make
  7. install

こんな感じで普通に使えます.

dillo01

しかしそのままでは日本語が豆腐になってしまいます.

dillo02

Debian の場合,仮想パッケージの fonts-japanese-gothic fonts-japanese-mincho のリスト中の好みのフォントを導入して,

Package fonts-japanese-gothic is a virtual package provided by:
  fonts-ipafont-nonfree-jisx0208 1:00103-7
  fonts-mona 1:2.90-1.1
  fonts-vlgothic 20220612-1
  fonts-umeplus-cl 20180604-2
  fonts-takao-gothic 00303.01-3
  fonts-ipafont-gothic 00303-23
  fonts-ipaexfont-gothic 00401-5
You should explicitly select one to install.

Package fonts-japanese-mincho is a virtual package provided by:
  fonts-ipafont-nonfree-jisx0208 1:00103-7
  fonts-umeplus-cl 20180604-2
  fonts-takao-mincho 00303.01-3
  fonts-ipafont-mincho 00303-23
  fonts-ipaexfont-mincho 00401-5
  fonts-hanazono 20170904-2.1
You should explicitly select one to install.

~/.dillo/dillorc に以下を設定して dillo を起動し直したら表示できます.(好みのフォントを直接指定してもOKです.)

font_serif="fonts-japanese-mincho"
font_sans_serif="fonts-japanese-gothic"
font_cursive="fonts-japanese-gothic"
font_fantasy="fonts-japanese-gothic"
font_monospace="fonts-japanese-gothic"

ちなみに,環境変数の LANG が英語の場合などはこの設定をしていても豆腐のままになり嵌りました.

$ LANG=ja_JP.UTF-8 dillo

のようにすると大丈夫でした.そのような環境の場合は .desktop に環境変数を書いておくなどしたほうが良さそうです.

dillo03

少し触った感じでは Debian package 版の 3.0.5 とあまり違いがわかりませんがこれからに期待です.

Dillo には Dillo+ や Dillo NG といったフォークもあるようです.これらも気になります.

類似の?ウェブブラウザなどです.
NetSurf は独自エンジン,HTML5, CSS, JavaScript もサポートされています.Debian には FremeBuffer 版もあるのでこれも試してみたいです.
raphael は私は未検証ですが,Midori の WebKit を使った最終版(現在は Gekko ベース)からのフォークらしいです.開発元が Astian, Inc に移る以前の Midori は軽量でそれなりのサイトは動作したので便利でした.
w3m はテキストベースのウェブブラウザです.ターミナル上で画像も扱えます.
Browsh もテキストベースのウェブブラウザですが,バックエンドに Firefox を使い,最近のリッチな環境もレンダリングできます.Firefox が動くため動作は重いので Firefox の動作の問題ない端末で Browsh を起動し,ssh 経由などで利用すると便利です.日本語はうまく表示できないのが残念.Broush を http proxy として使い,Dillo や w3m で表示するなどすると日本語も表示できます.

環境
$ dillo --version
Dillo version 3.1.0
$ dpkg-query -W dillo libfltk1.3 libjpeg62-turbo libpng16-16 libssl3 zlib1g
dillo   3.0.5-7+b1
libfltk1.3:amd64        1.3.8-5
libjpeg62-turbo:amd64   1:2.1.5-2
libpng16-16:amd64       1.6.39-2
libssl3:amd64   3.0.11-1~deb12u2
zlib1g:amd64    1:1.2.13.dfsg-1
$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 12 (bookworm)
Release:        12
Codename:       bookworm
$ arch
x86_64






]]>
https://matoken.org/blog/2024/05/06/dillo-a-lightweight-web-browser-new-release/feed/ 0
LibreTranslate のモデルデータのダウンロード https://matoken.org/blog/2024/04/30/libretranslate-model-download/ https://matoken.org/blog/2024/04/30/libretranslate-model-download/#respond Tue, 30 Apr 2024 10:24:55 +0000 https://matoken.org/blog/?p=4011

先日新しい端末を入手したので,Debian を入れて使っています.これに LibreTranslate を Docker 経由で入れたのですが,モデルのダウンロードに失敗して再ダウンロードしてくれなかったのをダウンロードし直しさせたメモです.

Note
HP t430 thin client CPU Intel N4000/RAM 4GB/eMMC 32GB,ヤフオクにて 1,000円 + 送料 1,680円

LibreTranslate は Argos Translate に web インターフェイスや API を付けたような感じのもので,セルフホストして回線無しでも使うことが出来ます.

LibreTranslate については 鹿児島らぐの 鹿児島Linux勉強会 2022.12 で発表しました.このときは pip で導入,今回は Docker で導入しました.

Docker 利用時は, ./run.sh を実行すると導入されていなければ導入,そして起動してくれます.
モデルがない場合,モデルのダウンロードもしてくれます.

しかし,回線が不安定だとモデルのダウンロードが途中で失敗してしまうことがあります.

$ ./run.sh
  :
Downloading English → Czech (1.9) ...
(IncompleteRead(15249408 bytes read, 56611648 more expected),)
  :
^c

再度実行するとダウンロードされなかったモデルが使えない状態で起動します.今回は一番使いたい日本語のモデルがない状態です……

$ ./run.sh
Checking for docker...   found
Running on http://*:5000

run.sh を確認すると,最後の行で,libretranslatrun.sh の引数付きで呼んでいるようです.

docker run -ti --rm -p $LT_PORT:$LT_PORT $DB_VOLUME -v lt-local:/home/libretranslate/.local libretranslate/libretranslate ${ARGS[@]}

ということで libretranslat の usage や README.md の Arguments を見ると --update-models が使えそうです.このオプションを付けて起動すると足りないモデルのダウンロードをしてくれました.

$ ./run.sh --update-models
Checking for docker...   found
Updating language models
Found 88 models
Downloading English → Danish (1.3) ...
  :

しかし,やはり回線が駄目なのでよく転けるし時間がかかります. --load-only オプションを指定し,一番使う英語と日本語を使うように指定すると,英語と本語のモデルだけをダウンロードしてくれて,英語<→日本語相互翻訳が可能になりました.

$ ./run.sh --load-only 'ja,en' --update-models
Checking for docker...   found
Updating language models
Found 88 models
Keep 2 models
Downloading English → Japanese (1.1) ...
Downloading Japanese → English (1.1) ...
Loaded support for 13 languages (2 models total)!
Running on http://*:5000

残りのモデルはおいおいダウンロードしようと思います.

Note
usage を見ると --force-update-models というオプションもありました.未確認ですが,モデルファイルが壊れている場合などに使えそうです.
]]>
https://matoken.org/blog/2024/04/30/libretranslate-model-download/feed/ 0
タブレット端末で Firefox のタッチ操作を有効にする https://matoken.org/blog/2024/04/02/enabling-touch-controls-in-firefox/ https://matoken.org/blog/2024/04/02/enabling-touch-controls-in-firefox/#respond Mon, 01 Apr 2024 22:18:24 +0000 https://matoken.org/blog/?p=4004

メインマシンがおかしくなっているので去年の7月の購入した Fujitsu ARROWS Tab Q508/SE を最近良く使っています.

ARROWS Tab Q508/SE FARQ1801LZ【Atom(1.6GHz)/4GB/128GB eMMC/Win10Home】

Debian ベースのモバイル向けディストリビューションの mobian を使っていたときにはタッチ操作が出来ていた Firefox ですが,Debian 12 bookworm だとなぞったところを選択になってしまい操作しづらいです.
はじめ拡張起動を導入してみたりしたのですが動作がいまいちです.

Firefox のタッチ操作の有効化を調べて設定してみました.

検索してみると以下のようなページを見つけました.

はじめ, Firefox の URL バーに about:config と入力して, dom.w3c_touch_events.enabled=1 を設定してみましたがうまく行きませんでした.
次に,環境変数 MOZ_USE_XINPUT2=1 ( 1:タッチ有効,2(既定値):自動 ) を試すとうまく行きました.

$ MOZ_USE_XINPUT2=1 firefox-esr

これを GUI で起動しても反映されるようにしたいですが,Firefox 以外では使わないと思うので .desktop ファイルをいじることにします.
規定値の .desktop ファイルは /usr/share/applications/firefox-esr.desktop ですが,これを直に書き換えると Firefox 更新時に上書きされてしまうと思うので,ユーザの ~/.local/share/applications/ にコピーして編集します.
/usr/share/applications/ より, ~/.local/share/applications/ の方が優先度が高いので今回編集した .desktop の方が使われるはずです.

$ cp /usr/share/applications/firefox-esr.desktop ~/.local/share/applications/ (1)
$ vi ~/.local/share/applications/firefox-esr.desktop (2)
$ diff -u /usr/share/applications/firefox-esr.desktop ~/.local/share/applications/
--- /usr/share/applications/firefox-esr.desktop 2024-03-23 05:09:32.000000000 +0900
+++ /home/matoken/.local/share/applications/firefox-esr.desktop 2024-04-02 05:29:47.083233188 +0900
@@ -93,7 +93,7 @@
 X-GNOME-FullName[ru]=Интернет-браузер Firefox ESR
 X-GNOME-FullName[sk]=Internetový prehliadač Firefox ESR
 X-GNOME-FullName[sv]=Webbläsaren Firefox ESR
-Exec=/usr/lib/firefox-esr/firefox-esr %u
+Exec=env MOZ_USE_XINPUT2=1 /usr/lib/firefox-esr/firefox-esr %u (3)
 Terminal=false
 X-MultipleArgs=false
 Type=Application
 $ desktop-file-validate ~/.local/share/applications/firefox-esr.desktop (4)
  1. システムの firefox-esr.desktop をユーザにコピー
  2. 編集
  3. 環境変数を追加した
  4. 念の為チェック

Alt+F2 でコマンド入力欄に r を入力,Enter で Gnome 再読込で反映でしょうか.

漫画や文章などを読むのに便利です :)

環境
$ echo ${DESKTOP_SESSION}
gnome-xorg
$ dpkg-query -W firefox-esr* gnome-shell xorg
firefox-esr     115.9.1esr-1~deb12u1
firefox-esr-l10n-all
firefox-esr-l10n-ja     115.9.1esr-1~deb12u1
gnome-shell     43.9-0+deb12u1
xorg    1:7.7+23
$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 12 (bookworm)
Release:        12
Codename:       bookworm
$ arch
x86_64
$ sudo lshw -class system -sanitize | head -6
computer
    description: Detachable
    product: FARQ1801LZ
    vendor: FUJITSU
    serial: [REMOVED]
    width: 64 bits
]]>
https://matoken.org/blog/2024/04/02/enabling-touch-controls-in-firefox/feed/ 0
Mozilla のAPT リポジトリでFirefox を利用 https://matoken.org/blog/2024/02/22/using-firefox-with-mozillas-apt-repository/ https://matoken.org/blog/2024/02/22/using-firefox-with-mozillas-apt-repository/#respond Wed, 21 Feb 2024 22:36:41 +0000 https://matoken.org/blog/?p=3973

先日開催された「鹿児島Linux勉強会 2024.02(オンライン開催)」でYamano さんの発表で知ったのですが,Mozilla がDebian ベールのディストリビューション向けにAPT リポジトリが提供されているそうです.

これを試してみました.

Mozilla は Firefox 122 から apt リポジトリでの提供を開始したので、これを用いることにします。 (昨年 11 月ごろから Nightly は提供していたらしい)

基本的にDebian bookworm amd64, sid amd64 環境で以下のMozilla の文章の通りに行いました.

$ sudo install -d -m 0755 /etc/apt/keyrings (1)
$ wget -q https://packages.mozilla.org/apt/repo-signing-key.gpg -O- | sudo tee /etc/apt/keyrings/packages.mozilla.org.asc (2)
$ gpg -n -q --import --import-options import-show /etc/apt/keyrings/packages.mozilla.org.asc | awk '/pub/{getline; gsub(/^ +| +$/,""); if($0 == "35BAA0B33E9EB396F59CA838C0BA5CE6DC6315A3") print "\nThe key fingerprint matches ("$0").\n"; else print "\nVerification failed: the fingerprint ("$0") does not match the expected one.\n"}' (3)
$ echo "deb [signed-by=/etc/apt/keyrings/packages.mozilla.org.asc] https://packages.mozilla.org/apt mozilla main" | sudo tee -a /etc/apt/sources.list.d/mozilla.list (4)
$ echo '
Package: *
Pin: origin packages.mozilla.org
Pin-Priority: 1000
' | sudo tee /etc/apt/preferences.d/mozilla (5)
$ sudo apt update (6)
$ sudo apt install firefox firefox-l10n-ja (7)
  1. APT リポジトリ鍵格納ディレクトリを作成
  2. Mozilla APTリポジトリの署名鍵を取得
  3. 鍵指紋が 35BAA0B33E9EB396F59CA838C0BA5CE6DC6315A3 なのを確認
  4. Mozilla APTリポジトリをsource.list に登録
  5. Debian よりMozilla リポジトリを優先するようAPT Pin を立てる
  6. パッケージ情報の更新
  7. Firefox と日本語言語パックを導入

起動するとFirefox 122.0.1 が起動してきました :)

firefox 122

これまで ~/.local/bin/ 以下に最新版を入れていたのでこれは消すことにします.

$ ls -l `which firefox`
lrwxrwxrwx 1 matoken matoken 40 Jul 13  2023 /home/matoken/bin/firefox -> /home/matoken/.local/bin/firefox/firefox

そして,今日apt update && apt upgrade したらFirefox 123.0 が降ってきました.

$ dpkg-query -W firefox
firefox 123.0~build3
$ apt show firefox
Package: firefox
Version: 123.0~build3
Priority: optional
Section: web
Maintainer: Mozilla Releng <release@mozilla.com>
Installed-Size: 252 MB
Depends: libasound2 (>= 1.0.16), libatk1.0-0 (>= 1.12.4), libc6 (>= 2.17), libcairo-gobject2 (>= 1.10.0), libcairo2 (>= 1.10.0), libdbus-1-3 (>= 1.5.12), libfontconfig1 (>= 2.11), libfreetype6 (>= 2.3.5), libgcc1 (>= 1:4.1.1), libgdk-pixbuf2.0-0 (>= 2.22.0), libglib2.0-0 (>= 2.37.0), libgtk-3-0 (>= 3.13.7), libpango-1.0-0 (>= 1.14.0), libpangocairo-1.0-0 (>= 1.14.0), libstdc++6 (>= 4.8), libx11-6, libx11-xcb1, libxcb-shm0, libxcb1, libxcomposite1 (>= 1:0.3-1), libxcursor1 (>> 1.1.2), libxdamage1 (>= 1:1.1), libxext6, libxfixes3, libxi6, libxrandr2 (>= 2:1.4.0), libxrender1
Download-Size: 68.0 MB
APT-Sources: https://packages.mozilla.org/apt mozilla/main amd64 Packages
Description: Mozilla Firefox

N: There are 3 additional records. Please use the '-a' switch to see them.

もともと入っていたDebian 公式リポジトリの firefox-esr との共存もできていました.でもこれもMozilla の方にしたほうがいいかな?

$ dpkg-query -f='${binary:Package} ${Version}\t${Maintainer}\n' -W firefox*
firefox 122.0.1~build1  Mozilla Releng <release@mozilla.com>
firefox-esr 115.7.0esr-1        Maintainers of Mozilla-related packages <team+pkg-mozilla@tracker.debian.org>
firefox-esr-l10n-ja 115.7.0esr-1        Maintainers of Mozilla-related packages <team+pkg-mozilla@tracker.debian.org>
firefox-l10n-ja 122.0.1~build1  Mozilla Releng <release@mozilla.com>

他に firefox-beta, firefox-devedition, firefox-nightly もあるようです.
archtecture は x86_64, i686 で arm などは無さそう.arm64 あたりは欲しい気がします.

環境
$ dpkg-query -f='${binary:Package} ${Version}\t${Maintainer}\n' -W firefox* apt
apt 2.7.12      APT Development Team <deity@lists.debian.org>
firefox 123.0~build3    Mozilla Releng <release@mozilla.com>
firefox-esr 115.8.0esr-1        Maintainers of Mozilla-related packages <team+pkg-mozilla@tracker.debian.org>
firefox-esr-l10n-ja 115.8.0esr-1        Maintainers of Mozilla-related packages <team+pkg-mozilla@tracker.debian.org>
firefox-l10n-ja 123.0~build3    Mozilla Releng <release@mozilla.com>
$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux trixie/sid
Release:        n/a
Codename:       trixie
$ arch
x86_64
環境2
$ dpkg-query -f='${binary:Package} ${Version}\t${Maintainer}\n' -W firefox* apt
apt 2.6.1       APT Development Team <deity@lists.debian.org>
firefox 123.0~build3    Mozilla Releng <release@mozilla.com>
firefox-esr 115.7.0esr-1~deb12u1        Maintainers of Mozilla-related packages <team+pkg-mozilla@tracker.debian.org>
firefox-esr-l10n-ja 115.7.0esr-1~deb12u1        Maintainers of Mozilla-related packages <team+pkg-mozilla@tracker.debian.org>
firefox-l10n-ja 123.0~build3    Mozilla Releng <release@mozilla.com>
$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 12 (bookworm)
Release:        12
Codename:       bookworm
$ arch
x86_64
]]>
https://matoken.org/blog/2024/02/22/using-firefox-with-mozillas-apt-repository/feed/ 0
ゲームコントローラーをタブレットの操作に使う https://matoken.org/blog/2024/02/20/use-a-game-controller-to-control-your-tablet/ https://matoken.org/blog/2024/02/20/use-a-game-controller-to-control-your-tablet/#respond Mon, 19 Feb 2024 22:32:27 +0000 https://matoken.org/blog/?p=3968

先日,Fujitsu ARROWS Tab Q508/SE というWindows タブレットを入手してLinux を導入して使っています.

主にビュワーとして使っていますが,スタンドに置いて使うときなどHID デバイスが欲しくなります.ビュワーとして使う場合はそんなに昨日は必要ないのでゲームコントローラーを試してみました.

今回は昔ハードオフで500円くらいで買ったXbox 360 コントローラーを使いました.いつもはSteam などでゲームをするのに使っています.これをQJoyPad 4 を利用してマウス,キーボードに割り当ててみました.

QJoyPad 4 を導入
$ sudo apt install qjoypad
$ dpkg -L qjoypad
/.
/usr
/usr/bin
/usr/bin/qjoypad
/usr/share
/usr/share/applications
/usr/share/applications/qjoypad.desktop
/usr/share/doc
/usr/share/doc/qjoypad
/usr/share/doc/qjoypad/changelog.Debian.amd64.gz
/usr/share/doc/qjoypad/changelog.Debian.gz
/usr/share/doc/qjoypad/copyright
/usr/share/icons
/usr/share/icons/hicolor
/usr/share/icons/hicolor/24x24
/usr/share/icons/hicolor/24x24/apps
/usr/share/icons/hicolor/24x24/apps/qjoypad.png
/usr/share/icons/hicolor/64x64
/usr/share/icons/hicolor/64x64/apps
/usr/share/icons/hicolor/64x64/apps/qjoypad.png
/usr/share/man
/usr/share/man/man1
/usr/share/man/man1/qjoypad.1.gz
/usr/share/qjoypad
/usr/share/qjoypad/translations
/usr/share/qjoypad/translations/qjoypad_de.qm
$ dpkg-query -W qjoypad
qjoypad 4.3.1-3+b1

インストールすると以下のようなアイコンで登録されました.起動するとタスクトレイにアイコンが現れます.

qjoypad icon

Note
Gnome Shell 環境だとタスクトレイにアイコンが表示されないので, gnome-shell-extension-top-icons-plus 等の拡張機能を導入&有効にする必要がありそうです.

コントローラーを接続していない状態でアイコンをクリックすると以下のようなメッセージが表示されます.

qjoypad nopad

Xbox 360 コントローラーの接続
[  +8.425835] usb 1-4.2: new full-speed USB device number 6 using xhci_hcd
[  +0.108186] usb 1-4.2: New USB device found, idVendor=045e, idProduct=028e, bcdDevice= 1.14
[  +0.000049] usb 1-4.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  +0.000026] usb 1-4.2: Product: Controller
[  +0.000019] usb 1-4.2: Manufacturer: ©Microsoft Corporation
[  +0.000017] usb 1-4.2: SerialNumber: 00A????
[  +0.024350] input: Microsoft X-Box 360 pad as /devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4.2/1-4.2:1.0/input/input31

コントローラーを接続してからタスクトレイのQJoyPad アイコンをクリックすると以下のような画面が表示されます.

qjoypad setting1

この状態でコントローラーを操作すると操作したボタンに対応した場所が青く点灯します.

qjoypad setting2

該当部分をクリックするとキーの割当画面になります.ここで [NO KEY] ボタンを押すと割当キー画面になります.

qjoypad setting3

ここでコントローラーのボタンに割り当てたいキーを入力することで割りあてられます.

qjoypad setting4

アナログスティックは少し画面が違います.自分の現在以下のような設定にしてマウス移動に利用しています.

qjoypad setting5
qjoypad setting6

QJoyPad のウィンドウからフォーカスを外すと利用できるようになるようです.
あとは設定を保存して次回以降すぐ使えるようにしておくといいです.用途別に設定を作っておくこともできそうです.

今回使ったコントローラーはUSB 接続の有線のもの.出来ればBluetooth 接続のものを使いたいところです.ゲームをする場合 Xbox ワイヤレス コントローラー がサードパーティーのものとそう変わらない値段だし乾電池使えるし有線でも使えるということで良さそう.でもごろ寝で漫画を呼んだりと言った場合は 8bitdo の小さなコントローラー なんかが便利そうです.
(今のコントローラーアナログスティックがガタついていて勝手に動いたりするし……)

環境
$ dpkg-query -W qjoypad
qjoypad 4.3.1-3+b1
$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 12 (bookworm)
Release:        12
Codename:       bookworm
$ arch
x86_64
]]>
https://matoken.org/blog/2024/02/20/use-a-game-controller-to-control-your-tablet/feed/ 0
tmux Sixel でリモート画像を表示して遊ぶ https://matoken.org/blog/2023/11/10/tmux-sixel-fun/ https://matoken.org/blog/2023/11/10/tmux-sixel-fun/#respond Fri, 10 Nov 2023 10:34:00 +0000 https://matoken.org/blog/?p=3932

ターミナルマルチプレクサのtmux がSixel に対応し,グラフィックが使えるようになりました.これで少し遊んでみました.

tmux sixel live rain sayaka

ターミナルマルチプレクサでSixel が使えるようになったということで,リモートの端末でグラフックを扱い,それを必要な時だけ閲覧といったことが可能となります.
例えばライブカメラの映像の最新を取得して表示,

10分+動作時間毎にYoutubeLiveの最新1コマをダウンロードしてpng画像に変換,Sixel で表示し続ける.(画像左)
$ while true; do ffmpeg -i "$(yt-dlp --quiet -f 'bestvideo[height<=640]' -g IWPSU_aXdIE | head -n 1 )" -loglevel -8 -vframes 1 -c:v png -f image2 - | img2sixel ;sleep 60; done

雨雲レーダーの情報をウェブブラウザで取得して表示,

10分+動作時間毎に国土交通省 川の防災情報ページのスクリーンショットを取得して表示(右上)
$ while true; do chromium --headless --hide-scrollbars --window-size=800,500 --screenshot=/tmp/screenshot-rain.png  'https://www.river.go.jp/kawabou/mb?zm=11&fld=0&clat=31.24891059083941&clon=130.67756652832034&mapType=0&viewGrpStg=0&viewRd=1&viewRW=1&viewRiver=1&viewPoint=1&knd=rn' 2>/dev/null ;img2sixel /tmp/screenshot-rain.png ;sleep 600; done
Misskey のローカルタイムラインを表示(右下)
while true; do sayaka --local misskey.io ;sleep 5; done

しかし,RAMの少ないVPS で調子に乗って色々動かして遊んでいたらメモリ不足になりMariaDB を落としてしまいました.リソースと相談しながら遊びましょう…….

server環境
$ tmux -V
tmux next-3.4
$ git -C ~/src/tmux/ log -1 | grep -e ^commit -e ^Date:
commit 381c00a74ea1eb136a97c86da9a7713190b10a62
Date:   Thu Nov 2 22:58:45 2023 +0000
$ sayaka --version
sayaka version 3.7.2 (2023/10/19)
$ dpkg-query -W yt-dlp ffmpeg libsixel-bin ffmpeg chromium
chromium        116.0.5845.180-1~deb12u1
ffmpeg  7:5.1.3-1
libsixel-bin    1.10.3-3
yt-dlp  2023.03.04-1
$ lsb_release -dr
No LSB modules are available.
Description:    Debian GNU/Linux 12 (bookworm)
Release:        12
$ arch
x86_64
client環境
$ dpkg-query -W mlterm
mlterm  3.9.3-1
$ lsb_release -dr
No LSB modules are available.
Description:    Debian GNU/Linux trixie/sid
Release:        n/a
$ arch
x86_64
]]>
https://matoken.org/blog/2023/11/10/tmux-sixel-fun/feed/ 0
Tmux でSixel https://matoken.org/blog/2023/11/06/tmux-in-sixel/ https://matoken.org/blog/2023/11/06/tmux-in-sixel/#comments Sun, 05 Nov 2023 23:47:28 +0000 https://matoken.org/blog/?p=3923

ターミナルマルチプレクサの中で今一番利用されているであろうtmux にSIXEL branch がMarge されていたのに気づいたので試してみました.

8月に取り込まれていたのですね.未だリリースはされていないのでgit でsource を貰ってきて試しました.

Note

Debianだとexperimental は対応バージョンのようですが,Sixel が有効にしてあるかは未確認.

$ rmadison tmux
tmux       | 2.8-3             | oldoldstable             | source, amd64, arm64, armel, armhf, i386, mips, mips64el, mipsel, ppc64el, s390x
tmux       | 3.1c-1~bpo10+1    | buster-backports         | source, amd64, arm64, armel, armhf, i386, mips, mips64el, mipsel, ppc64el, s390x
tmux       | 3.1c-1~bpo10+1    | buster-backports-debug   | source
tmux       | 3.1c-1+deb11u1    | oldstable                | source, amd64, arm64, armel, armhf, i386, mips64el, mipsel, ppc64el, s390x
tmux       | 3.1c-1+deb11u1    | oldstable-debug          | source
tmux       | 3.3a-3~bpo11+1    | bullseye-backports       | source, amd64, arm64, armel, armhf, i386, mips64el, mipsel, ppc64el, s390x
tmux       | 3.3a-3~bpo11+1    | bullseye-backports-debug | source
tmux       | 3.3a-3            | stable                   | source, amd64, arm64, armel, armhf, i386, mips64el, mipsel, ppc64el, s390x
tmux       | 3.3a-5            | testing                  | source, amd64, arm64, armel, armhf, i386, mips64el, ppc64el, s390x
tmux       | 3.3a-5            | unstable                 | source, amd64, arm64, armel, armhf, i386, mips64el, ppc64el, riscv64, s390x
tmux       | 3.3a-5            | unstable-debug           | source
tmux       | 3.4~git20230924-1 | experimental             | source, amd64, arm64, armel, armhf, i386, mips64el, ppc64el, riscv64, s390x
tmux       | 3.4~git20230924-1 | experimental-debug       | source

追記) 有効になっているよう

$ curl -s https://metadata.ftp-master.debian.org/changelogs//main/t/tmux/tmux_3.4~git20230924-1_changelog | grep -A3 3.4~git20230924-1
tmux (3.4~git20230924-1) experimental; urgency=medium

  * New upstream snapshot, from Git commit b777780720.
  * Enable Sixel support.
$ sudo apt install vlock build-essential git
$ sudo apt build-dep tmux
$ git clone https://github.com/tmux/tmux
$ cd tmux
x$ git log -1
commit b77778072052c14d1450d2eb89542f2493121f84 (HEAD -> master, origin/master, origin/HEAD)
Merge: 0ca28b36 347cd0b5
Author: Thomas Adam <thomas@xteddy.org>
Date:   Tue Sep 19 12:01:11 2023 +0100

    Merge branch 'obsd-master'
$ ./configure --enable-sixel --prefix=/usr/local
$ make
$ ./tmux

tmux の上でSixel を表示してみます.

tmux sixel

大丈夫そうです.

tmux sixel split

画面分割してみても大丈夫そう.(左はtig でtmux リポジトリを表示,右上はchromium で取得した国土交通省 川の防災情報のスクリーンショットを表示,右下はsayaka でMisskey 表示)

ウィンドウ切り替えをするとSixel 画像は消えてしまうようです.
ssh 経由でリモートサーバのtmux でもSixel 表示OK なのでリモートで画像を取得表示して細い回線で必要なときにリモートのtmux に繋いで利用といったこともできて便利です.

mosh を挟むと駄目なようなのが残念.

追記) Sixel を使っていないタイミングでもtmux が落ちるように?安定度に難ありかも.とりあえずDebian pkg 版と併用しようと思います.

環境1
$ git log -1
commit b77778072052c14d1450d2eb89542f2493121f84 (HEAD -> master, origin/master, origin/HEAD)
Merge: 0ca28b36 347cd0b5
Author: Thomas Adam <thomas@xteddy.org>
Date:   Tue Sep 19 12:01:11 2023 +0100

    Merge branch 'obsd-master'
$ tmux -V
tmux next-3.4
$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux trixie/sid
Release:        n/a
Codename:       trixie
$ arch
x86_64
環境2
$ git log -1 -q
commit 381c00a74ea1eb136a97c86da9a7713190b10a62 (HEAD -> master, origin/master, origin/HEAD)
Merge: a5545dbc 5aadee6d
Author: Thomas Adam <thomas@xteddy.org>
Date:   Thu Nov 2 22:58:45 2023 +0000

    Merge branch 'obsd-master'
$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 12 (bookworm)
Release:        12
Codename:       bookworm
$ arch
x86_64
]]>
https://matoken.org/blog/2023/11/06/tmux-in-sixel/feed/ 1
asciidoctor-reveal.js v5.0.1 の新機能いくつか https://matoken.org/blog/2023/06/30/some-new-features-in-asciidoctor-reveal-js-v5-0-1/ https://matoken.org/blog/2023/06/30/some-new-features-in-asciidoctor-reveal-js-v5-0-1/#respond Fri, 30 Jun 2023 14:50:40 +0000 https://matoken.org/blog/?p=3909

ここしばらくスライド作成に使っているAsciidoctor のReveal.js コンバーターのasciidoctor-reveal.js が久々のメジャーアップデートでv5.0.1 がリリースされました.

新機能をいくつか試してみました.

以下の新機能を試しました.

  • Auto-Animate
  • search plugin
  • favicon

Auto-Animate

静的なpdfや画像にしたときにページが増えるので自分はあまり使わない機能ですがよく見かけるので一応.

Add support for the Auto-Animate feature (#439)

以下のあたりが参考になります.

[%auto-animate]
=== cats emoji

[data-id=foo]
* 😺
* 🐈

[%auto-animate]
=== cats emoji+ascii

[data-id=foo]
* 😺
* 🐈
* (ΦωΦ)
* (=^・・^=)
アニメーション中のスクリーンショット

adoc reveraljs autoanimate

以下のIssue によるとsource code block でも動作するようですが,手元ではうまく行っていません.

search plugin

スライド内で検索ができるプラグインです.

  • Add support for the built-in search plugin (#441)** You can enable this plugin using :revealjs_plugin_search: enabled.

既定値では無効になっているのでスライドのヘッダ部分に以下を書いて有効にします.

:revealjs_plugin_search: enable

生成されたhtml スライをを開いた状態で ctrl + shift + f で模擬上に検索ボックスが出てきて検索できます.

adoc reveraljs search

favicon

favicon が使えるようになりました.

Add favicon to HTML if its attribute is present in AsciiDoc

ヘッダ部分で以下のようにfavicon を設定します.:favicon には :imagesdir: は効かないようです.

:favicon: resources/favicon.ico

adoc reveraljs favicon

環境

$ asciidoctor-revealjs-linux --version
Asciidoctor reveal.js 5.0.1 using Asciidoctor.js 2.2.6 (Asciidoctor 2.0.17) [https://asciidoctor.org]
Runtime Environment (node v12.13.1 on linux)
CLI version 3.2.0
]]>
https://matoken.org/blog/2023/06/30/some-new-features-in-asciidoctor-reveal-js-v5-0-1/feed/ 0
i3statusのフォントサイズを変更 https://matoken.org/blog/2023/05/30/change-i3status-font-size/ https://matoken.org/blog/2023/05/30/change-i3status-font-size/#respond Tue, 30 May 2023 11:08:37 +0000 https://matoken.org/blog/?p=3907

最近ウィンドウマネージャにi3 wmを使っています.以前使っていた環境は14インチで解像度は1600×900,現在は12インチで1920×1200で画面サイズは小さくなったけどドット数は増えています.
この状態だとi3のステータスを表示しているi3statusの文字がぱっと見読めません.目を凝らせば読めるけど大変.
ということで文字を大きくする方法を調べました.

公式ドキュメントのFontの項目のExampleにそのものがありました.

5.10. Font
Specifies the font to be used in the bar. See [fonts].

Syntax:

font <font>

Example:

bar {
    font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
    font pango:DejaVu Sans Mono 10
}

DejaVu font は好きではないので規定値のmonospaceでサイズだけ大きくしてみます.

~/.config/i3/config
 # finds out, if available)
 bar {
         status_command i3status
+        font pango:monospace 16
 }

既定値は上の方にあった font pango:monospace 8 だと思います.
この状態で Mod+Shift+r で再読込して反映されました.

環境
$ dpkg-query -W i3 i3status
i3      4.22-2
i3status        2.14-2
$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 12 (bookworm)
Release:        12
Codename:       bookworm
$ arch
x86_64
]]>
https://matoken.org/blog/2023/05/30/change-i3status-font-size/feed/ 0
GitWebでリポジトリが404になってしまう https://matoken.org/blog/2023/05/29/gitweb%e3%81%a7%e3%83%aa%e3%83%9d%e3%82%b8%e3%83%88%e3%83%aa%e3%81%8c404%e3%81%ab%e3%81%aa%e3%81%a3%e3%81%a6%e3%81%97%e3%81%be%e3%81%86/ https://matoken.org/blog/2023/05/29/gitweb%e3%81%a7%e3%83%aa%e3%83%9d%e3%82%b8%e3%83%88%e3%83%aa%e3%81%8c404%e3%81%ab%e3%81%aa%e3%81%a3%e3%81%a6%e3%81%97%e3%81%be%e3%81%86/#respond Mon, 29 May 2023 13:19:39 +0000 https://matoken.org/blog/?p=3905

ふとGitWebを起動したら404になって困りました.

$ git instaweb --httpd webrick

gitweb404

$ w3m -dump http://127.0.0.1:1234/
]>
gitprojects /


404 - No projects found
OPML TXT

いくつかのリポジトリで試すと,駄目なのは自分のものだけのようでcloneした他の人の作ったものは動いていそうです.自分おリポジトリに何かが足りない?

と思ったのですが,ddgで検索すると以下のページを見つけました.

Found a likely cause while writing the question: Cloning the repository to a directory without the @ character in the name fixed it.

ディレクトリに@が含まれていると駄目のようです.リポジトリを@の含まれていないところにコピーするとうまく動きました.

$ pwd | grep -o '@'
@
$ git instaweb --httpd webrick --stop
$ cp -a ../05 `mktemp -d`
$ cd /tmp/tmp.LjVifz85dp/05
$ git instaweb --httpd webrick

自分のリポジトリは@の含まれるパスの下にあって,他のcloneしたリポジトリは@の含まれないパスの下にあったので動いていたということのようでした.

環境
$ dpkg-query -W git ruby-webrick
git     1:2.39.2-1.1
ruby-webrick    1.8.1-1
$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 12 (bookworm)
Release:        12
Codename:       bookworm
$ arch
x86_64
]]>
https://matoken.org/blog/2023/05/29/gitweb%e3%81%a7%e3%83%aa%e3%83%9d%e3%82%b8%e3%83%88%e3%83%aa%e3%81%8c404%e3%81%ab%e3%81%aa%e3%81%a3%e3%81%a6%e3%81%97%e3%81%be%e3%81%86/feed/ 0
OpenSSH ED25519 の Vanity Adress を探してみる https://matoken.org/blog/2023/04/18/openssh-ed25519-vanity-adress/ https://matoken.org/blog/2023/04/18/openssh-ed25519-vanity-adress/#respond Mon, 17 Apr 2023 21:33:00 +0000 https://matoken.org/blog/?p=3891

以前何種類かのVanity Adress を掘ってみました.

ふとSSH鍵のVanity Adress はどうだろうと試してみました.

鍵はEd25519 .鍵ペアの公開鍵がいい感じだと良さそうな気がします.

OpenSSH ssh-keygen

まずはOpenSSH の ssh-keysign で作ってみます.大文字小文字いずれかの mat0 が見つかるまで作成しています.

$ umask 277; no=0; tmp=`mktemp -d -p ~/tmp/`; chmod 700 ${tmp}; while true;do no=$(($no + 1)); ssh-keygen -t ed25519 -f ${tmp}/${no} -N '' -C '' > /dev/null; grep -i -E m[a@]t[o0] ${tmp}/${no}.pub && echo ${tmp}/${no} && break; done
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOt6L8+9eF3T8o/M4BnDVZ5F7SVdPmat0hlM8s/8zV/r
/home/matoken/tmp/tmp.rGb5eSpEaJ/26016

26016鍵ペアを生成したところで186秒ほど,大体140.6keys/sec くらい.遅い感じ?vmstat やtop を見てもcpu はあまり使えていない感じです.
-a 1 (default:16) にすると160.8/keys/sec と少し早くなりましたが鍵を盗まれた場合の強度が下がると思うのでやめたほうが良さそうです.

ssh-keygen-ed25519-vanity

tool を探してみます.

clone&build
$ git clone https://github.com/ionathanch/ssh-keygen-ed25519-vanity
$ cd ssh-keygen-ed25519-vanity
$ make
run
$ ./vanity mato
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEHmibZNyKuT/GO9rloS8qmatoFOZ4N7fJcRSOPCwsky
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZWQyNTUxOQAAACBB5om2Tcirk/xjva5aEvKpmraBTmeDe3yXEUjjwsLJMgAAAIjwyswa8MrMGgAAAAtzc2gtZWQyNTUxOQAAACBB5om2Tcirk/xjva5aEvKpmraBTmeDe3yXEUjjwsLJMgA
AAEBro42f/ycDTNvMw3JHIGD5dzg+VVgshQw+RWIhN/I2WEHmibZNyKuT/GO9rloS8qmatoFOZ4N7fJcRSOPCwskyAAAAAAECAwQF
-----END OPENSSH PRIVATE KEY-----

shell でssh-keygen を回すより速そうです.更にREADME にはmoreutils のparallel を使って並列実行する方法も書かれていました.

$ time parallel -n 0 ./vanity vanity -- 1 2 3 4

以下はREADME にあった文字数によりどのくらい時間がかかるかの目安です.

Rough performance stats
Obviously since it’s brute force the times are probabilistic, but this gives you an idea of how feasible it would be to find your desired number of characters.

Substring Time (s)

a

0.002

ar

0.015

ars

0.501

arso

3.753

arson

abandon all hope ye who seek five sequential characters

大分速いような気がしますがアドレスの指定が固定なようで大文字小文字どっちでもとか代替記号でもいいなどといったことが出来なそうです.

vanity-keygen

また別のものも試してみます.

clone&build
$ go install github.com/pcarrier/vanity-keygen@latest
$ vanity-keygen -h
Usage of vanity-keygen:
  -cpuprofile string
        write cpu profile to file
  -threads int
        number of threads to run (default 4)
run
$ time vanity-keygen -threads `nproc` [mM][aA@][tT][oO0]
2023/04/05 08:30:06 Looking for a public key matching [mM][aA@][tT][oO0]
2023/04/05 08:30:06 Public key:
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIA2rzJZSoqwrVF/Pf2FzKgfL/eMATOI/V7bjdmqkGV5B
2023/04/05 08:30:06 Private key:
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtz
c2gtZWQyNTUxOQAAACANq8yWUqKsK1Rfz39hcyoHy/3jAEziP1e243ZqpBleQQAA
AIiaywRCmssEQgAAAAtzc2gtZWQyNTUxOQAAACANq8yWUqKsK1Rfz39hcyoHy/3j
AEziP1e243ZqpBleQQAAAEDBsKpzquKe0/QTheaoVSChK8gF6d38u5mwrtqihfMY
6A2rzJZSoqwrVF/Pf2FzKgfL/eMATOI/V7bjdmqkGV5BAAAAAAECAwQF
-----END OPENSSH PRIVATE KEY-----

real    0m0.331s
user    0m0.652s
sys     0m0.048s

このツールはスレッド数も指定できるし,アドレスの指定も柔軟なので良さそうです.

$ vanity-keygen aaaaa
2023/04/05 08:30:12 Looking for a public key matching aaaaa
2023/04/05 08:30:13 Generated 71,000 keypairs (69,788 Hz)
2023/04/05 08:30:14 Generated 141,000 keypairs (70,310 Hz)
2023/04/05 08:30:15 Generated 212,000 keypairs (70,454 Hz)
2023/04/05 08:30:16 Generated 284,000 keypairs (70,792 Hz)
2023/04/05 08:30:17 Generated 356,000 keypairs (71,040 Hz)

探索中にどのくらいの鍵を生成したかも表示されます.

良さそうなのでTor のときのように少電力なSBCのRaspberry Pi 3 modelB でも試してみました.

Raspberry Pi OS armhf 向けにamd64 環境でクロスビルド
$ GOARCH=arm GOARM=7 go build .
$ file ./vanity-keygen
./vanity-keygen: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, Go BuildID=Z_Cr4XM48GAIHSA-MQng/2wFeSpgr5k0WPASNS4ho/3FEwAtva33LS2ByXLcjP/0WSk_fEc6xXCDZEo89yH, with debug_info, not stripped
Pi3Bで実行
$ ./vanity-keygen -threads 4 aaaa
2023/04/05 08:22:58 Looking for a public key matching aaaa
2023/04/05 08:22:59 Generated 0 keypairs (0 Hz)
2023/04/05 08:23:00 Generated 4,000 keypairs (1,991 Hz)
2023/04/05 08:23:01 Generated 4,000 keypairs (1,332 Hz)
2023/04/05 08:23:02 Generated 8,000 keypairs (1,990 Hz)
2023/04/05 08:23:03 Generated 8,000 keypairs (1,598 Hz)
^C
$ cat /proc/device-tree/model && echo
Raspberry Pi 3 Model B Rev 1.2

……大分遅くなりました.PCで実行したほうが良さそうです.

まとめ

気に入った鍵が出来たらパスフレーズを設定したり,

$ ssh-keygen -p -f ./key
Key has comment ''
Enter new passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved with the new passphrase.

コメントを書き換えたりしましょう.

$ ssh-keygen -c -f ./key
Enter passphrase:
Old comment:
New comment: vanity
Comment 'vanity' applied

Tor のVanity adoress なんかに比べるとあまり目立たないですが,hostkey やGitHub/Lab などで一般公開している鍵に使うのはありではと思います.

環境

$ cpu-info
Packages:
        0: Intel Core i5-7300U
Microarchitectures:
        2x Sky Lake
Cores:
        0: 2 processors (0-1), Intel Sky Lake
        1: 2 processors (2-3), Intel Sky Lake
Logical processors (System ID):
        0 (0): APIC ID 0x00000000
        1 (2): APIC ID 0x00000001
        2 (1): APIC ID 0x00000002
        3 (3): APIC ID 0x00000003
$ lsb_release -dr
No LSB modules are available.
Description:    Debian GNU/Linux 12 (bookworm)
Release:        12
$ arch
x86_64
]]>
https://matoken.org/blog/2023/04/18/openssh-ed25519-vanity-adress/feed/ 0
Logitech Webcam C310n を購入とC270との比較 https://matoken.org/blog/2023/03/14/logitech-webcam-c310n/ https://matoken.org/blog/2023/03/14/logitech-webcam-c310n/#respond Tue, 14 Mar 2023 10:28:49 +0000 https://matoken.org/blog/?p=3888

昔ハードオフでLogicool C270 を500円ほどで購入して使っていました.ビデオミーティングを良くするようになってC270はマイクもついているので便利に使っていました.でもマイクにノイズが乗るようになりNotePC内蔵ウェブカムやスマートフォンをWebcamとして利用していましたが使いにくいしマイクがついていないので少し不便.今回ひとつ上の機種のC310n を購入しました.

購入したのはAmazon で,-19% off 2400円となっていたのでそれで購入しようと思っていたところAmazon のUSED で2040円送料無料があったのでそちらを購入.

こんな感じのパッケージで届きました.内容物は本体と小さな保証書と取説が1枚づつ.付属物一覧がないので新品もこれと同じかは不明.

c310n package03
c310n package01

このテープの切り方はちょっとアウト感.

c310n package02

外観はこんな感じ.C270とほぼ同じだけどC270より気持ち大きくなって,ケーブル止めのベルクロがありません.

c310n 01
c310n c270 01

カタログスペックはC270 とほぼ同じで,画角と画素数が少し違うよう.

C270n C310n

画素数

0.9MP

1.2MP

対角視野

55°

60°

Linux端末に繋いでみるとC270と同じくUVC/UAC で認識して特に問題なく利用できていそうです.

$ sudo dmesg --human --color --follow-new
[  +4.580070] usb 1-3: new high-speed USB device number 59 using xhci_hcd
[  +0.369127] usb 1-3: New USB device found, idVendor=046d, idProduct=081b, bcdDevice= 0.12
[  +0.000026] usb 1-3: New USB device strings: Mfr=0, Product=0, SerialNumber=2
[  +0.000011] usb 1-3: SerialNumber: 159F4170
[  +0.002035] usb 1-3: Found UVC 1.00 device <unnamed> (046d:081b)
[  +0.115112] input: UVC Camera (046d:081b) as /devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.0/input/input192
[  +0.071778] usb 1-3: set resolution quirk: cval->res = 384
$ lsusb -d 046d:081b
Bus 001 Device 059: ID 046d:081b Logitech, Inc. Webcam C310
$ v4l-info /dev/video2

### v4l2 device info [/dev/video2] ###
general info
    VIDIOC_QUERYCAP
	driver                  : "uvcvideo"
	card                    : "UVC Camera (046d:081b)"
	bus_info                : "usb-0000:00:14.0-3"
	version                 : 6.1.12
	capabilities            : 0x84a00001 [VIDEO_CAPTURE,?,?,STREAMING,(null)]

standards

inputs
    VIDIOC_ENUMINPUT(0)
	index                   : 0
	name                    : "Camera 1"
	type                    : CAMERA
	audioset                : 0
	tuner                   : 0
	std                     : 0x0 []
	status                  : 0x0 []

video capture
    VIDIOC_ENUM_FMT(0,VIDEO_CAPTURE)
	index                   : 0
	type                    : VIDEO_CAPTURE
	flags                   : 0
	description             : "YUYV 4:2:2"
	pixelformat             : 0x56595559 [YUYV]
    VIDIOC_ENUM_FMT(1,VIDEO_CAPTURE)
	index                   : 1
	type                    : VIDEO_CAPTURE
	flags                   : 1
	description             : "Motion-JPEG"
	pixelformat             : 0x47504a4d [MJPG]
    VIDIOC_G_FMT(VIDEO_CAPTURE)
	type                    : VIDEO_CAPTURE
	fmt.pix.width           : 640
	fmt.pix.height          : 480
	fmt.pix.pixelformat     : 0x56595559 [YUYV]
	fmt.pix.field           : NONE
	fmt.pix.bytesperline    : 1280
	fmt.pix.sizeimage       : 614400
	fmt.pix.colorspace      : SRGB
	fmt.pix.priv            : 4276996862

controls
    VIDIOC_QUERYCTRL(BASE+0)
	id                      : 9963776
	type                    : INTEGER
	name                    : "Brightness"
	minimum                 : 0
	maximum                 : 255
	step                    : 1
	default_value           : 128
	flags                   : unknown
    VIDIOC_QUERYCTRL(BASE+1)
	id                      : 9963777
	type                    : INTEGER
	name                    : "Contrast"
	minimum                 : 0
	maximum                 : 255
	step                    : 1
	default_value           : 32
	flags                   : unknown
    VIDIOC_QUERYCTRL(BASE+2)
	id                      : 9963778
	type                    : INTEGER
	name                    : "Saturation"
	minimum                 : 0
	maximum                 : 255
	step                    : 1
	default_value           : 32
	flags                   : unknown
    VIDIOC_QUERYCTRL(BASE+12)
	id                      : 9963788
	type                    : BOOLEAN
	name                    : "White Balance, Automatic"
	minimum                 : 0
	maximum                 : 1
	step                    : 1
	default_value           : 1
	flags                   : unknown
    VIDIOC_QUERYCTRL(BASE+19)
	id                      : 9963795
	type                    : INTEGER
	name                    : "Gain"
	minimum                 : 0
	maximum                 : 255
	step                    : 1
	default_value           : 64
	flags                   : unknown
    VIDIOC_QUERYCTRL(BASE+24)
	id                      : 9963800
	type                    : MENU
	name                    : "Power Line Frequency"
	minimum                 : 0
	maximum                 : 2
	step                    : 1
	default_value           : 2
	flags                   : unknown
    VIDIOC_QUERYCTRL(BASE+26)
	id                      : 9963802
	type                    : INTEGER
	name                    : "White Balance Temperature"
	minimum                 : 0
	maximum                 : 10000
	step                    : 10
	default_value           : 4000
	flags                   : INACTIVE
    VIDIOC_QUERYCTRL(BASE+27)
	id                      : 9963803
	type                    : INTEGER
	name                    : "Sharpness"
	minimum                 : 0
	maximum                 : 255
	step                    : 1
	default_value           : 24
	flags                   : unknown
    VIDIOC_QUERYCTRL(BASE+28)
	id                      : 9963804
	type                    : INTEGER
	name                    : "Backlight Compensation"
	minimum                 : 0
	maximum                 : 1
	step                    : 1
	default_value           : 0
	flags                   : unknown
$ pactl list sources | grep 'escription: Webcam C310' -B 3 -A999
Source #1114
	State: RUNNING
	Name: alsa_input.usb-046d_081b_159F4170-02.mono-fallback
	Description: Webcam C310 モノ
	Driver: PipeWire
	Sample Specification: s16le 1ch 48000Hz
	Channel Map: mono
	Owner Module: 4294967295
	Mute: no
	Volume: mono: 65536 / 100% / 0.00 dB
	        balance 0.00
	Base Volume: 20724 /  32% / -30.00 dB
	Monitor of Sink: n/a
	Latency: 0 usec, configured 0 usec
	Flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY
	Properties:
		alsa.card = "2"
		alsa.card_name = "USB Device 0x46d:0x81b"
		alsa.class = "generic"
		alsa.device = "0"
		alsa.driver_name = "snd_usb_audio"
		alsa.id = "USB Audio"
		alsa.long_card_name = "USB Device 0x46d:0x81b at usb-0000:00:14.0-3, high speed"
		alsa.name = "USB Audio"
		alsa.resolution_bits = "16"
		alsa.subclass = "generic-mix"
		alsa.subdevice = "0"
		alsa.subdevice_name = "subdevice #0"
		api.alsa.card.longname = "USB Device 0x46d:0x81b at usb-0000:00:14.0-3, high speed"
		api.alsa.card.name = "USB Device 0x46d:0x81b"
		api.alsa.path = "hw:2"
		api.alsa.pcm.card = "2"
		api.alsa.pcm.stream = "capture"
		audio.channels = "1"
		audio.position = "MONO"
		card.profile.device = "1"
		device.api = "alsa"
		device.class = "sound"
		device.id = "112"
		device.profile.description = "モノ"
		device.profile.name = "mono-fallback"
		device.routes = "1"
		factory.name = "api.alsa.pcm.source"
		media.class = "Audio/Source"
		device.description = "Webcam C310"
		node.name = "alsa_input.usb-046d_081b_159F4170-02.mono-fallback"
		node.nick = "USB Device 0x46d 0x81b"
		node.pause-on-idle = "false"
		object.path = "alsa:pcm:2:hw:2:capture"
		priority.driver = "2000"
		priority.session = "2000"
		factory.id = "18"
		clock.quantum-limit = "8192"
		client.id = "33"
		node.driver = "true"
		factory.mode = "split"
		audio.adapt.follower = ""
		library.name = "audioconvert/libspa-audioconvert"
		object.id = "92"
		object.serial = "1114"
		node.max-latency = "16384/48000"
		api.alsa.period-size = "512"
		api.alsa.period-num = "64"
		api.alsa.headroom = "512"
		api.acp.auto-port = "false"
		api.acp.auto-profile = "false"
		api.alsa.card = "2"
		api.alsa.use-acp = "true"
		api.dbus.ReserveDevice1 = "Audio2"
		device.bus = "usb"
		device.bus-id = "usb-046d_081b_159F4170-02"
		device.bus_path = "pci-0000:00:14.0-usb-0:3:1.2"
		device.enum.api = "udev"
		device.form_factor = "webcam"
		device.icon_name = "camera-web-analog-usb"
		device.name = "alsa_card.usb-046d_081b_159F4170-02"
		device.nick = "USB Device 0x46d:0x81b"
		device.plugged.usec = "152884093590"
		device.product.id = "0x081b"
		device.product.name = "Webcam C310"
		device.serial = "046d_081b_159F4170"
		device.subsystem = "sound"
		sysfs.path = "/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.2/sound/card2"
		device.vendor.id = "0x046d"
		device.vendor.name = "Logitech, Inc."
		device.string = "2"
	Ports:
		analog-input-mic: マイクロフォン (type: Mic, priority: 8700, availability unknown)
	Active Port: analog-input-mic
	Formats:
		pcm

現在はAmazonでC270n 2,200円,C310n 2,400円と値段差があまりないのでC310の方が良さそうです.

]]>
https://matoken.org/blog/2023/03/14/logitech-webcam-c310n/feed/ 0
Andorid の画面をPC に転送して操作も出来るScrcpy 2.0 でオーディオ転送にも対応 https://matoken.org/blog/2023/03/13/scrcpy-2-0-audio/ https://matoken.org/blog/2023/03/13/scrcpy-2-0-audio/#respond Sun, 12 Mar 2023 21:45:00 +0000 https://matoken.org/blog/?p=3881

Andorid の画面をPC に転送して操作も出来るScrcpy というソフトウェアがあります.最新版の2.0でオーディオ転送にも正式対応したので試してみました.

Scrcpy はここでも何度か記事にしています.

このScrcpy はオーディオに対応しておらず,sndcpy という別のソフトウェアを使ったり,Scrcpy/sndcpyを同梱してQtでGUIを実装したQtScrcpy を使ったり,Bluetooth a2d-source を使って音を転送していました.

Scrcpy 2.0 がリリースされ,標準でオーディオに対応したとのことで試してみました.

Linux 環境への導入は以下のページに纏まっています.ただ,現バージョンで2.0に対応しているのはHomebrewとScoopだけのようです.

snap も未だ 1.25 です.

ということでsourceからbuildしました.

$ sudo apt install ffmpeg libsdl2-2.0-0 adb wget \
                 gcc git pkg-config meson ninja-build libsdl2-dev \
                 libavcodec-dev libavdevice-dev libavformat-dev libavutil-dev \
                 libswresample-dev libusb-1.0-0 libusb-1.0-0-dev (1)
$ git clone https://github.com/Genymobile/scrcpy (2)
$ cd scrcpy
$ ./install_release.sh (3)
$ which scrcpy (4)
/usr/local/bin/scrcpy
$ scrcpy --version (5)
scrcpy 2.0 <https://github.com/Genymobile/scrcpy>

Dependencies (compiled / linked):
 - SDL: 2.26.3 / 2.26.3
 - libavcodec: 59.37.100 / 59.37.100
 - libavformat: 59.27.100 / 59.27.100
 - libavutil: 57.28.100 / 57.28.100
 - libavdevice: 59.7.100 / 59.7.100
 - libusb: - / 1.0.26
  1. 関連パッケージの導入
  2. scrcpy のclone
  3. build&install script の実行
  4. インストールパスの確認
  5. バージョンの確認
Note

uninstall

$ sudo ninja -Cbuild-auto uninstall

Android 端末のudev への登録をしていない場合登録します.Android端末側ではUSBデバッグを有効にしておいて,フィンガープリントの確認が表示されたら許可します.

$ lsusb | grep -i moto (1)
Bus 001 Device 011: ID 22b8:2e82 Motorola PCS XT1541 [Moto G 3rd Gen]
$ echo '# moto g31
SUBSYSTEM=="usb", ATTR{idVendor}=="22b8" ATTR{idProduct}=="2e82", MODE="0660", GROUP="plugdev", SYMLINK+="android%n"' | sudo tee -a /etc/udev/rules.d/51-android.rules (2)
$ sudo udevadm control --reload (3)
$ adb devices (4)
* daemon not running; starting now at tcp:5037
* daemon started successfully
List of devices attached
ZY22DZ5M6C      device (5)
  1. AndroidデバイスのVID/PIDを確認
  2. udevへ登録
  3. udevをリロードして反映
  4. adbコマンドでデバイスが認識されるか確認

この状態でScrcpyを実行します.オーディオについては既定値で有効になっています.

$ scrcpy
scrcpy 2.0 <https://github.com/Genymobile/scrcpy>
/usr/local/share/scrcpy/scrcpy-server: 1 file pushed, 0 skipped. 5.2 MB/s (52867 bytes in 0.010s)
[server] INFO: Device: motorola moto g31(w) (Android 12)
INFO: Renderer: opengl
INFO: OpenGL version: 4.6 (Compatibility Profile) Mesa 22.3.3
INFO: Trilinear filtering enabled
INFO: Initial texture: 1080x2400

この状態でAndroid側で音の出るアプリケーションを試すとPCから音が出てAndroid側からは音が出ずいい感じです.Bluetooth 接続と違い遅延も感じません.

scrcpy2.0 duolingo

Pavucontrol を確認しても scrcpy が居ます.

scrcpy2.0 pulseaudio

Scrcpy オーディオ非対応のAndroid 9(10 以前)端末でも試してみたところ以下のような警告が表示され,音は転送されませんでした.

[server] INFO: Device: TINNO C330 (Android 9)
[server] WARN: Audio disabled: it is not supported before Android 11

オーディオ転送を行いたくない場合は --no-audio オプションが利用できます.
以下オーディオ関連のオプションです.音がきれいに聞こえない場合は --audio-buffer=ms を設定する(既定値50から増やす)と良さそうです

 scrcpy --help | grep -- -audio
    --audio-bit-rate=value
    --audio-buffer=ms
    --audio-codec=name
    --audio-codec-options=key[:type]=value[,...]
    --audio-encoder=name
        by --audio-codec).
    --no-audio
    --require-audio
環境
$ scrcpy --version
scrcpy 2.0 <https://github.com/Genymobile/scrcpy>

Dependencies (compiled / linked):
 - SDL: 2.26.3 / 2.26.3
 - libavcodec: 59.37.100 / 59.37.100
 - libavformat: 59.27.100 / 59.27.100
 - libavutil: 57.28.100 / 57.28.100
 - libavdevice: 59.7.100 / 59.7.100
 - libusb: - / 1.0.26
 $ dpkg-query -W ffmpeg libsdl2-2.0-0 adb wget gcc git pkg-config meson ninja-build libsdl2-dev libavcodec-dev libavdevice-dev libavformat-dev libavutil-dev libswresample-dev libusb-1.0-0 libusb-1.0-0-dev adb
adb     1:29.0.6-26
ffmpeg  7:5.1.2-3
gcc     4:12.2.0-3
git     1:2.39.2-1.1
libavcodec-dev:amd64    7:5.1.2-3
libavdevice-dev:amd64   7:5.1.2-3
libavformat-dev:amd64   7:5.1.2-3
libavutil-dev:amd64     7:5.1.2-3
libsdl2-2.0-0:amd64     2.26.3+dfsg-1
libsdl2-2.0-0:i386      2.26.3+dfsg-1
libsdl2-dev:amd64       2.26.3+dfsg-1
libswresample-dev:amd64 7:5.1.2-3
libusb-1.0-0:amd64      2:1.0.26-1
libusb-1.0-0:i386       2:1.0.26-1
libusb-1.0-0-dev:amd64  2:1.0.26-1
meson   1.0.0-1.1
ninja-build     1.11.1-1
pkg-config:amd64        1.8.1-1
wget    1.21.3-1+b2
$ lsb_release -a
Distributor ID: Debian
Description:    Debian GNU/Linux bookworm/sid
Release:        n/a
Codename:       bookworm
$ arch
x86_64
]]>
https://matoken.org/blog/2023/03/13/scrcpy-2-0-audio/feed/ 0
Nostr の Vanity address を掘る https://matoken.org/blog/2023/03/01/nostr-vanity-adress/ https://matoken.org/blog/2023/03/01/nostr-vanity-adress/#comments Wed, 01 Mar 2023 13:42:34 +0000 https://matoken.org/blog/?p=3864

Nostr という分散型SNSのプロトコルがあって最近良く見かけます.

このSNSの個人認識に秘密鍵と公開鍵のペアを作成してそれを利用します.鍵ペアは初回に自動生成されるのですが,公開鍵の文字列をたくさん計算して好みのアドレスが含まれたアドレスを掘るプログラムがあったので試してみました.

このプログラムはbech32で表現される公開鍵の npub1 の後ろの文字列を任意の文字列から始まるものにしたいというvanity アドレスを彫りたい人向けのものです.

導入

cargo insrtall で導入できるはずですが,手元のDebian bookworm testing amd64 環境ではrustc が 1.63 に対してrana は 1.64.0 以上が必要だということで古くて失敗しました.

$ cargo install rana
    Updating crates.io index
  Installing rana v0.5.1
  Downloaded is-terminal v0.4.4
  Downloaded clap_lex v0.3.2
  Downloaded syn v1.0.109
  Downloaded bip39 v1.2.0
  Downloaded 4 crates (346.5 KB) in 2.86s
error: failed to compile `rana v0.5.1`, intermediate artifacts can be found at `/tmp/cargo-installvCF9z2`

Caused by:
  package `clap_derive v4.1.0` cannot be built because it requires rustc 1.64.0 or newer, while the currently active rustc version is 1.63.0
  Try re-running cargo install with `--locked`
$ dpkg-query -W rustc
rustc   1.63.0+dfsg1-2

Rust Forge で新しいStable(1.67.1)を貰ってきて使おうかとも思いましたが,インストーラーを叩く形で環境が汚れそうで少し面倒そう.

Docker を使うことにします.

公式イメージだけあって最新の 1.67.1 です.rana もさくっと動きました.

$ script ./nostr_vanity.log
$ docker run --rm -it rust
# rustc --version
rustc 1.67.1 (d5a82bbd2 2023-02-07)
# adduser matoken
# su - matoken
$ export PATH=/usr/local/cargo/bin:$PATH
$ rustup default stable
$ cargo install rana
$ rana --help
Rana 🐸

      o  o
     ( -- )
  /\( ,   ,)/\
^^   ^^  ^^   ^^

A simple CLI to generate nostr vanity addresses

Francisco Calderón <negrunch@grunch.dev>

Usage: rana [OPTIONS]

Options:
  -d, --difficulty <DIFFICULTY>
          Enter the number of starting bits that should be 0. [default: 0]
  -v, --vanity <VANITY_PREFIX>
          Enter the prefix your public key should have when expressed
          as hexadecimal. [default: ]
  -n, --vanity-n-prefix <VANITY_NPUB_PREFIXES_RAW_INPUT>
          Enter the prefix your public key should have when expressed
          in npub format (Bech32 encoding). Specify multiple vanity
          targets as a comma-separated list. [default: ]
  -s, --vanity-n-suffix <VANITY_NPUB_SUFFIXES_RAW_INPUT>
          Enter the suffix your public key should have when expressed
          in npub format (Bech32 encoding). Specify multiple vanity
          targets as a comma-separated list. [default: ]
  -c, --cores <NUM_CORES>
          Number of processor cores to use [default: 4]
  -r, --restore <MNEMONIC>
          Restore from mnemonic to public private key [default: ]
  -g, --generate <WORD_COUNT>
          Generate mnemonic using wordcount. Should be 12,18 or 24 [default: 0]
  -p, --passphrase <MNEMONIC_PASSPHRASE>
          Passphrase used for restoring mnemonic to keypair [default: ]
  -q, --qr
          Print QR code of the private key
  -h, --help
          Print help
  -V, --version
          Print version

why can’t we use characters b, i, o, or 1?
the characters have to be in the bech32 character set.

— nostrogen
https://github.com/tonyinit/nostrogen#why-cant-we-use-characters-b-i-o-or-1

公開鍵は Bech32 形式で 023456789acdefghjklmnpqrstuvwxyz が利用できます.以下は Bech32 で使えない o を使って怒られた例です.

$ rana --vanity-n-prefix matok
thread 'main' panicked at 'The vanity npub prefix can only contain characters supported by Bech32: 023456789acdefghjklmnpqrstuvwxyz', /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/rana-0.5.1/src/cli.rs:146:17
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

oを0に置き換えて動かしてみます.

$ rana --vanity-n-prefix mat0k | tee rana.log
Started mining process for vanity bech32 prefix[es]: 'npub1["mat0k"]' (estimated pow: 20)
Benchmarking of cores disabled for vanity npub key upon proper calculation.
Mining using 4 cores...

さて,これで待っていれば鍵が掘れるのですが,以下のように新しいラップトップで以下のような速度で掘れるとのことです.あまり長くするとなかなか掘れないので気をつけましょう.

how fast will nostrogen find my addresses?
this depends entirely upon how fast your machine is, but here are some rough estimates for a modern laptop or mobile phone:

1 character = usually less than a 0.1 seconds
2 characters = usually less than a 1 second
3 characters = usually less than a 30 seconds
4 characters = usually less than a 10 minutes
5 characters = usually less than a 1 hour
6+ characters = keep fire extinguisher handy

— nostrogen
https://github.com/tonyinit/nostrogen#how-fast-will-nostrogen-find-my-addresses

以下のような感じで結果が表示されます.Npub public key の npub1の後ろが指定したmat0kから始まっています.

$ rana --vanity-n-prefix mat0k | tee rana.log
Started mining process for vanity bech32 prefix[es]: 'npub1["mat0k"]' (estimated pow: 20)
Benchmarking of cores disabled for vanity npub key upon proper calculation.
Mining using 4 cores...
<<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>>
Vanity npub found:         mat0k
Found matching Nostr public key:
Hex public key:   df56fb6cce5a60eac0a55b09ff6d5fbb565b07da6f64a2578ae827d70a21873b
Hex private key:  7a1a088022c3110fabc445af28681c0d2c349a2123f38fe83fbc809d7c8ed6bb
Npub public key:  npub1mat0kmxwtfsw4s99tvyl7m2lhdt9kp76daj2y4u2aqnawz3psuass9qwnz
Nsec private key: nsec10gdq3qpzcvgsl27ygkhjs6qup5krfx3py0ecl6plhjqf6lyw66as4gyfat
26169409 iterations (about 2x10^7 hashes) in 3199 seconds. Avg rate 8180 hashes/second
Warning
公開されているこの鍵は利用しないでください

手元の,NotePCの Intel® Core™ i5-7300U CPU @ 2.60GHz と Oeracle Free Tier VPS Arm Ampere A1 共に8000〜8200 hashes/secod という感じでした.

3日ほど走らせて mak0 から始まるものたくさん,mat0ke から始まるものが2つ出てきました. cpu fan うるさいしmat0ken は諦めてこの辺にしとこうかな?

Npub public key: npub1mat0kejpylctwszs3h0jcaw24vsmzvx0h44hl2qf3ghuz2ggekjqkwyeq5

そういえば以前はTor の Vanity address も掘っていました…….

]]>
https://matoken.org/blog/2023/03/01/nostr-vanity-adress/feed/ 1
Windows/Linux環境で動作する視差壁紙エンジンのlwp https://matoken.org/blog/2023/02/27/parallax-wallpaper-engine/ https://matoken.org/blog/2023/02/27/parallax-wallpaper-engine/#respond Sun, 26 Feb 2023 22:25:00 +0000 https://matoken.org/blog/?p=3856

視差壁紙エンジンのlwp というものを試してみました.

動作環境はLinux, Windows です.Linux amd64 環境で試してみました.
lwp のREADME では / に展開するようにとなっていましたがあまりやりたくないのでとりあえずアドホックに動かしました.

$ wget https://github.com/jszczerbinsky/lwp/releases/download/1.5/lwp-linux-x86_64.zip (1)
$ unzip -l ./lwp-linux-x86_64.zip
Archive:  ./lwp-linux-x86_64.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
        0  2023-02-19 07:42   etc/
      661  2023-02-19 07:32   etc/default.cfg
     1047  2023-02-22 23:42   etc/lwp.cfg
        0  2023-02-11 05:41   usr/
        0  2023-02-22 23:42   usr/bin/
    30800  2023-02-22 23:42   usr/bin/lwp
        0  2022-09-30 05:27   usr/share/
        0  2022-09-30 05:27   usr/share/lwp/
     1076  2023-02-22 23:42   usr/share/lwp/LICENSE
        0  2022-09-30 05:27   usr/share/lwp/wallpapers/
        0  2023-02-21 07:58   usr/share/lwp/wallpapers/test/
  8294538  2023-02-22 23:42   usr/share/lwp/wallpapers/test/1.bmp
      102  2023-02-22 04:16   usr/share/lwp/wallpapers/test/source
  8294538  2023-02-22 23:42   usr/share/lwp/wallpapers/test/3.bmp
  8294538  2023-02-22 23:42   usr/share/lwp/wallpapers/test/2.bmp
      461  2023-02-22 23:42   usr/share/lwp/wallpapers/test/wallpaper.cfg
        0  2023-02-11 05:41   usr/etc/
      558  2023-02-11 05:41   usr/etc/default.cfg
---------                     -------
 24918319                     18 files
$ mkdir lwp
$ cd lwp
$ unzip ../lwp-linux-x86_64.zip
$ usr/bin/lwp (2)
INFO: User config file not found, opening default config
ERROR: Default config file not found!
Segmentation fault
$ mkdir ~/.config/lwp (3)
$ install ./etc/lwp.cfg ~/.config/lwp/lwp.cfg (4)
$ xrandr | grep \* (5)
   1920x1200     59.96*+
$ vi ~/.config/lwp/lwp.cfg (6)
$ diff -u etc/lwp.cfg ~/.config/lwp/lwp.cfg
--- etc/lwp.cfg 2023-02-22 23:42:43.000000000 +0900
+++ /home/matoken/.config/lwp/lwp.cfg   2023-02-27 03:31:49.160716609 +0900
@@ -25,11 +25,11 @@
 monitor1_h=1080

 # Absolute path to the wallpaper directory
-monitor1_wallpaper=/usr/share/lwp/wallpapers/test
+monitor1_wallpaper=./usr/share/lwp/wallpapers/test (7)

 # Wallpaper size and position relative to Your monitor
 # Wallpaper resolution ratio should be the same as in original image
 monitor1_wallpaper_x=0
 monitor1_wallpaper_y=0
 monitor1_wallpaper_w=1920
-monitor1_wallpaper_h=1080
+monitor1_wallpaper_h=1200 (8)
$ usr/bin/lwp (9)
  1. release からバイナリアーカイブを取得
  2. 展開して実行してみると設定ファイルが見当たらないらしい
  3. 設定ファイルディレクトリを作成
  4. 規定値の設定ファイルをコピー
  5. 解像度を確認,ここでは 1920×1200
  6. 設定ファイルを編集
  7. 壁紙のパスを修正
  8. 解像度を修正
  9. 実行すると壁紙が設定された

Android の壁紙のようで面白いです.ただ,手元の環境では縦サイズが足りません.壁紙の元サイズが 1920×1080 に対してPCの解像度が 1920×1200 なのでそのせいだと思います.

$ file usr/share/lwp/wallpapers/test/*.bmp
usr/share/lwp/wallpapers/test/1.bmp: PC bitmap, Windows 98/2000 and newer format, 1920 x 1080 x 32, cbSize 8294538, bits offset 138
usr/share/lwp/wallpapers/test/2.bmp: PC bitmap, Windows 98/2000 and newer format, 1920 x 1080 x 32, cbSize 8294538, bits offset 138
usr/share/lwp/wallpapers/test/3.bmp: PC bitmap, Windows 98/2000 and newer format, 1920 x 1080 x 32, cbSize 8294538, bits offset 138
環境
$ dpkg-query -W libwayland-server0 gnome-shell
gnome-shell     43.2-2
libwayland-server0:amd64        1.21.0-1
libwayland-server0:i386 1.21.0-1
$ lsb_release -a
Distributor ID: Debian
Description:    Debian GNU/Linux bookworm/sid
Release:        n/a
Codename:       bookworm
$ arch
x86_64
]]>
https://matoken.org/blog/2023/02/27/parallax-wallpaper-engine/feed/ 0
Wayland 環境で任意のウィンドウを最前面に維持する https://matoken.org/blog/2023/02/26/keep-any-window-on-top-in-wayland-environment/ https://matoken.org/blog/2023/02/26/keep-any-window-on-top-in-wayland-environment/#respond Sun, 26 Feb 2023 13:35:26 +0000 https://matoken.org/blog/?p=3853

メディアプレイヤーのmpv で動画を最前面に表示しながら別のアプリケーションを利用したいので T を押して最前面にせってしようとしますがうまく行きません.

mpv(1)だとこんな感じで合っていそう.

Keyboard Control
       T      Toggle stay-on-top (see also --ontop).

引数の --ontop や,Linux ではおそらく関係のない --ontop-level も試してみましたが駄目です.

OPTIONS
       --ontop
              Makes the player window stay on top of other windows.

              On Windows, if combined with fullscreen mode, this causes mpv to be treated as exclusive fullscreen window that bypasses the Desktop Window Manager.

       --ontop-level=<window|system|desktop|level>
              (macOS only) Sets the level of an ontop window (default: window).

              window On top of all other windows.

              system On top of system elements like Taskbar, Menubar and Dock.

              desktop
                     On top of the Dekstop behind windows and Desktop icons.

              level  A level as integer.

Wayland のせいだろうか?と検索すると当たりのようです.

ワークアラウンドとして Alt+space で出てきたメニューから 「最前面に維持する」を選ぶことで実現できました.

wayland window stay ontop

環境
$ dpkg-query -W libwayland-server0 gnome-shell mpv
gnome-shell     43.2-2
libwayland-server0:amd64        1.21.0-1
libwayland-server0:i386 1.21.0-1
mpv     0.35.1-1
$ lsb_release -a
Distributor ID: Debian
Description:    Debian GNU/Linux bookworm/sid
Release:        n/a
Codename:       bookworm
$ arch
x86_64
]]>
https://matoken.org/blog/2023/02/26/keep-any-window-on-top-in-wayland-environment/feed/ 0
標準入力にタイムスタンプを付けてくれるmoreutils の ts コマンドが便利 https://matoken.org/blog/2023/02/05/moreutils-ts/ https://matoken.org/blog/2023/02/05/moreutils-ts/#respond Sun, 05 Feb 2023 13:38:16 +0000 https://matoken.org/blog/?p=3838

moreutils の ts コマンドが便利だったので紹介.

通常のpingはこんな感じ

$ ping ::1
PING ::1(::1) 56 data bytes
64 bytes from ::1: icmp_seq=1 ttl=64 time=0.052 ms
64 bytes from ::1: icmp_seq=2 ttl=64 time=0.051 ms
64 bytes from ::1: icmp_seq=3 ttl=64 time=0.040 ms
64 bytes from ::1: icmp_seq=4 ttl=64 time=0.049 ms
^C
--- ::1 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3067ms
rtt min/avg/max/mdev = 0.040/0.048/0.052/0.004 ms

http(s) の疎通確認の出来る httping には --timestamp/--ts オプションがありタイムスタンプが付けられて便利です.

--timestamp or --ts
       Put a timestamp before the result-lines. Use -v to also show a date.
$ httping 192.168.1.1
PING 192.168.1.1:80 (/):
connected to 192.168.1.1:80 (234 bytes), seq=0 time= 12.53 ms
connected to 192.168.1.1:80 (234 bytes), seq=1 time= 13.34 ms
connected to 192.168.1.1:80 (234 bytes), seq=2 time= 13.16 ms
^CGot signal 2
--- http://192.168.1.1/ ping statistics ---
3 connects, 3 ok, 0.00% failed, time 2578ms
round-trip min/avg/max = 12.5/13.0/13.3 ms
$ httping --timestamp 192.168.1.1
PING 192.168.1.1:80 (/):
22:05:30.798 connected to 192.168.1.1:80 (172 bytes), seq=0 time= 14.99 ms
22:05:31.813 connected to 192.168.1.1:80 (172 bytes), seq=1 time= 14.45 ms
22:05:32.827 connected to 192.168.1.1:80 (172 bytes), seq=2 time= 13.28 ms
^CGot signal 2
--- http://192.168.1.1/ ping statistics ---
3 connects, 3 ok, 0.00% failed, time 2658ms
round-trip min/avg/max = 13.3/14.2/15.0 ms

ping コマンドのman にはそれらしいものは見当たらなかったので,こんな感じで date コマンドの結果を繋いだりしていました.

$ ping ::1 | sed -s "s/^/`date +%F\ %T`\t/"
2023-02-05 21:58:50     PING ::1(::1) 56 data bytes
2023-02-05 21:58:50     64 bytes from ::1: icmp_seq=1 ttl=64 time=0.068 ms
2023-02-05 21:58:50     64 bytes from ::1: icmp_seq=2 ttl=64 time=0.066 ms
2023-02-05 21:58:50     64 bytes from ::1: icmp_seq=3 ttl=64 time=0.042 ms
^C

同じようなことをしてくれる moreutils 内の ts コマンドがありました.

ts: timestamp standard input

$ ping ::1 | ts
Feb 05 22:01:20 PING ::1(::1) 56 data bytes
Feb 05 22:01:20 64 bytes from ::1: icmp_seq=1 ttl=64 time=0.121 ms
Feb 05 22:01:21 64 bytes from ::1: icmp_seq=2 ttl=64 time=0.118 ms
Feb 05 22:01:22 64 bytes from ::1: icmp_seq=3 ttl=64 time=0.115 ms
^C

フォーマット( strftime(3) )を指定して自分好みにも.

$ ping ::1 | ts -m "%F %T"
2023-02-05 22:02:16 PING ::1(::1) 56 data bytes
2023-02-05 22:02:16 64 bytes from ::1: icmp_seq=1 ttl=64 time=0.038 ms
2023-02-05 22:02:17 64 bytes from ::1: icmp_seq=2 ttl=64 time=0.044 ms
2023-02-05 22:02:18 64 bytes from ::1: icmp_seq=3 ttl=64 time=0.066 ms
^C

sed などで書くより良さそうです.(moreutilsの導入が必要だけど)

環境
$ dpkg-query -W iputils-ping moreutils httping
httping 2.5-5.2+b1
iputils-ping    3:20221126-1
moreutils       0.67-1
$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux bookworm/sid
Release:        n/a
Codename:       bookworm
$ arch
x86_64
]]>
https://matoken.org/blog/2023/02/05/moreutils-ts/feed/ 0
Debian testing の source.list に non-free-firmware を登録 https://matoken.org/blog/2023/02/02/debian-testing-source-list-non-free-firmware/ https://matoken.org/blog/2023/02/02/debian-testing-source-list-non-free-firmware/#respond Thu, 02 Feb 2023 11:14:59 +0000 https://matoken.org/blog/?p=3835

Debian で non-free-firmware というコンポーネントが増えることになり,実際に移動し始めたとのことで利用できるように設定しました.

/etc/apt/sources.list を編集します.直に編集することも出来ますが, apt edit-sources を使うと保存時に文法チェックをしてくれるのでおすすめです.

$ sudo apt edit-source
編集例
$ sudo git -C /etc diff /etc/apt/sources.list
diff --git a/apt/sources.list b/apt/sources.list
index d9af843..11f6837 100644
--- a/apt/sources.list
+++ b/apt/sources.list
@@ -2,8 +2,8 @@

 #deb cdrom:[Debian GNU/Linux testing _Bookworm_ - Official Snapshot amd64 DVD Binary-1 20220919-00:24]/ bookworm contrib main

-deb http://deb.debian.org/debian/ bookworm main contrib non-free
-deb-src http://deb.debian.org/debian/ bookworm main contrib non-free
+deb http://deb.debian.org/debian/ bookworm main contrib non-free non-free-firmware
+deb-src http://deb.debian.org/debian/ bookworm main contrib non-free non-free-firmware
 #deb http://security.debian.org/debian-security bookworm-security main contrib
 #deb-src http://security.debian.org/debian-security bookworm-security main contrib

@@ -13,13 +13,13 @@ deb-src http://deb.debian.org/debian/ bookworm main contrib non-free
 # are provided as examples, but you should amend them as appropriate
 # for your mirror of choice.
 #
-deb http://deb.debian.org/debian/ bookworm-updates main contrib non-free
-deb-src http://deb.debian.org/debian/ bookworm-updates main contrib non-free
+deb http://deb.debian.org/debian/ bookworm-updates main contrib non-free non-free-firmware
+deb-src http://deb.debian.org/debian/ bookworm-updates main contrib non-free non-free-firmware

 # bookworm-backports, previously on backports.debian.org
 # A network mirror was not selected during install.  The following entries
 # are provided as examples, but you should amend them as appropriate
 # for your mirror of choice.
 #
-deb http://deb.debian.org/debian/ bookworm-backports main contrib non-free
-deb-src http://deb.debian.org/debian/ bookworm-backports main contrib non-free
+deb http://deb.debian.org/debian/ bookworm-backports main contrib non-free non-free-firmware
+deb-src http://deb.debian.org/debian/ bookworm-backports main contrib non-free non-free-firmware

apt update コマンドでパッケージリストを更新, apt upgrade コマンドでパッケージを最新にします.

$ sudo apt update
$ sudo apt upgrade

早速 non-free-firmware から firmware-iwlwifi が降ってきました.

取得:1 http://deb.debian.org/debian bookworm/non-free-firmware amd64 firmware-iwlwifi all 20221214-5 [20.5 MB]

今回 bookworm(testing) で設定しましたが,sid(unstable) の場合も同様だと思います.

環境
$ lsb_release -a
Distributor ID:	Debian
Description:	Debian GNU/Linux bookworm/sid
Release:	n/a
Codename:	bookworm
$ dpkg-query -W apt dpkg
apt	2.5.5
dpkg	1.21.19
$ arch
x86_64

追記) Bookworm 新規インストールの場合

non-free-firmware が有効になった Debian-Installer Bookworm Alpha 2 が出たので少し試してみました.
パッケージマネージャの設定で,「non-free のファームウェアを使用しますか?」「はい」を選択することで, source.listnon-free-firmware が設定されるのを確認しました.

d i bookworm a2 non free firmware gui
d i bookworm a2 non free firmware cui

]]>
https://matoken.org/blog/2023/02/02/debian-testing-source-list-non-free-firmware/feed/ 0
Wayland 環境の Google Chrome / chromium でタブ以外の画面共有が出来ない https://matoken.org/blog/2023/01/25/wayland-google-chrome-chromium-screenshareing/ https://matoken.org/blog/2023/01/25/wayland-google-chrome-chromium-screenshareing/#respond Wed, 25 Jan 2023 12:32:13 +0000 https://matoken.org/blog/?p=3831

先日の鹿児島Linux勉強会 2023.01 で発表時にGoogle Chrome を利用して画面共有時にChrome のタブしか選択できませんでした.スライドは.html だった(Asciidoctor Reveal.js)ので大丈夫だったのですが,別アプリケーションのデモを共有することが出来ませんでした.
先月は出来ていたのになぜだろうと調べてみました.

wayland chrome screenshareing NG
図 1. Chromeのタブしか共有できない

結果から言うとWayland環境でのGoogle Chrome のバグのようです.ワークアラウンドとして chrome://flags で 「WebRTC PipeWire support」という項目( chrome://flags/#enable-webrtc-pipewire-capturer )を「Enabled」に設定変更してウェブブラウザを再起動することで画面共有できるようになりました.この項目はバグが直ったら既定値になるようです.

wayland chrome screenshareing flags
例 1. chrome://flags/#enable-webrtc-pipewire-capturer

WebRTC PipeWire support
When enabled the WebRTC will use the PipeWire multimedia server for capturing the desktop content on the Wayland display server.

wayland chrome screenshareing OK
図 2. ウィンドウ共有や,デスクトップ共有も出来るようになった.

なお,Chromium, Brave も同様でした.Firefox については規定値のままで「単一のウインドウ」「画面全体」の共有が可能でした.
ということでWayland環境のウェブブラウザで画面共有をしたい場合はFirefoxを使うのが楽そうです.

Wayland困ることが少なくなったと思っていたのですが,まだぽつぽつこれ出来ないのかということに引っかかりますね><

環境
$ dpkg-query -W google-chrome-stable chromium brave-browser firefox-esr
brave-browser   1.47.171
chromium        109.0.5414.74-2
firefox-esr     102.6.0esr-1
google-chrome-stable    109.0.5414.74-1
$ lsb_release -a
Distributor ID: Debian
Description:    Debian GNU/Linux bookworm/sid
Release:        n/a
Codename:       bookworm
$ arch
x86_64
]]>
https://matoken.org/blog/2023/01/25/wayland-google-chrome-chromium-screenshareing/feed/ 0
日本語環境のPlayOnLinuxでリスト読み込みが出来ない https://matoken.org/blog/2023/01/24/cant-read-list-in-playonlinux-in-japanese-environment/ https://matoken.org/blog/2023/01/24/cant-read-list-in-playonlinux-in-japanese-environment/#respond Tue, 24 Jan 2023 13:05:59 +0000 https://matoken.org/blog/?p=3828

PlayOnLinuxというWineのラッパーが有ります.これを起動するとリストをリモートから読み込むはずなのですが,読み込み中のまま進まないという話を鹿児島Linux勉強会 2023.01 で聞きました.手元で試してみました.

Debian bookworm testing amd64 環境で apt install playonlinux として導入して起動すると確かに読み込み中から先に進みません.

playonlinux loop

以下の記事によると日本語の翻訳ミスが原因のようです.(以前の環境では en_US.UTF-8 環境だったりもしたので動いていたのかな?)

このページを真似して以下のように修正してPlayOnLinux を起動し直すと読み込みがされるようになりました.

$ msgunfmt /usr/share/locale/ja/LC_MESSAGES/pol.mo -o /tmp/pol.po (1)
$ vi /tmp/pol.po (2)
$ diff -u /tmp/pol.po.org /tmp/pol.po (3)
--- /tmp/pol.po.org     2023-01-24 04:45:59.897079913 +0900
+++ /tmp/pol.po 2023-01-24 06:46:07.853063925 +0900
@@ -494,7 +494,7 @@
 msgstr "更新"

 msgid "Refreshing {0}"
-msgstr "{0 }をリフレッシュ中"
+msgstr "{0}をリフレッシュ中"

 msgid "Registry Editor"
 msgstr "レジストリエディタ"
$ msgfmt /tmp/pol.po -o /tmp/pol.mo (4)
$ sudo mv /tmp/pol.mo /usr/share/locale/ja/LC_MESSAGES/pol.mo (5)
  1. 翻訳バイナリファイルを人間の読める.po形式に変換
  2. .po を編集
  3. 編集内容({}内のスペースを消した)
  4. 編集した .po から .mo を作成
  5. ディストリビューションの .mo を上書き

しかしPlayOnLinuxのアップデートで上書きされてしまいますね…….ということで大本がどうなっているか確認してみます.

PlayOnLinuxの翻訳を確認するとlaunchpadで翻訳しているようで,該当部分を確認するとCurrent Japaneseは間違ったまま.Suggestionsに修正が来ていた(2017年!)のでReviewしておきました.

playonlinux trans01
playonlinux trans02

これでそのうち取り込まれるかな?

とりあえず以下から直った .mo をダウンロードできるはずなので,それを /usr/share/locale/ja/LC_MESSAGES/pol.mo に上書きでも直ると思います.

環境
$ dpkg-query -W playonlinux gettext
gettext 0.21-10
playonlinux     4.3.4-3
$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux bookworm/sid
Release:        n/a
Codename:       bookworm
$ arch
x86_64
]]>
https://matoken.org/blog/2023/01/24/cant-read-list-in-playonlinux-in-japanese-environment/feed/ 0
自動ログイン状態の Gnome 43 のリモートデスクトップでパスワードが勝手に変わってしまい困る https://matoken.org/blog/2023/01/24/gnome-43-remote-desktop/ https://matoken.org/blog/2023/01/24/gnome-43-remote-desktop/#respond Mon, 23 Jan 2023 21:31:00 +0000 https://matoken.org/blog/?p=3825

日曜日の鹿児島Linux勉強会 2023.01 でGnome 42の自動ログイン環境でリモートデスクトップ機能を有効にすると毎回パスワードが変わってしまいヘッドレスで使いたいのにリモートログインのためには画面を確認しないといけなくて不便という話を聞いたので少し調べてみました.
ただし環境は少し違ってGnome 43です.

リモートデスクトップを有効にする

「設定」→「共有」→ 「リモートデスクトップ」で「リモートデスクトップ」と「リモートコントロール」を有効にして認証の「パスワード」を変更するか記録しておきます.

gnome remote desktop
Tip
「リモートデスクトップ」の項目がない場合,Debian では gnome-remote-desktop パッケージを導入すれば出てくると思います.

通常のログイン

ディスプレイマネージャーで手動でパスワードを入力するログインを行い,設定を確認するとパスワードは変わらずログインも出来ます.

自動ログイン

「設定」→「ユーザー」で「ロック解除」を行い,「自動ログイン」を有効にして再起動してみます.

gnome autologin

自動ログイン後設定を確認すると新しいランダムなパスワードが設定されています.
現象が確認できました.

パスワードマネージャのマスターパスワードをNULLに変更

以下のページを見るとGnomeのキーリングは既定値ではログインパスワードと同一でログイン時のパスワード入力で一緒に解除され,リモートデスクトップがアクセスできるようになる.自動ログインを有効にするとこのマスターパスワードの解除が自動で行われず,リモートデスクトップがパスワードがわからずランダムなパスワードを設定するという感じのようです.

ということでワークアラウンドとして,「パスワードと鍵」(Seahorse)でマスターパスワードを「」(NULL) にすることで自動ログインでもリモートデスクトップのパスワードが勝手に変わらなくなりました.

seahorse

しかしセキュリティ的にイマイチなのでGnomeのリモートデスクトップは使わずx11vnc(Waylandだと利用不可)やxrdpで利用するようにしたほうがいい気がします.

環境

$ dpkg-query -W gnome-shell gnome-remote-desktop seahorse remmina
gnome-remote-desktop    43.3-1
gnome-shell     43.2-1
remmina 1.4.27+dfsg-2+b1
seahorse        43.0-1
$ lsb_release -a
Distributor ID: Debian
Description:    Debian GNU/Linux bookworm/sid
Release:        n/a
Codename:       bookworm
$ arch
x86_64
]]>
https://matoken.org/blog/2023/01/24/gnome-43-remote-desktop/feed/ 0
Pandoc 3.0 で pandoc-server を少し試す https://matoken.org/blog/2023/01/21/try-pandoc-server/ https://matoken.org/blog/2023/01/21/try-pandoc-server/#respond Fri, 20 Jan 2023 20:51:26 +0000 https://matoken.org/blog/?p=3822

各種ファイル変換をしてくれるPandoc が久々にメジャーバージョンアップして 3.0 になりました.

手元の端末に入れて少し触ってみました.

ディストリビューションパッケージのPandoc をアンインストール
$ sudo apt remove pandoc pandoc-data
GitHub のRelease からPandoc 3.0の amd64 の.deb を入手してインストール
$ wget https://github.com/jgm/pandoc/releases/download/3.0/pandoc-3.0-1-amd64.deb
$ sudo apt install ./pandoc-3.0-1-amd64.deb
$ $ apt show pandoc -a
Package: pandoc
Version: 3.0-1
Status: install ok installed
Priority: optional
Section: text
Maintainer: John MacFarlane <jgm@berkeley.edu>
Installed-Size: 129 MB
Depends: libc6 (>= 2.13), libgmp10, zlib1g (>= 1:1.1.4)
Suggests: texlive-latex-recommended, texlive-xetex, texlive-fonts-recommended
Replaces: pandoc-data
Download-Size: 不明
APT-Manual-Installed: yes
APT-Sources: /var/lib/dpkg/status
Description: general markup converter
  Pandoc is a Haskell library for converting from one markup format
  to another, and a command-line tool that uses this library. The
  formats it can handle include light markup formats (many variants
  of Markdown, reStructuredText, AsciiDoc, Org-mode, Muse, Textile,
  txt2tags), HTML formats (HTML 4 and 5), ebook formats (EPUB v2
  and v3, FB2), Documentation formats (GNU TexInfo, Haddock),
  Roff formats (man, ms), TeX formats (LaTeX, ConTeXt), XML
  formats (DocBook 4 and 5, JATS, TEI Simple, OpenDocument),
  outline formats (OPML), bibliography formats (BibTeX, BibLaTeX,
  CSL JSON, CSL YAML, RIS), word processor formats (Docx, RTF,
  ODT), interactive notebook formats (Jupyter notebook
  ipynb), page layout formats (InDesign ICML), wiki markup
  formats (MediaWiki, DokuWiki, TikiWiki, TWiki, Vimwiki,
  XWiki, ZimWiki, Jira wiki, Creole), slide show formats
  (LaTeX Beamer, PowerPoint, Slidy, reveal.js, Slideous, S5,
  DZSlides), data formats (CSV and TSV tables), and PDF (via
  external programs such as pdflatex or wkhtmltopdf).

Package: pandoc
Version: 2.17.1.1-1.1
Priority: optional
Section: text
Maintainer: Debian Haskell Group <debian-haskell@lists.debian.org>
Installed-Size: 172 MB
Provides: pandoc-abi (= 1.22.2.1-1)
Depends: libc6 (>= 2.34), libffi8 (>= 3.4), libgmp10 (>= 2:6.2.1+dfsg1), liblua5.3-0, libyaml-0-2, zlib1g (>= 1:1.1.4), pandoc-data (>= 2.17.1.1-1.1), pandoc-data (<< 2.17.1.1-1.1.~)
Suggests: texlive-latex-recommended, texlive-xetex, texlive-luatex, pandoc-citeproc, texlive-latex-extra, context, wkhtmltopdf, librsvg2-bin, groff, ghc, nodejs, php, perl, python, ruby, r-base-core, libjs-mathjax, libjs-katex, citation-style-language-styles
Homepage: https://pandoc.org/
Tag: devel::doc, implemented-in::haskell, interface::commandline,
 role::documentation, role::program, use::converting,
 works-with-format::bib, works-with-format::docbook,
 works-with-format::html, works-with-format::json,
 works-with-format::man, works-with-format::odf,
 works-with-format::plaintext, works-with-format::tex,
 works-with-format::xml, works-with::text
Download-Size: 21.3 MB
APT-Sources: http://deb.debian.org/debian bookworm/main amd64 Packages
Description: general markup converter
 Pandoc is a Haskell library for converting
 from one markup format to another,
 and a command-line tool that uses this library.
 The formats it can handle include
  * light markup formats
    (many variants of Markdown, reStructuredText, AsciiDoc,
     Org-mode, Muse, Textile, txt2tags)
  * HTML formats (HTML 4 and 5)
  * Ebook formats (EPUB v2 and v3, FB2)
  * Documentation formats (GNU TexInfo, Haddock)
  * Roff formats (man, ms)
  * TeX formats (LaTeX, ConTeXt)
  * XML formats
    (DocBook 4 and 5, JATS, TEI Simple, OpenDocument)
  * Outline formats (OPML)
  * Bibliography formats (BibTeX, BibLaTeX, CSL JSON, CSL YAML)
  * Word processor formats (Docx, RTF, ODT)
  * Interactive notebook formats (Jupyter notebook ipynb)
  * Page layout formats (InDesign ICML)
  * Wiki markup formats
    (MediaWiki, DokuWiki, TikiWiki, TWiki,
     Vimwiki, XWiki, ZimWiki, Jira wiki, Creole)
  * Slide show formats
    (LaTeX Beamer, PowerPoint, Slidy,
     reveal.js, Slideous, S5, DZSlides)
  * Data formats (CSV tables)
  * PDF (via external programs such as pdflatex or wkhtmltopdf)
 .
 Pandoc can convert mathematical content in documents
 between TeX, MathML, Word equations, roff eqn, and plain text.
 It includes a powerful system
 for automatic citations and bibliographies,
 and it can be customized extensively using templates, filters,
 and custom readers and writers written in Lua.
 .
 This package contains the pandoc tool.
 .
 Some uses of Pandoc require additional packages:
  * SVG content in PDF output requires librsvg2-bin.
  * YAML metadata in TeX-related output requires texlive-latex-extra.
  * *.hs filters not set executable requires ghc.
  * *.js filters not set executable requires nodejs.
  * *.php filters not set executable requires php.
  * *.pl filters not set executable requires perl.
  * *.py filters not set executable requires python.
  * *.rb filters not set executable requires ruby.
  * *.r filters not set executable requires r-base-core.
  * LaTeX output, and PDF output via PDFLaTeX,
    require texlive-latex-recommended.
  * XeLaTeX output, and PDF output via XeLaTeX, require texlive-xetex.
  * LuaTeX output, and PDF output via LuaTeX, require texlive-luatex.
  * ConTeXt output, and PDF output via ConTeXt, require context.
  * PDF output via wkhtmltopdf requires wkhtmltopdf.
  * Roff man and roff ms output, and PDF output via roff ms,
    require groff.
  * MathJax-rendered equations require libjs-mathjax.
  * KaTeX-rendered equations require node-katex.
  * option --csl may use styles in citation-style-language-styles.
$ dpkg -L pandoc
/.
/usr
/usr/bin
/usr/bin/pandoc
/usr/share
/usr/share/doc
/usr/share/doc/pandoc
/usr/share/doc/pandoc/copyright
/usr/share/man
/usr/share/man/man1
/usr/share/man/man1/pandoc-lua.1.gz
/usr/share/man/man1/pandoc-server.1.gz
/usr/share/man/man1/pandoc.1.gz
/usr/bin/pandoc-lua
/usr/bin/pandoc-server
$ pandoc-server -v
pandoc-server 3.0
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.
$ ls -l /bin/pandoc*
-rwxr-xr-x 1 root root 128885952  1月 19 06:00 /bin/pandoc
lrwxrwxrwx 1 root root         6  1月 19 06:00 /bin/pandoc-lua -> pandoc
lrwxrwxrwx 1 root root         6  1月 19 06:00 /bin/pandoc-server -> pandoc
対応フォーマットの数
$ pandoc --list-input-formats | wc -l
42
$ pandoc --list-output-formats | wc -l
63

Pandoc Server を少し試す

Pandocサーバ起動
$ pandoc-server
Starting server on port 3030...
Pandocサーババージョン確認
$ http http://localhost:3030/version
HTTP/1.1 200 OK
Content-Type: text/plain;charset=utf-8
Date: Fri, 20 Jan 2023 13:24:51 GMT
Server: Warp/3.3.23
Transfer-Encoding: chunked

3.0
絵文字をPandocサーバでhtmlに変換
$ http POST http://localhost:3030/ text=:+1: from=markdown+emoji to=html4 Accept:text/plain
HTTP/1.1 200 OK
Content-Type: text/plain;charset=utf-8
Date: Fri, 20 Jan 2023 20:40:17 GMT
Server: Warp/3.3.23
Transfer-Encoding: chunked

<p><span class="emoji" data-emoji="+1">👍</span></p>
MarkdownファイルをPandocサーバでhtmlに変換
$ head ~/src/tilck/README.md (1)
<p align="center">
   <img src="http://vvaltchev.github.io/tilck_imgs/v2/tilck-logo-v5.png" alt="Tilck - A Tiny Linux-Compatible Kernel">
</p>

[![Build Status](https://vkvaltchev.visualstudio.com/Tilck/_apis/build/status/Tilck?branchName=master)](https://vkvaltchev.visualstudio.com/Tilck/_build/latest?definitionId=1&branchName=master)
[![codecov](https://codecov.io/gh/vvaltchev/tilck/branch/master/graph/badge.svg)](https://codecov.io/gh/vvaltchev/tilck)
[![License](https://img.shields.io/badge/License-BSD%202--Clause-orange.svg)](https://opensource.org/licenses/BSD-2-Clause)

<a href="https://youtu.be/Ce1pMlZO_mI">
   <img
$ http POST http://localhost:3030/ text=@~/src/tilck/README.md from=markdown+emoji to=html4 Accept:text/plain | head (2)
<p align="center">
<img src="http://vvaltchev.github.io/tilck_imgs/v2/tilck-logo-v5.png" alt="Tilck - A Tiny Linux-Compatible Kernel">
</p>
<p><a
href="https://vkvaltchev.visualstudio.com/Tilck/_build/latest?definitionId=1&amp;branchName=master"><img
src="https://vkvaltchev.visualstudio.com/Tilck/_apis/build/status/Tilck?branchName=master"
alt="Build Status" /></a> <a
href="https://codecov.io/gh/vvaltchev/tilck"><img
src="https://codecov.io/gh/vvaltchev/tilck/branch/master/graph/badge.svg"
alt="codecov" /></a> <a
$ http POST http://localhost:3030/ text=@~/src/tilck/README.md from=markdown+emoji to=html4 Accept:text/plain | w3m -T text/html -dump | head (3)
                    Tilck - A Tiny Linux-Compatible Kernel

Build Status codecov License

Tilck

Contents

  • Overview
      □ What is Tilck?
  1. Markdownファイル確認
  2. htmlに変換
  3. Markdownをhtmlに変換してw3mでレンダリング
環境
$ dpkg-query -W pandoc httpie w3m
httpie  3.2.1-1
pandoc  3.0-1
w3m     0.5.3+git20220429-1+b1
$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux bookworm/sid
Release:        n/a
Codename:       bookworm
$ arch
x86_64
]]>
https://matoken.org/blog/2023/01/21/try-pandoc-server/feed/ 0