TERMMAZE3D という端末上で動作するAWK製のFPSゲームを見つけたので遊んでみました.
タグ: terminal
ターミナルダッシュボードのWTFを少し試す
WTFというGo製のターミナルダッシュボードを見かけたので少し試してみました.
導入はLinuxのamd64/armv6/arm64,macOSのamd64/arm64はGitHub releaseページにあるのでそれを使うのが手っ取り早いです.
今回はarmv6をRaspberry Pi 3 Model BのRaspberry Pi OS armhfで試しました.
$ wget https://github.com/wtfutil/wtf/releases/download/v0.36.0/wtf_0.36.0_linux_armv6.tar.gz https://github.com/wtfutil/wtf/releases/download/v0.36.0/wtf_0.36.0_checksums.txt (1)
$ sha256sum -c ./wtf_0.36.0_checksums.txt 2>&1 | grep wtf_0.36.0_linux_armv6.tar.gz: (2)
wtf_0.36.0_linux_armv6.tar.gz: OK
$ tar tvf ./wtf_0.36.0_linux_armv6.tar.gz (3)
-rw-r--r-- ccummer/staff 34534 2021-03-23 19:20 wtf_0.36.0_linux_armv6/CHANGELOG.md
-rw-r--r-- ccummer/staff 14878 2018-12-01 01:13 wtf_0.36.0_linux_armv6/LICENSE.md
-rw-r--r-- ccummer/staff 39700 2021-03-20 13:46 wtf_0.36.0_linux_armv6/README.md
-rwxr-xr-x ccummer/staff 41615360 2021-03-23 19:35 wtf_0.36.0_linux_armv6/wtfutil
$ tar xf ./wtf_0.36.0_linux_armv6.tar.gz (4)
$ wtf_0.36.0_linux_armv6/wtfutil (5)
- Releases ページから最新のバイナリとチェックサムファイルを入手
- チェックサムファイルの中を見ると桁数的にsha256のようだったので,sha256sumでチェックサムを確認
- アーカイブの確認
- アーカイブの展開
- WTF起動
バイナリアーカイブをダウンロードして展開しました.
wtf_0.36.0_linux_armv6/wtfutil
を実行すると既定値で起動します.しかし娘の設定だとターミナルサイズ固定だったりあまり嬉しくありません.
リポジトリの _sample_configs
以下にサンプルがあるのでこれを指定して起動してみます.
設定ファイルは既定値は ~/.config/wtf/config.yml
を使います.存在しない場合はデフォルトのものが生成されます.若しくは wtf の -c, --config=
オプションで指定した設定ファイルを指定できます.
$ wtf_0.36.0_linux_armv6/wtfutil --config=../src/wtf/_sample_configs/sample_config.yml
wtfリポジトリの _sample_configs/sample_config.yml
を指定して起動するとこんな感じでターミナルサイズにも追従していい感じです.
diff --git a/_sample_configs/sample_config.yml b/_sample_configs/sample_config.yml
index e16690a0..fa3bf5c0 100644
--- a/_sample_configs/sample_config.yml
+++ b/_sample_configs/sample_config.yml
@@ -73,10 +73,21 @@ wtf:
width: 1
refreshInterval: 15
sort: "alphabetical"
+ feedreader:
+ enabled: true
+ feeds:
+ - https://nitter.matoken.org/matoken1/rss
+ feedLimit: 10
+ position:
+ top: 1
+ left: 3
+ height: 1
+ width: 1
+ updateInterval: 14400
battery:
type: power
title: "⚡️"
- enabled: true
+ enabled: false
position:
top: 1
left: 3
Raspberry Piは電源ステータスは見えないので無効にして代わりにfeedreaderを有効にしてNitter経由でTwitterのRSSフィードを表示してみました.
日本語や絵文字も崩れず表示できて良さそうですね.
その他にもたくさんのモジュールがあるようです.こちらのページから確認できます.(Nitterを通さなくてもTwitterモジュールもあった)
自分の用途に合わせて設定していくと便利そうです.
$ wtf_0.36.0_linux_armv6/wtfutil --version 0.36.0 (2021-03-23T10:33:30Z) $ lsb_release -dr Description: Raspbian GNU/Linux 10 (buster) Release: 10 $ uname -m armv7l $ cat /proc/device-tree/model ;echo Raspberry Pi 3 Model B Rev 1.2
Twitterクライアントsayakaちゃんの最新版(3.5.0)をLinuxでビルドする
追記2021-03-09)
Raspberry Pi OS buster armhf 及び Ubuntu 21.04 (development branch) amd64でも同様にビルドできました :)
ターミナルで動作するTwitterクライアントとしてsayakaちゃんというものがあります.NetBSDの入ったSHARP X68030でも動作するという軽量なクライアントで,SIXELで画像が表示できたりストリームモードがあってハッシュタグなどを垂れ流すのに便利に使っています.
今日オープンソースカンファレンス2021 Online/Spring 2日目があって @ebijunさんの「NetBSDのご紹介」 を視聴していたのですが,新しいバージョンの 3.5.0 がリリースされたとのことで試してみました.
twitter クライアント sayaka ちゃん version 3.5.0 (2021/03/03) ターミナルに特化した twitter クライアントです。 フィルタストリームの垂れ流しが出来ます。 フィルタストリームによる疑似ホームタイムラインが表示できます。 mlterm などの SIXEL 対応ターミナル用です。 X68030/25MHz、メモリ12MB でも快適(?)動作。 更新履歴 3.5.0 (2021/03/03) … C++ に移行し vala 版廃止。 画像は現在のところ JPEG, PNG のみ対応。 ターミナル背景色の自動取得を実装。 --protect、--support-evs オプション廃止。 --noimg オプションを廃止 (--no-image に変更)。 userstream 時代の録画データの再生機能廃止。
watchしてたけどメール届いていないようです?
現在のバーションを確認してみます.1つ前のバージョンぽいですね.
$ sayaka --version
sayaka.vala 3.4.6 (2020/11/10)
ビルドを試みます.
$ git clone https://github.com/isaki68k/sayaka/ (1)
$ cd sayaka
$ git checkout 3.5.0
HEAD is now at 958f630 ver 3.5.0 (2021/03/03)
$ ./configure (2)
- sayakaのsourceをclone
- configure
足りないものがパッケージ名で表示されて助かります :)
configure: error: *** mbedtls not found.
On Ubuntu, sudo apt install libmbedtls-dev
configure: error: *** mbedtls not found.
On Ubuntu, sudo apt install libmbedtls-dev
./configure
が通ったらmake……失敗です.
$ make
(cd src; make all)
make[1]: Entering directory '/home/matoken/src/sayaka/src'
Makefile:3: *** missing separator. Stop.
make[1]: Leaving directory '/home/matoken/src/sayaka/src'
make: *** [Makefile:2: all] Error 2
必要なものをよく見ると,GNU makeではなく BSD make が必要となっていました.(3.4.6を確認するとこのときはGNU makeなので今回変わったようです)
必要なもの C++17 compiler jpeg (libjpeg) libpng mbedtls (2.9.0 or later?) BSD make (not GNU make)
BSD makeを導入してGNU makeではなくBSD makeを使います.
$ sudo apt install bmake (1)
$ bmake sayaka (2)
$ src/sayaka --version (3)
sayaka version 3.5.0 (2021/03/03)
$ install src/sayaka ~/bin/ (4)
- BSD makeを導入
- BSD makeでsayakaをmake
- 出来上がったsayakaを叩いてみる
- sayakaを適当な場所( ~/bin )にコピーにinstall
ということでsayaka 3.5.0 にできました :)
私はmlterm等のSIXEL対応端末で検索したいキーワードを繋げていってデスクトップの横においておくといった感じで使っています.
mlterm+sayakaとyoutube-dl+ffplay で #osc21on.spring pic.twitter.com/fjyOk0NNKJ
— matoken (@matoken1) March 6, 2021
$ sayaka --version sayaka version 3.5.0 (2021/03/03) $ ldd src/sayaka | cut -f1 -d"(" | cut -f3 -d" " | xargs -n1 apt-file search | cut -f1 -d: | uniq | xargs dpkg-query -W | grep amd64 libbsd0:amd64 0.11.3-1 libc6:amd64 2.31-9 libgcc-s1:amd64 10.2.1-6 libjpeg62-turbo:amd64 1:2.0.6-2 libmbedcrypto3:amd64 2.16.9-0.1 libmbedtls12:amd64 2.16.9-0.1 libmbedx509-0:amd64 2.16.9-0.1 libmd0:amd64 1.0.3-3 libpng16-16:amd64 1.6.37-3 libstdc++6:amd64 10.2.1-6 zlib1g:amd64 1:1.2.11.dfsg-2 $ dpkg-query -W bmake build-essential bmake 20200710-7 build-essential 12.9 $ lsb_release -dr Description: Debian GNU/Linux bullseye/sid Release: unstable $ uname -m x86_64
端末上で遊べる障害物避けゲームのascii runner
端末上で遊ぶ障害物をスペースバーでジャンプして避けるゲーム.自キャラの4本足の生き物の動きがコミカルです.でも案外難しい.
macOS/Linux のamd64 だったらバイナリやパッケージがあるのでそれを使うのが良いです.
buildする場合はこんな感じで(結構時間掛かった)
$ sudo apt install haskell-stack $ git clone https://github.com/smallhadroncollider/ascii-runner $ cd ascii-runner $ stack build $ stack install $ runner
端末での操作をSVG形式で記録する termtosvg
ttyrec/playみたいに端末操作を録画出来るアプリケーション.再生はウェブブラウザなどでできます.
導入はpipで
$ pip3 install termtosvg $ termtosvg -h usage: termtosvg [output_file] [--font FONT] [--theme THEME] [--help] [--verbose] Record a terminal session and render an SVG animation on the fly positional arguments: output_file optional filename of the SVG animation; if missing, a random filename will be automatically generated optional arguments: -h, --help show this help message and exit --font FONT font to specify in the CSS portion of the SVG animation (DejaVu Sans Mono, Monaco...). If the font is not installed on the viewer's machine, the browser will display a default monospaced font instead. --theme THEME color theme used to render the terminal session (circus, classic-dark, classic-light, dracula, isotope, marrakesh, material, monokai, solarized-dark, solarized-light, zenburn) -v, --verbose increase log messages verbosity See also 'termtosvg record --help' and 'termtosvg render --help'
導入後実行するとそのまま端末に戻ってexitするまでの操作を記録してくれる.exitするとSVGを書き出してそのファイル名を教えてくれる.
mk@T430s:~ (551)$ termtosvg Recording started, enter "exit" command or Control-D to end mk@T430s:~ (554)$ cowsay -f duck "hello termtosvg!" __________________ < hello termtosvg! > ------------------ \ \ \ >()_ (__)__ _ mk@T430s:~ (555)$ cowsay -f duck "hello termtosvg!"|lolcat __________________ < hello termtosvg! > ------------------ \ \ \ >()_ (__)__ _ mk@T430s:~ (556)$ exit Recording ended, SVG animation is /tmp/termtosvg_vpd7hh0z.svg
出来上がったファイルはSVGなので中を見てコピペとか出来なくはない.
$ xmllint --format /tmp/termtosvg_vpd7hh0z.svg|head <?xml version="1.0" encoding="utf-8"?> <svg xmlns="http://www.w3.org/2000/svg" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xlink="http://www.w3.org/1999/xlink" baseProfile="full" height="408" version="1.1" width="640"> <defs> <style type="text/css"><![CDATA[* {font-family: "DejaVu Sans Mono", monospace; font-style: normal; font-size: 14px} text {dominant-baseline: text-before-edge} .bold {font-weight: bold} .background {fill: #002b36}]]></style> <g id="1"> <text fill="#93a1a1" lengthAdjust="spacingAndGlyphs" textLength="144" x="0">mk@T430s:~ (554)$ </text> <text fill="#002b36" lengthAdjust="spacingAndGlyphs" textLength="8" x="144"> </text>
以下にexampleがある
サーバにアップロードして共有だとasciinemaが便利だけどこれはこれでファイル一個なので便利そうです.
Python製でライセンスはBSD 3-Clause Licenseです.