stretch – matoken's blog https://matoken.org/blog Is there no plan B? Wed, 16 Jan 2019 22:27:18 +0000 ja hourly 1 https://wordpress.org/?v=6.7.2 https://matoken.org/blog/wp-content/uploads/2025/03/cropped-1865f695c4eecc844385acef2f078255036adccd42c254580ea3844543ab56d9-32x32.jpeg stretch – matoken's blog https://matoken.org/blog 32 32 Nextcloudの公開リンクURLをカスタマイズできるShareRenamerを試す https://matoken.org/blog/2019/01/17/try-sharerenamer-which-can-customize-the-public-link-url-of-nextcloud/ https://matoken.org/blog/2019/01/17/try-sharerenamer-which-can-customize-the-public-link-url-of-nextcloud/#respond Wed, 16 Jan 2019 22:27:18 +0000 http://matoken.org/blog/?p=2290 NextcloudでURLで共有を行うと,ランダムな文字列のURLが生成されます.これは第三者が推測しにくいようになっています.
しかし,印刷物などでURLを教える際には入力するのがとても面倒です.

ShareRenamerを使うとURLを任意の文字列に変更できるようになるのでこの問題が解決できそうです.

ShareRenamerを導入した後にURLで共有を行うと,rename用のテキストボックスるが現れます.このテキストボックスに任意の文字列を入力して「Rename」ボタンを押すと好きな文字列に変更できます.

20190115-21-01-54-25819.jpg

20190115-21-01-52-26787.jpg

一般公開してはいけない場合はパスワードで保護するようにしましょう.

]]>
https://matoken.org/blog/2019/01/17/try-sharerenamer-which-can-customize-the-public-link-url-of-nextcloud/feed/ 0
Debian, Ubuntu で 上流のパッケージを借りてくる https://matoken.org/blog/2018/10/23/debian-ubuntu-borrows-the-upstream-package/ https://matoken.org/blog/2018/10/23/debian-ubuntu-borrows-the-upstream-package/#comments Tue, 23 Oct 2018 14:10:12 +0000 http://matoken.org/blog/?p=2190

以前以下のような記事を書きました.

今でもこのblogの中ではアクセスが多く,最近もトラックバックをもらいました.

この当時は arm64 の mozcパッケージがなくて自分でbuild したという話なのですが,現在はDebian では buster(testing), Ubuntu ではartful(17.10) 以降でパッケージが存在します.
なのでこの野良パッケージを使うよりも公式の上流パッケージを借りるほうが大抵の場合いいと思います.
ということで手順を書いておきます.

パッケージファイルだけが必要な場合はパッケージのページからダウンロード可能です.

野良パッケージは近日中に削除します.

Debian stretch arm64 に Debian buster arm64 の mozc を借りてくる

Debian stretch arm64 では mozc-data しかない
$ apt-cache search mozc
mozc-data - Mozc input method - data files

buster(testing) のmozc を借りてくることにする.

/etc/apt/preferences で buster の優先度を下げる

/etc/apt/preferences
Package: *
Pin: release n=buster
Pin-Priority: 100
/etc/apt/sources.list に buster(testing)追加 設定
deb http://deb.debian.org/debian buster main

sources.list の編集には apt edit-sources を使うと文法チェックをしてくれるのでおすすめ

パッケージ情報の更新
$ sudo apt update
mozcパッケージの確認
$ apt-cache search mozc
mozc-data - Mozc input method - data files
fcitx-dbus-status - Addon for Fcitx to set/get/monitor IM statuses via D-Bus
emacs-mozc - Mozc for Emacs
emacs-mozc-bin - Helper module for emacs-mozc
fcitx-mozc - Mozc engine for fcitx - Client of the Mozc input method
ibus-mozc - Mozc engine for IBus - Client of the Mozc input method
mozc-server - Server of the Mozc input method
mozc-utils-gui - GUI utilities of the Mozc input method
uim-mozc - Mozc engine for uim - Client of the Mozc input method
パッケージの導入
$ apt install fcitx-mozc -t buster

後は通常の apt update && apt upgrade で stretch で導入したパッケージは stretch で,buster で導入したパッケージはbuster で更新されるはず.

Ubuntu 16.04 LTS xenial arm64 に Ubuntu 18.04 LTS bionic arm64 の mozc を借りてくる

Debianの手順と同じでもokだと思うけど念の為以下の手順を真似してみる.

mozc は Ubuntu 17.10 artful から対応しているが,もうサポートされないのでUbuntu 18.04 bionic を使う.

標準のリリースを xenial に設定

/etc/apt/apt.conf.d/01ubuntu
APT::Default-Release "xenial";

mozc をpinningする

/etc/apt/preferences
Package: *mozc*
Pin: release n=xenial
Pin-Priority: -10

Package: *mozc*
Pin: release n=bionic
Pin-Priority: 900

/etc/apt/sources.list に buster(testing) を 追加 設定

/etc/apt/sources.list
deb http://ports.ubuntu.com/ bionic main universe

※sources.list の編集には apt edit-sources を使うと文法チェックをしてくれるのでおすすめ
※mirrorにより arm64 が置かれていないので注意

パッケージ情報の更新
$ sudo apt update
検索結果にmozcが出てくる
$ apt-cache search mozc
mozc-data - Mozc input method - data files
ibus-mozc - Mozc engine for IBus - Client of the Mozc input method
mozc-server - Server of the Mozc input method
mozc-utils-gui - GUI utilities of the Mozc input method
emacs-mozc - Mozc for Emacs
emacs-mozc-bin - Helper module for emacs-mozc
fcitx-mozc - Mozc engine for fcitx - Client of the Mozc input method
uim-mozc - Mozc engine for uim - Client of the Mozc input method
パッケージの導入
$ sudo apt install fcitx-mozc -t bionic
]]>
https://matoken.org/blog/2018/10/23/debian-ubuntu-borrows-the-upstream-package/feed/ 2
ssh環境での誤ったシステム停止を防ぐmolly-guard https://matoken.org/blog/2018/09/27/prevents-erroneous-system-outages-in-ssh-environment-molly-guard/ https://matoken.org/blog/2018/09/27/prevents-erroneous-system-outages-in-ssh-environment-molly-guard/#respond Wed, 26 Sep 2018 21:34:31 +0000 http://matoken.org/blog/?p=2143

最近 shutdown の man を見比べたりしてたのですが,そのときに systemd, sysvinit 以外に molly-guard という見知らぬものが.

$ apt-file search /sbin/shutdown
molly-guard: /sbin/shutdown
systemd-sysv: /sbin/shutdown
sysvinit-core: /sbin/shutdown

パッケージ情報をみると shutdown コマンドなどを置き換えて ssh 接続時には確認のためにホスト名を聞くようになるようです.
これにより手元のPCの再起動をしたつもりがリモートのサーバを再起動してしまうなどといったことが防げるようになります.

$ apt show molly-guard
Package: molly-guard
Version: 0.6.4
Priority: extra
Section: admin
Maintainer: Francois Marier <francois@debian.org>
Installed-Size: 57.3 kB
Depends: procps
Enhances: init, kexec-tools, mosh, openssh-server, pm-utils, systemd, sysvinit, upstart
Tag: implemented-in::shell, interface::commandline, network::server,
 protocol::ssh, role::program, scope::utility
Download-Size: 13.8 kB
APT-Manual-Installed: yes
APT-Sources: http://ftp.jp.debian.org/debian stretch/main amd64 Packages
Description: protects machines from accidental shutdowns/reboots
 The package installs a shell script that overrides the existing
 shutdown/reboot/halt/poweroff/coldreboot/pm-hibernate/pm-suspend* commands
 and first runs a set of scripts, which all have to exit successfully,
 before molly-guard invokes the real command.
 .
 One of the scripts checks for existing SSH sessions. If any of the four
 commands are called interactively over an SSH session, the shell script
 prompts you to enter the name of the host you wish to shut down. This should
 adequately prevent you from accidental shutdowns and reboots.
 .
 molly-guard diverts the real binaries to /lib/molly-guard/.  You can bypass
 molly-guard by running those binaries directly.

早速試してみます.

$ sudo apt install molly-guard
    :
package diverts others to: /lib/molly-guard/coldreboot
/sbin/halt
package diverts others to: /lib/molly-guard/halt
/sbin/pm-hibernate
/sbin/pm-suspend
/sbin/pm-suspend-hybrid
/sbin/poweroff
package diverts others to: /lib/molly-guard/poweroff
/sbin/reboot
package diverts others to: /lib/molly-guard/reboot
/sbin/shutdown
package diverts others to: /lib/molly-guard/shutdown

このあたりのコマンドが置き換わっています.

$ ls -l /sbin | grep molly
lrwxrwxrwx 1 root root        28 Aug 16  2016 coldreboot -> /lib/molly-guard/molly-guard
lrwxrwxrwx 1 root root        28 Aug 16  2016 halt -> /lib/molly-guard/molly-guard
lrwxrwxrwx 1 root root        28 Aug 16  2016 pm-hibernate -> /lib/molly-guard/molly-guard
lrwxrwxrwx 1 root root        28 Aug 16  2016 pm-suspend -> /lib/molly-guard/molly-guard
lrwxrwxrwx 1 root root        28 Aug 16  2016 pm-suspend-hybrid -> /lib/molly-guard/molly-guard
lrwxrwxrwx 1 root root        28 Aug 16  2016 poweroff -> /lib/molly-guard/molly-guard
lrwxrwxrwx 1 root root        28 Aug 16  2016 reboot -> /lib/molly-guard/molly-guard
lrwxrwxrwx 1 root root        28 Aug 16  2016 shutdown -> /lib/molly-guard/molly-guard

コマンド類は /lib/molly-guard 以下に退避されるようです.

sysvinit
$ ls -lA /lib/molly-guard
total 48
-rwxr-xr-x 1 root root 18952 Feb 13  2017 halt
-rwxr-xr-x 1 root root  2767 Aug 16  2016 molly-guard
lrwxrwxrwx 1 root root     4 Feb 13  2017 poweroff -> halt
lrwxrwxrwx 1 root root     4 Feb 13  2017 reboot -> halt
-rwxr-xr-x 1 root root 23368 Feb 13  2017 shutdown
systemd
$ ls -lA /lib/molly-guard
total 4
lrwxrwxrwx 1 root root   14 Jun 14 05:20 halt -> /bin/systemctl
-rwxr-xr-x 1 root root 2767 Aug 16  2016 molly-guard
lrwxrwxrwx 1 root root   14 Jun 14 05:20 poweroff -> /bin/systemctl
lrwxrwxrwx 1 root root   14 Jun 14 05:20 reboot -> /bin/systemctl
lrwxrwxrwx 1 root root   14 Jun 14 05:20 shutdown -> /bin/systemctl

ssh 経由で shutdown(sysvinit) を試みるとこのように hostname を求められます.ここで誤った hostname を書くと shutdown がキャンセルされました.

$ sudo shutdown -f -P -h +10 "kernel update (`uname -r`)"
W: molly-guard: SSH session detected!
Please type in hostname of the machine to shutdown: desktop
Good thing I asked; I won't shutdown debian ...
W: aborting shutdown due to 30-query-hostname exiting with code 1.

正しい hostname を指定すると shutdown が呼ばれます.

$ sudo shutdown -f -P -h +10 "kernel update (`uname -r`)"
W: molly-guard: SSH session detected!
Please type in hostname of the machine to shutdown: debian

Broadcast message from root@debian (pts/0) (Thu Sep 27 06:15:28 2018):

kernel update (4.9.0-3-amd64)
The system is going DOWN for system halt in 10 minutes!
^C
Shutdown cancelled.

ssh経由でない場合は molly-guard はすぐに shutdown を呼びます.

$ sudo shutdown -f -P -h +10 'poweroff'
^C
Shutdown cancelled.

環境

$ dpkg-query -W systemd-sysv molly-guard
molly-guard     0.6.4
systemd-sysv    232-25+deb9u4
$ dpkg-query -W sysvinit-core
sysvinit-core   2.88dsf-59.9
$ cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
NAME="Debian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
$ cat /etc/debian_version
9.5
$ uname -m
x86_64
]]>
https://matoken.org/blog/2018/09/27/prevents-erroneous-system-outages-in-ssh-environment-molly-guard/feed/ 0
Debian stretch で php5 / php7.0 を切り替え https://matoken.org/blog/2018/09/14/switch-between-php-5-php-7-0-with-debian-stretch/ https://matoken.org/blog/2018/09/14/switch-between-php-5-php-7-0-with-debian-stretch/#respond Thu, 13 Sep 2018 21:34:26 +0000 http://matoken.org/blog/?p=2113

update-alternatives で OK かなと思ったのですが,

$ sudo update-alternatives --config php
There are 2 choices for the alternative php (providing /usr/bin/php).

  Selection    Path             Priority   Status

--------------------

* 0            /usr/bin/php7.0   70        auto mode
  1            /usr/bin/php5     50        manual mode
  2            /usr/bin/php7.0   70        manual mode
  Press <enter> to keep the current choice[*], or type selection number: 0
$ php -v
PHP 7.0.30-0+deb9u1 (cli) (built: Jun 14 2018 13:50:25) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.30-0+deb9u1, Copyright (c) 1999-2017, by Zend Technologies

apache では php5 のままです.

$ w3m -dump http://localhost/phpinfo.php|grep -m1 'PHP Version'
PHP Version 5.6.30-0+deb8u1

apache module を切り替えたらokでした.

$ sudo a2dismod php5
$ sudo a2enmod php7.0
$ systemctl restart apache2
環境
$ dpkg-query -W apache2 php5 libapache2-mod-php5 php7.0 libapache2-mod-php7.0
apache2 2.4.25-3+deb9u5
libapache2-mod-php5     5.6.30+dfsg-0+deb8u1
libapache2-mod-php7.0   7.0.30-0+deb9u1
php5    5.6.30+dfsg-0+deb8u1
php7.0  7.0.30-0+deb9u1
$ lsb_release -d
Description:    Debian GNU/Linux 9.5 (stretch)
$ uname -m
x86_64
]]>
https://matoken.org/blog/2018/09/14/switch-between-php-5-php-7-0-with-debian-stretch/feed/ 0
Mailmanのban_listを画像にする https://matoken.org/blog/2018/07/12/mailmans-ban_list-as-image/ https://matoken.org/blog/2018/07/12/mailmans-ban_list-as-image/#respond Thu, 12 Jul 2018 12:12:22 +0000 http://matoken.org/blog/?p=1993 最近Mailmanにbotからであろう登録が沢山やってくるようになりました.登録メールアドレスは大抵メジャーなフリーメールアドレスで生きているようなのですが,quotaや転送量のエラーとなって帰ってきます.これらのエラーメールでメールボックスがあふれて辛いです.

Mailmanにcaptchaか何かを設置できるプラグインとか無いかなと探してみたのですが,公式ではないようです.sourceを修正してGoogleのReCaptchaを実装している人は居ますが,バージョンアップのたびにパッチするのは面倒です.最近もセキュリティホールが見つかっていますし放置するわけにも生きません.

該当メールを見ると幸いメールアドレスは使い回しでバリエーションは多くありません.とりあえずMailmanのban_listにこれらのメールアドレスを登録してmailqに溜まっている該当メールはdropしました.1週間くらいしたらリモートからのエラーメールも無くなって静かになると良いなと思っています.
ban_listに登録しましたが,もしかしたらbotではなく普通に登録しようとしてメールボックスがあふれている人も居るかもしれません.それが解るようにban_listを申し込みページに表示することにしました.そのまま表示するのは良くない気がするので画像にしてノイズを散らして波型変形をかけてみました.
Mailmanのconfig_listコマンドで設定を出力してban_listをファイルに書き出し,Imagemagickのconvertコマンドでノイズと波型変形のフィルタをかけて画像を生成しました.
こんな感じの画像になります.これを申し込みページに説明と一緒に載せます.(ノイズのせいで容量が大きく……)

image

cronに登録しました.

$ sudo -u list crontab -l|grep ban_list
39 * * * *      /usr/lib/mailman/bin/config_list -c -o /dev/stdout users|grep ^ban_list |sed -e 's/^.*\[\|\]\|'\''\|'\ '//g'|sed -e 's/\@/ at /g'|tr -s ',' '\n' | sort -n > /var/lib/mailman/lists/users/ban_list && convert -size 1024x600 -background '#FFFFFF' -density 36 -gravity Center -fill black -font SetoFont label:"users ban_list `stat -c \%y /var/lib/mailman/lists/users/ban_list|cut -f1 -d.`\n\n`cat /var/lib/mailman/lists/users/ban_list`" -attenuate 5 -noise 7 +noise Gaussian -wave 15x`expr \( 100 + $((RANDOM \% 100)) \)` /var/lib/mailman/archives/public/users/ban_list.jpg

……長いですね.それに画像サイズ固定なのでlistが増えると文字サイズが小さくなってしまいます.てことでscriptに.

#!/bin/sh
 
LISTNAME='users'
FONT='SetoFont'
BANLIST='/var/lib/mailman/lists/users/ban_list'
IMAGE='/var/lib/mailman/archives/public/users/ban_list.jpg'
 
# ban_listを抽出してファイルに書き出し
/usr/lib/mailman/bin/config_list -c -o /dev/stdout ${LISTNAME} | grep ^ban_list | sed -e 's/^.*\[\|\]\|'\''\|''//g' | sed -e 's/\@/ at /g' | tr -s ',' '\n' | sort -n > ${BANLIST}
 
# ban_listの行数によって画像高さを計算
BANWC=`wc -l ${BANLIST} | cut -d -f1`
HIGHT=`expr \( ${BANWC} \* 60 + 120 \)`
 
# 画像に書き出す文字列を作成
LABEL="users ban_list `stat -c \%${BANLIST} | cut -f1 -d.`\n\n`cat ${BANLIST}`"
 
# 波型変形の波の深さを計算
WAVEX=`expr \( 10 + $((RANDOM % 10)) \)`
WAVEY=`expr \( 100 + $((RANDOM % 100)) \)`
 
# 画像作成
convert -size 1024x${HIGHT} -background '#FFFFFF' -density 36 -gravity Center -fill black -font ${FONT} label:"${LABEL}" -attenuate 5 -noise 7 +noise Gaussian -wave ${WAVWX}x${WAVEY} ${IMAGE}
 

てことでとりあえずの対処療法ですが…….

環境

$ lsb_release -d
Description:    Debian GNU/Linux 9.4 (stretch)
$ uname -m
x86_64
$ dpkg-query -W mailman
mailman 1:2.1.23-1+deb9u2
$ dpkg-query -W imagemagick
imagemagick     8:6.9.7.4+dfsg-11+deb9u4
]]>
https://matoken.org/blog/2018/07/12/mailmans-ban_list-as-image/feed/ 0
Let’s Encryptの更新に失敗する https://matoken.org/blog/2018/03/03/failure-to-update-lets-encrypt/ https://matoken.org/blog/2018/03/03/failure-to-update-lets-encrypt/#respond Sat, 03 Mar 2018 05:56:42 +0000 http://matoken.org/blog/?p=1846 最近はこんな感じでLet’s Encryptの証明書の更新を更新しているのですが今回失敗しました.
(DocumenteRootをFQDNにしている前提)

$ sudo /bin/sh -c "/usr/bin/find /etc/letsencrypt/renewal/*.conf -type f | /usr/bin/xargs /usr/bin/basename -s .conf | xargs -n1 -I{} /usr/bin/letsencrypt renew --webroot -w /var/www/{}/ -d {}"

こんなふうに怒られます.
(仕様が変わった?)

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Currently, the renew verb is capable of either renewing all installed certificates that are due to be renewed or renewing a single certificate specified by its name. If you would like to renew specific certificates by their domains, use the certonly command. The renew verb may provide other options for selecting certificates to renew in the future.

とりあえずはletsencrypt renewletsencrypt certonlyにしたら通りました.

$ sudo /bin/sh -c "/usr/bin/find /etc/letsencrypt/renewal/*.conf -type f | /usr/bin/xargs /usr/bin/basename -s .conf | xargs -n1 -I{} /usr/bin/letsencrypt certonly --webroot -w /var/www/{}/ -d {}"

これで更新できたと思ったら1つのドメインで失敗しています.

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Cert is due for renewal, auto-renewing...
Renewing an existing certificate
Performing the following challenges:
http-01 challenge for files.matoken.org
Using the webroot path /var/www/files.matoken.org for all unmatched domains.
Waiting for verification...
Cleaning up challenges
Failed authorization procedure. files.matoken.org (http-01): urn:acme:error:unauthorized :: The client lacks sufficient authorization :: Invalid response from http://files.matoken.org/.well-known/acme-challenge/Be7Aiai4UH9CDqacTaEZOMH4SxSQbtFqxFcPXcCtJEs: "<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>  
</head><body>
<h1>Not Found</h1>
<p"

IMPORTANT NOTES:
 - The following errors were reported by the server:

   Domain: files.matoken.org  
   Type:   unauthorized
   Detail: Invalid response from
   http://files.matoken.org/.well-known/acme-challenge/Be7Aiai4UH9CDqacTaEZOMH4SxSQbtFqxFcPXcCtJEs:
   "<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
   <html><head>
   <title>404 Not Found</title>
   </head><body>
   <h1>Not Found</h1>
   <p"

   To fix these errors, please make sure that your domain name was
   entered correctly and the DNS A record(s) for that domain
   contain(s) the right IP address.

ファイルをDoumentRootに置いてLet’s Encryptからアクセスされるのですがそこでそのファイルが見つからないと失敗しています.このドメインはhttpを設定していませんでした.
てことでapacheでRewriteの設定をしてあげると

RewriteEngine On
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]

通りました.

$ sudo /usr/bin/letsencrypt certonly --webroot -w /var/www/files.matoken.org/ -d files.mato
ken.org
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Cert is due for renewal, auto-renewing...
Renewing an existing certificate
Performing the following challenges:
http-01 challenge for files.matoken.org
Using the webroot path /var/www/files.matoken.org for all unmatched domains.
Waiting for verification...
Cleaning up challenges
Generating key (2048 bits): /etc/letsencrypt/keys/0003_key-certbot.pem
Creating CSR: /etc/letsencrypt/csr/0003_csr-certbot.pem

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at
   /etc/letsencrypt/live/files.matoken.org/fullchain.pem. Your cert
   will expire on 2018-05-31. To obtain a new or tweaked version of
   this certificate in the future, simply run certbot again. To
   non-interactively renew *all* of your certificates, run "certbot
   renew"
 - If you like Certbot, please consider supporting our work by:

   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le

certbotのversionがかなり古いですね…….

$ dpkg -l|grep -i certbot
ii  certbot                               0.10.2-1                          all          automatically configure HTTPS using Let's Encrypt
ii  python-certbot                        0.10.2-1                          all          main library for certbot

てことでbackportのものに入れ替え.

$ sudo apt remove certbot
$ sudo apt install python-certbot-apache -t stretch-backports
$ apt show certbot
Package: certbot
Version: 0.21.1-1~bpo9+1
Priority: optional
Section: web
Source: python-certbot
Maintainer: Debian Let's Encrypt <letsencrypt-devel@lists.alioth.debian.org>
Installed-Size: 53.2 kB
Provides: letsencrypt
Depends: python3-certbot (= 0.21.1-1~bpo9+1), python3:any
Suggests: python3-certbot-apache, python3-certbot-nginx, python-certbot-doc
Breaks: letsencrypt (<= 0.6.0)
Replaces: letsencrypt
Homepage: https://certbot.eff.org/
Download-Size: 20.4 kB
APT-Manual-Installed: no
APT-Sources: http://ftp.jp.debian.org/debian stretch-backports/main amd64 Packages
Description: automatically configure HTTPS using Let's Encrypt
 The objective of Certbot, Let's Encrypt, and the ACME (Automated
 Certificate Management Environment) protocol is to make it possible
 to set up an HTTPS server and have it automatically obtain a
 browser-trusted certificate, without any human intervention. This is
 accomplished by running a certificate management agent on the web
 server.
 .
 This agent is used to:
 .
   - Automatically prove to the Let's Encrypt CA that you control the website
   - Obtain a browser-trusted certificate and set it up on your web server
   - Keep track of when your certificate is going to expire, and renew it
   - Help you revoke the certificate if that ever becomes necessary.
 .
 This package contains the main application, including the standalone
 and the manual authenticators.

N: There is 1 additional record. Please use the '-a' switch to see it

てことでclientが古かったのであまり参考になら無さそうなメモでした.

]]>
https://matoken.org/blog/2018/03/03/failure-to-update-lets-encrypt/feed/ 0
speedtest.netがcliで利用できるspeedtest-cliを試す https://matoken.org/blog/2017/09/09/try_speedtest-cli/ https://matoken.org/blog/2017/09/09/try_speedtest-cli/#respond Fri, 08 Sep 2017 22:30:10 +0000 http://matoken.org/blog/?p=1649 九里 真夏 @orumin そういえば speedtest.net って Linux の CLI client もありますね。

ってことでLinuxのcliで動くPython製のspeedtest-cliをちょっと試してみた.

speedtest.netでの回線速度計測をcliで行えます.python製でpipとかで各種環境に導入可能.

Debianだとjessie以降all, Ubuntuだと16.04LTS以降allにpkgもあるのでapt一発で入るし,Raspberry PiなどのARMアーキテクチャなんかでも問題なく動きました.

規定値の動作はipからロケーション拾ってそこから近いサーバーで計測した結果を返すようです.
自宅のipアドレスでの自動判定では静岡になってたので手動で計測サーバを変更して鹿児島と東京を試しました.

help

$ speedtest-cli -h
usage: speedtest-cli [-h] [--bytes] [--share] [--simple] [--list]
[--server SERVER] [--mini MINI] [--source SOURCE]
[--timeout TIMEOUT] [--secure] [--version]

Command line interface for testing internet bandwidth using speedtest.net.
--------------------------------------------------------------------------
https://github.com/sivel/speedtest-cli

optional arguments:
-h, --help show this help message and exit
--bytes Display values in bytes instead of bits. Does not affect
the image generated by --share
--share Generate and provide a URL to the speedtest.net share
results image
--simple Suppress verbose output, only show basic information
--list Display a list of speedtest.net servers sorted by
distance
--server SERVER Specify a server ID to test against
--mini MINI URL of the Speedtest Mini server
--source SOURCE Source IP address to bind to
--timeout TIMEOUT HTTP timeout in seconds. Default 10
--secure Use HTTPS instead of HTTP when communicating with
speedtest.net operated servers
--version Show the version number and exit

規定値では自宅は静岡になっていて静岡サーバで計測する(実際は鹿児島)

$ speedtest-cli
Retrieving speedtest.net configuration...
Retrieving speedtest.net server list...
Testing from FreeBit (180.131.110.140)...
Selecting best server based on latency...
Hosted by ClickL Network (Shizuoka) [0.02 km]: 110.464 ms
Testing download speed........................................
Download: 2.07 Mbit/s
Testing upload speed..................................................
Upload: 0.92 Mbit/s

日本のサーバを確認する

$ speedtest-cli --list|grep -i japan
14180) ClickL Network (Shizuoka, Japan) [0.02 km]
8407) Allied Telesis Capital Corporation (Sagamihara, Japan) [111.58 km]
6087) Allied Telesis Capital Corporation (Fussa-shi, Japan) [120.41 km]
6508) at2wn (Yokohama, Japan) [125.30 km]
7510) ASEINet (Tokyo, Japan) [141.71 km]
12546) TB (Tokyo, Japan) [141.71 km]
12511) h3zjp (Nerima, Japan) [142.66 km]
8348) Foxcore-LS (Sodegaura, Japan) [167.71 km]
7139) SoftEther Corporation (Tsukuba, Japan) [192.41 km]
6368) gatolabo (Maibara, Japan) [194.62 km]
6766) JAIST(ino-lab) (Nomi, Japan) [232.28 km]
13641) NextechNetworkSolutions (Nara, Japan) [237.53 km]
6476) rxy (individual) (Osaka, Japan) [264.80 km]
8832) prize3046 (Ikeda, Japan) [269.86 km]
8193) kamiari (Sendai, Japan) [427.67 km]
7976) denpa893 (Hikari, Japan) [601.03 km]
6405) Allied Telesis Capital Corporation (Misawa, Japan) [686.38 km]
13568) KSL (Kagoshima, Japan) [820.38 km]
811) GLBB Japan KK (Chatan, Japan) [1397.84 km]
6581) haza (Haebaru, Japan) [1410.56 km]

鹿児島サーバで計測してみる

$ speedtest-cli --server 13568
Retrieving speedtest.net configuration...
Retrieving speedtest.net server list...
Testing from FreeBit (180.131.110.140)...
Hosted by KSL (Kagoshima) [820.38 km]: 103.499 ms
Testing download speed........................................
Download: 2.20 Mbit/s
Testing upload speed..................................................
Upload: 0.92 Mbit/s

東京を–simple optionで計測してみる

$ speedtest-cli --simple --server 7510
Ping: 150.627 ms
Download: 1.88 Mbit/s
Upload: 0.84 Mbit/s

サーバの数を確認してみる

$ speedtest-cli --list | wc -l
6509

speedtestはJavaScriptやAdobe Flashが必要なことが多くてヘッドレス環境などでは面倒でした.
iperfやnetcatなんかはお手軽ですが,速度テスト先のサーバの用意が必要です.

今回のspeedtest-cliはお手軽に導入できて世界各地のサーバ相手にcliでspeed testも出来ていい感じです.

]]>
https://matoken.org/blog/2017/09/09/try_speedtest-cli/feed/ 0
AsciiDocFXをARM64環境とかで試す https://matoken.org/blog/2017/08/03/try-asciidocfx-in-the-arm64/ https://matoken.org/blog/2017/08/03/try-asciidocfx-in-the-arm64/#respond Wed, 02 Aug 2017 21:14:20 +0000 http://matoken.org/blog/?p=1637

最近軽めのライブプレビューが出来てARM環境でも動くAsciiDoc環境がないかなーと探しています.今回はAsciiDocFX.

Java製のマルチプラットホームエディタ.ライブプレビュー機能もあり.

Asciidoc FX is a book / document editor to build PDF, Epub, Mobi and HTML books, documents and slides. AsciidocFX is also a winner of https://www.oracle.com/corporate/pressrelease/dukes-award-102815.html[Duke’s Choice Award 2015].

導入

アーカイブをダウンロードして展開するだけ.アーカイブはOS別にJRE同梱版とJREなし版がある.
Linux版JRE同梱版は中を見るとamd64だった.他のarchtectureではNo_JREを選ぶしかなさそう.

導入例
$ wget https://github.com/asciidocfx/AsciidocFX/releases/download/v1.5.5/AsciidocFX_Linux_No_JRE.tar.gz
$ tar xvf AsciidocFX_Linux_No_JRE.tar.gz
$ AsciidocFX/bin/AsciidocFX

OpenJDKで動かす場合は openjfx pkgも必要.

$ sudo apt install openjdk-8-jre openjfx

ARM64 + OracleJava環境では動作させることができていない.

警告

動作はしたが, overlay-scrollbar が見つからないという警告メッセージが出る.

$ ./AsciidocFX
Gtk-Message: Failed to load module "overlay-scrollbar"

overlay-scrollbar-gtk2 pkgを導入することで解決.

$ sudo apt install overlay-scrollbar-gtk2

使い勝手

  • ライブプレビューがあるのはやはり便利

    • よくずれるけども……

  • 動作はCore2Duoマシンでも起動には時間がかかるが起動すれば問題なく利用できる

    • ARM64(1.2GHz 64-Bit Quad-Core ARM Cortex A54)+OpenJDK環境ではキー入力からのタイムラグが気になって辛い

  • 書き出しフォーマットがHTML, PDF, Ebook(mobi/Epub), Docbookと豊富

    • しかしGUIでしか利用できないようでMarpと同じようなもどかしさがある

  • 基本的に3ペインで,左端はファイラー,アウトライン,最近使ったファイルが利用できるが閉じることも出来る(左端のアクティブなタブをクリック)

  • 右端ペインはプレビュー,設定が可能でこれも閉じること出来る(右端のアクティブなタブをクリック)

  • マウスの中ボタンや,shift+Insでの貼付けができない

  • 通常のコピー,ペーストもできなくなることがある

  • 利用中にフォントが滲むような表示になる

    • エディタ画面やプレビュー画面は更新で直るが他の部分は起動し直さないと直らない

てことでマウス中ボタン貼り付けや手持ちのARMで重いってことで選外に.

]]>
https://matoken.org/blog/2017/08/03/try-asciidocfx-in-the-arm64/feed/ 0
Debian arm64環境にOracle Java導入 https://matoken.org/blog/2017/08/01/debian-arm64%e7%92%b0%e5%a2%83%e3%81%aboracle-java%e5%b0%8e%e5%85%a5/ https://matoken.org/blog/2017/08/01/debian-arm64%e7%92%b0%e5%a2%83%e3%81%aboracle-java%e5%b0%8e%e5%85%a5/#respond Tue, 01 Aug 2017 12:49:26 +0000 http://matoken.org/blog/?p=1631

AsciidocFXはOpenJDKで動かないぽいのでOracle Java入れてみようとして少しはまりました.

Oracle Javaは java-package を使うようになったのかなるほど

ということでまずは java-package pkgを導入.

$ sudo apt install java-package

Oracleからjreを入手と思ったらarmのjaeおらんかった……

jdkには Linux ARM 32 Hard Float ABI, Linux ARM 64 Hard Float ABI があるのでこれを入れてみる.

しかしぐぬぬ.

$ make-jpkg ./jdk-8u141-linux-arm64-vfp-hflt.tar.gz
Creating temporary directory: /tmp/make-jpkg.wW7eUWpw3m
Loading plugins: /usr/share/java-package/common.sh /usr/share/java-package/javase.sh /usr/share/java-package/jdk-doc.sh /usr/share/java-package/oracle-jdk-doc.sh /usr/share/java-package/oracle-jdk.sh /usr/share/java-package/oracle-jre.sh /usr/share/java-package/oracle-server-jre.sh

Detected Debian build architecture: arm64
Detected Debian GNU type: aarch64-linux-gnu

No matching packaging method was found for jdk-8u141-linux-arm64-vfp-hflt.tar.gz.
Please make sure you are using a tar.gz or a self-extracting archive
Removing temporary directory: done

jdkのarchiveを展開して jaja -version とかしてみると動くようなのでダウンロードするファイルは合っていそう.

バグとして上がっていた.

こちらのパッチを使わせてもらう.

$ wget 'https://bugs.debian.org/cgi-bin/bugreport.cgi?att=2;bug=863247;filename=java-package.patch;msg=10' -O java-package.patch
$ sudo patch -P0 -d / < ./java-package.patch
$ time make-jpkg ./jdk-8u141-linux-arm64-vfp-hflt.tar.gz
  :
real    9m58.079s
user    8m53.790s
sys     1m29.510s
$ sha256sum oracle-java8-jdk_8u141_arm64.deb
93a9b6136195616db7e33749eec783a224a125c2b3529385b548a49f5189af12  oracle-java8-jdk_8u141_arm64.deb
$ sudo dpkg -i oracle-java8-jdk_8u141_arm64.deb

javaをOracleに切り替える.

$ sudo update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                              Priority   Status
 ------------------------------------------------------------
* 0            /usr/lib/jvm/java-8-openjdk-arm64/jre/bin/java     1081      auto mode
  1            /usr/lib/jvm/java-8-openjdk-arm64/jre/bin/java     1081      manual mode
  2            /usr/lib/jvm/oracle-java8-jdk-arm64/jre/bin/java   318       manual mode

Press <enter> to keep the current choice[*], or type selection number: 2
update-alternatives: using /usr/lib/jvm/oracle-java8-jdk-arm64/jre/bin/java to provide /usr/bin/java (java) in manual mode
$ java -version
java version "1.8.0_141"
Java(TM) SE Runtime Environment (build 1.8.0_141-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.141-b15, mixed mode)

ところで,なぜOracle Javaをarmで動かしたかったかというとAsciidocFXが実用的かどうかを試したかったからでした.しかし警告を出してすぐに終了してしまいました…….
armで未実装の機能を使っている感じでしょうか?

$ AsciidocFX_Linux_No_JRE/AsciidocFX
Java HotSpot(TM) 64-Bit Server VM warning: G1 GC is disabled in this release.

てことで削除しました.(169MBの容量が開放されました)

$ sudo apt purge oracle-java8-jdk java-package
$ sudo rm -rf /usr/share/java-package
]]>
https://matoken.org/blog/2017/08/01/debian-arm64%e7%92%b0%e5%a2%83%e3%81%aboracle-java%e5%b0%8e%e5%85%a5/feed/ 0
Debianでもarm64でmozc build https://matoken.org/blog/2017/06/05/on-debian-mozc-build-with-arm64/ https://matoken.org/blog/2017/06/05/on-debian-mozc-build-with-arm64/#comments Sun, 04 Jun 2017 23:40:41 +0000 http://matoken.org/blog/?p=1618 EDIT: 現在は次の記事の手順のほうが良いと思います -> Debian, Ubuntu で 上流のパッケージを借りてくる – matoken’s meme


20170605_00:06:13-17276

先日Ubuntu 16.04 arm64環境でmozc pkgを作りました.

今回はDebian stretch arm64でも作ってみました.

環境はQualcomの96BoardのDragonBoard 410cにDebian stretch aarch64のイメージ(dragonboard410c_sdcard_install_debian-233.zip)を使いました.

OSイメージの入手や導入方法などは以下のあたりにあります.

手元では以下のような感じでsd cardに書き込んだ後dipスイッチでsd起動にして起動してeMMCに導入しました.

$ md5sum dragonboard410c_sdcard_install_debian-233.zip
ef17a1602cf0ef300e123a3224e0699d  dragonboard410c_sdcard_install_debian-233.zip
$ unzip -l dragonboard410c_sdcard_install_debian-233.zip
Archive:  dragonboard410c_sdcard_install_debian-233.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
4055891968  2017-05-11 05:25   db410c_sd_install_debian.img
    13953  2017-05-04 21:45   LICENSE
---------                     -------
4055905921                     2 files
$ unzip -p dragonboard410c_sdcard_install_debian-233.zip LICENSE | lv
$ unzip -p dragonboard410c_sdcard_install_debian-233.zip db410c_sd_install_debian.img | pv | sudo dd of=/dev/mmcblk0 bs=4M
$ sync
$ sync
$ sync

後の手順はほぼ前回のUbuntuと同じですが,

dpkg-buildpackage: error: fakeroot not found, either install the fakeroot
package, specify a command with the -r option, or run this as root  

とfakerootが無いと起こられたので導入パッケージにfakerootを追加したのと,

virtual memory exhausted: Cannot allocate memory

という感じでコケたので以下のような感じでスワップファイルを追加して回避しました.前回のUbuntuを入れてる方の機械はRAM2GBなのでRAM1GB+SWAP1GBでも行けると思いますが念の為2GB追加しました.

$ dd if=/dev/zero of=/var/tmp/swap bs=1M count=2048
$ sudo chmod 600 /var/tmp/swap
$ sudo chown 0.0 /var/tmp/swap
$ sudo mkswap /var/tmp/swap
$ sudo swapon /var/tmp/swap
$ free
              total        used        free      shared  buff/cache   available
Mem:         945868      225736      444948       40784      275184      608980
Swap:       2097148           0     2097148

で,パッケージングと導入の手順はこんな感じでした.

$ sudo apt update
$ sudo apt upgrade
$ sudo apt install build-essential devscripts fakeroot
$ sudo apt build-dep mozc
$ apt source mozc
$ wget https://gist.githubusercontent.com/matoken/afce66ce67392c11d3ed20d7bbab5833/raw/2bb0163f30291caa6ba7b41b3d4352c7e6c0b6a7/patch
$ patch -p0 < patch
$ cd mozc-2.19.2623.102+dfsg
$ time dpkg-buildpackage -us -uc -j4
   :
real    111m31.882s
user    88m2.352s
sys     10m59.828s
$ dch -i
$ head debian/changelog 
mozc (2.19.2623.102+dfsg-1.1) unstable; urgency=medium

  * Non-maintainer upload.
  * Update debian/control.
    - Add arm64 to Architecture list.

 -- K.I.Matohara <matoken@gmail.com>  Sat, 03 Jun 2017 22:15:19 +0000

mozc (2.19.2623.102+dfsg-1) unstable; urgency=medium

$ dpkg-buildpackage -j4
$ ls -la ../*dfsg-1.1_*
-rw-r--r-- 1 linaro linaro  2130510 Jun  4 01:10 ../emacs-mozc-bin-dbgsym_2.19.2623.102+dfsg-1.1_arm64.deb
-rw-r--r-- 1 linaro linaro   157710 Jun  4 01:10 ../emacs-mozc-bin_2.19.2623.102+dfsg-1.1_arm64.deb
-rw-r--r-- 1 linaro linaro    28118 Jun  4 01:10 ../emacs-mozc_2.19.2623.102+dfsg-1.1_arm64.deb
-rw-r--r-- 1 linaro linaro  2765446 Jun  4 01:10 ../fcitx-mozc-dbgsym_2.19.2623.102+dfsg-1.1_arm64.deb
-rw-r--r-- 1 linaro linaro   224574 Jun  4 01:10 ../fcitx-mozc_2.19.2623.102+dfsg-1.1_arm64.deb
-rw-r--r-- 1 linaro linaro  3088148 Jun  4 01:10 ../ibus-mozc-dbgsym_2.19.2623.102+dfsg-1.1_arm64.deb
-rw-r--r-- 1 linaro linaro   189886 Jun  4 01:10 ../ibus-mozc_2.19.2623.102+dfsg-1.1_arm64.deb
-rw-r--r-- 1 linaro linaro    14134 Jun  4 01:10 ../mozc-data_2.19.2623.102+dfsg-1.1_all.deb
-rw-r--r-- 1 linaro linaro 24825020 Jun  4 01:11 ../mozc-server-dbgsym_2.19.2623.102+dfsg-1.1_arm64.deb
-rw-r--r-- 1 linaro linaro 12310852 Jun  4 01:11 ../mozc-server_2.19.2623.102+dfsg-1.1_arm64.deb
-rw-r--r-- 1 linaro linaro  9823936 Jun  4 01:11 ../mozc-utils-gui-dbgsym_2.19.2623.102+dfsg-1.1_arm64.deb
-rw-r--r-- 1 linaro linaro   755758 Jun  4 01:11 ../mozc-utils-gui_2.19.2623.102+dfsg-1.1_arm64.deb
-rw-r--r-- 1 linaro linaro    18228 Jun  4 04:00 ../mozc_2.19.2623.102+dfsg-1.1_arm64.buildinfo
-rw-r--r-- 1 linaro linaro     6898 Jun  4 04:00 ../mozc_2.19.2623.102+dfsg-1.1_arm64.changes
-rw-r--r-- 1 linaro linaro  1921396 Jun  4 01:10 ../uim-mozc-dbgsym_2.19.2623.102+dfsg-1.1_arm64.deb
-rw-r--r-- 1 linaro linaro   192712 Jun  4 01:10 ../uim-mozc_2.19.2623.102+dfsg-1.1_arm64.deb
$ sudo apt install ../mozc-server_2.19.2623.102+dfsg-1.1_arm64.deb ../fcitx-mozc_2.19.2623.102+dfsg-1.1_arm64.deb ../mozc-data_2.19.2623.102+dfsg-1.1_all.deb ../mozc-utils-gui_2.19.2623.102+dfsg-1.1_arm64.deb 
$ sudo apt install fcitx-ui-classic

これも一応この辺に置いておきました.多分そのうち消します.(Versionが上がった頃?)

これでとりあえず手元のUbuntu/Debianで利用できるようになりましたが,mozcのバージョンアップ毎にbuildが必要です.なのでBTS予定.あとクロスで試すのとMultiarchも試してみたいです.

参考URL

]]>
https://matoken.org/blog/2017/06/05/on-debian-mozc-build-with-arm64/feed/ 1
Raspberry PiのFreedomBoxで/var/lib/dpkg/statusが壊れたのを復旧 https://matoken.org/blog/2017/04/19/restore-broken-var-lib-dpkg-status-in-freedombox-of-raspberry-pi/ https://matoken.org/blog/2017/04/19/restore-broken-var-lib-dpkg-status-in-freedombox-of-raspberry-pi/#respond Tue, 18 Apr 2017 15:49:36 +0000 http://matoken.org/blog/?p=1601 Raspberry PiでFreedomBoxを試しているのですが,ストレージがmicroSDのせいか修正していたパッケージの依存関係か何かがおかしくなったせいか/var/lib/dpkg/statusが壊れてしまいました.

$ sudo apt update
Hit:1 http://cdn-fastly.deb.debian.org/debian testing InRelease
Reading package lists... Error!
E: Unable to parse package file /var/lib/dpkg/status (1)
W: You may want to run apt-get update to correct these problems
E: The package cache file is corrupted
E: パッケージファイル /var/lib/dpkg/status を解釈することができません (1)
W: これらの問題を解決するためには apt-get update を実行する必要があるかもしれません
E: パッケージキャッシュファイルが壊れています

apt-get updateで治るのかなと思って叩いてみましたが駄目でした.

Debian リファレンス第2章 Debian パッケージ管理によると,

2.6.5. パッケージセレクションの復元

もし何らかの理由で “/var/lib/dpkg/status” の内容が腐った場合には、Debian システムはパッケージ選択データーが失われ大きな打撃を被ります。古い “/var/lib/dpkg/status” ファイルは、”/var/lib/dpkg/status-old” や “/var/backups/dpkg.status.*” としてあるので探します。

“/var/backups/” は多くの重要な情報を保持しているので、これを別のパーティション上に置くのも良い考えです。

とのことなので,/var/lib/dpkg/status-oldから復旧をと思いましたがこれも既に壊れているバージョン./var/backups/dpkg.status.0はまだ壊れていなかったのでこれで上書きして復旧したようです.

$ sudo cp /var/backups/dpkg.status.0 /var/lib/dpkg/status
]]>
https://matoken.org/blog/2017/04/19/restore-broken-var-lib-dpkg-status-in-freedombox-of-raspberry-pi/feed/ 0
DebianのisoイメージをUSBメモリに書き込み https://matoken.org/blog/2017/03/29/write-debian-iso-image-to-usb-memory/ https://matoken.org/blog/2017/03/29/write-debian-iso-image-to-usb-memory/#respond Wed, 29 Mar 2017 09:08:17 +0000 http://matoken.org/blog/?p=1576 gistに貼ってたものだけどせっかくなのでこちらにも.

ファイルダウンロード

今回はDebian stretch Debian Installer rc2のi386版のnetinst.

  • debian-stretch-DI-rc2-i386-netinst.iso : イメージ本体
  • SHA512SUMS : isoファイルのチェックサムファイル
  • SHA512SUMS.sign : SHA512SUMSの署名ファイル
$ wget http://cdimage.debian.org/cdimage/stretch_di_rc2/i386/iso-cd/debian-stretch-DI-rc2-i386-netinst.iso http://cdimage.debian.org/cdimage/stretch_di_rc2/i386/iso-cd/SHA512SUMS.sign http://cdimage.debian.org/cdimage/stretch_di_rc2/i386/iso-cd/SHA512SUMS

※i386/amd64をよく使う場合はmulti-archを使うと1つのUSBメモリでi386/amd64が利用できて便利

チェックサムファイルの署名確認

チェックサムファイルのSHA512SUMSが正常なものか確認

$ gpg --verify SHA512SUMS.sign
gpg: 署名されたデータが'SHA512SUMS'にあると想定します
gpg: 2017年02月02日 07時45分30秒 JSTに施された署名
gpg:                RSA鍵DA87E80D6294BE9Bを使用
gpg: "Debian CD signing key <debian-cd@lists.debian.org>"からの正しい署名 [不明の]
gpg: *警告*: この鍵は信用できる署名で証明されていません!
gpg:       この署名が所有者のものかどうかの検証手段がありません。
 主鍵フィンガープリント: DF9B 9C49 EAA9 2984 3258  9D76 DA87 E80D 6294 BE9B

公開鍵が見つかりません(public key not found)というエラーの場合はgpg --keyserver keyring.debian.org --recv-keys DA87E80D6294BE9Bで鍵をインポートして再度確認.鍵のIDやフィンガープリントは以下のページでも確認できる

ハッシュ確認

isoファイルが正しくダウンロードされているか確認
以下の例はdebian-stretch-DI-rc2-i386-netinst.isoしかダウンロードしていないのでそれ以外のエラーや警告は無視する

$ sha512sum -c SHA512SUMS
sha512sum: debian-mac-stretch-DI-rc2-i386-netinst.iso: そのようなファイルやディレクトリはありません
debian-mac-stretch-DI-rc2-i386-netinst.iso: FAILED open or read
debian-stretch-DI-rc2-i386-netinst.iso: 完了
sha512sum: debian-stretch-DI-rc2-i386-xfce-CD-1.iso: そのようなファイルやディレクトリはありません
debian-stretch-DI-rc2-i386-xfce-CD-1.iso: FAILED open or read
sha512sum: 警告: 一覧にある 2 個のファイルが読み込めませんでした

usbメモリへの書き込み

USBメモリの確認

書き込み先のデバイスが正しいか確認する
USBメモリ接続直後にdmesgを確認したりfdiskコマンドやマウントして中を確認したり……

$ dmesg
  :
[414356.444121] usb 1-1.2: New USB device found, idVendor=13fe, idProduct=1a00
[414356.444128] usb 1-1.2: New USB device strings: Mfr=0, Product=11, SerialNumber=0
[414356.444131] usb 1-1.2: Product: USB 2.0 HUB
[414362.925178] usb-storage 1-1.2.1:1.0: USB Mass Storage device detected
[414362.925967] scsi host6: usb-storage 1-1.2.1:1.0
[414364.184209] sd 6:0:0:1: [sdb] 980480 512-byte logical blocks: (502 MB/479 MiB)
[414364.187102] sd 6:0:0:1: [sdb] Write Protect is off
[414364.187106] sd 6:0:0:1: [sdb] Mode Sense: 23 00 00 00
[414364.190339] sd 6:0:0:1: [sdb] No Caching mode page found
[414364.190345] sd 6:0:0:1: [sdb] Assuming drive cache: write through
[414364.201730]  sdb: sdb1
[414364.201734] sdb: p1 size 982496 extends beyond EOD, enabling native capacity
[414364.214471]  sdb: sdb1
[414364.214475] sdb: p1 size 982496 extends beyond EOD, truncated
[414364.228961] sd 6:0:0:1: [sdb] Attached SCSI removable disk
$ sudo fdisk -l /dev/sdb
Disk /dev/sdb: 478.8 MiB, 502005760 bytes, 980480 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device     Boot Start    End Sectors   Size Id Type
/dev/sdb1  *       32 982527  982496 479.8M  6 FAT16

USBメモリのアンマウント

USBメモリをマウントしている場合はアンマウントしておく

$ sudo umount /dev/sdb1
$ mount | grep /dev/sdb

パーテイション情報の削除

念の為パーテイション情報を削除しておく

$ sudo wipefs /dev/sdb
offset               type
----------------------------------------------------------------
0x1fe                dos   [partition table]

$ sudo wipefs -a /dev/sdb ; sync
/dev/sdb: 2 bytes were erased at offset 0x000001fe (dos): 55 aa
/dev/sdb: calling ioctl to re-read partition table: 成功です

書き込み

進捗状態を確認したい場合はpvコマンドを間に挟んだり,ddrescue / ddrescueなどが利用できる

$ sudo dd if=./debian-stretch-DI-rc2-i386-netinst.iso of=/dev/sdb bs=4M ; sync
95+1 レコード入力
95+1 レコード出力
401604608 bytes (402 MB, 383 MiB) copied, 176.874 s, 2.3 MB/s

書き込みが終わったらUSBメモリを取り外してターゲットマシンで利用する

VirtualBoxで起動確認(余録)

手軽に試せるマシンがなかったのでVirtualBoxからUSBメモリを起動して確認した

USBメモリのディスクイメージ作成

直にUSBメモリを指定できないのでUSBメモリへアクセスするためのvmdkイメージを作成

$ sudo VBoxManage internalcommands createrawvmdk -rawdisk /dev/sdb -filename sdb.vmdk 
RAW host disk access VMDK file sdb.vmdk created successfully.
$ sudo cat sdb.vmdk
# Disk DescriptorFile
version=1
CID=1722e641
parentCID=ffffffff
createType="fullDevice"

# Extent description
RW 980480 FLAT "/dev/sdb" 0

# The disk Data Base 
#DDB

ddb.virtualHWVersion = "4"
ddb.adapterType="ide"
ddb.geometry.cylinders="972"
ddb.geometry.heads="16"
ddb.geometry.sectors="63"
ddb.uuid.image="c2c9d560-049f-4c44-bf8a-0b85e820ba12"
ddb.uuid.parent="00000000-0000-0000-0000-000000000000"
ddb.uuid.modification="00000000-0000-0000-0000-000000000000"
ddb.uuid.parentmodification="00000000-0000-0000-0000-000000000000"

USBメモリにアクセス権のあるユーザでVirtualBoxを起動してUSBメモリのイメージを指定して起動

(ここいまいち……)

$ gksudo virtualbox

]]>
https://matoken.org/blog/2017/03/29/write-debian-iso-image-to-usb-memory/feed/ 0
mikutterからGooglePhotosにアップロードするやつを試す https://matoken.org/blog/2017/03/01/try-mikutter-google-photos-uploader/ https://matoken.org/blog/2017/03/01/try-mikutter-google-photos-uploader/#respond Tue, 28 Feb 2017 23:51:39 +0000 http://matoken.org/blog/?p=1544

というわけで、mikutterのプラグインできた。 https://t.co/6hP23pBziO

— スラマイマラス (@slimymars) 2017年2月25日

Google Photosってことは容量気にせず画像投げられる & Google+との連携もできそう?ってことで試してみました.

#mikutterについてはこちらを.

関連パッケージ導入

$ sudo apt install ruby-oauth2

mikutter-google-photos-uploader plugin導入

$ cd ~/.mikutter/plugin
$ git clone https://github.com/slimymars/mikutter-google-photos-uploader
$ cd mikutter-google-photos-uploader
$ bundle install

mikutter起動

……認識されない.mikutterが古い所為のようです.

$ grep mikutter: ~/.mikutter/plugin/mikutter-google-photos-uploader/.mikutter.yml 
  mikutter: 3.5.2
$ dpkg-query -W mikutter
mikutter        3.5.0+dfsg-1

Debianではjessie-backportsからsidまで3.5.0+dfsg-1experimentalだけ3.5.2+dfsg-1でした.

てことで,experimentalから借りてきます.

sources.listexperimentalがある状態で

$ grep experimental /etc/apt/sources.list
deb http://dennou-q.gfd-dennou.org/debian/ experimental main non-free contrib
deb-src http://dennou-q.gfd-dennou.org/debian/ experimental main non-free contrib

/etc/apt/preferences.d/mikutterを以下のような感じで用意して,

$ cat /etc/apt/preferences.d/mikutter
Package: mikutter
Pin: release a=experimental
Pin-Priority: 800

パッケージを更新して導入.

$ sudo apt upgrade

mikutterでの設定

mikutterが3.5.2になったので認識しました.設定画面を見ると,GooglePhotosというタブが増えているのでそのタブのAuthrise code 取得URLをブラウザで開いて認証し,出てきたコードをAuthrization_codeに貼り付けます.
更にmikutterからアップロードする保存先のアルバムを追加しておきます.GooglePhotosに存在しないアルバムは前もって

から登録しておきましょう.アルバムは複数登録できるので例えば

  • ミク
  • フレンズ

のようにアルバムを登録しておくと画像整理がはかどります?

20170228_19:02:23-16584

実際の画像保存方法は,mikutterの保存したい画像の上で右クリックしてGoogle Photosに画像をアップロードを選び,

shutter_17-03-01_08:33:12_001

その後表示されるアルバムを選択するだけです.

menu_018

Google Photosに見に行くとアップロードされているのが確認できます.

Google+へのクロスポストにも使えるかなと思ったのですが,Google+の投稿画面はタイムラグがあるようで少し待たないと表示されませんでした.これはGoogle側の問題ですね.Google Photosから投稿するようにすれば良さそうです.

関連?Tweet

環境

$ screenfetch
         _,met$$$$$gg.           mk@x220
      ,g$$$$$$$$$$$$$$$P.        OS: Debian 9.0 stretch
    ,g$$P""       """Y$$.".      Kernel: x86_64 Linux 4.9.0-2-amd64
   ,$$P'              `$$$.      Uptime: 4d 18h 51m
  ',$$P       ,ggs.     `$$b:    Packages: 5147
  `d$$'     ,$P"'   .    $$$     Shell: bash 4.4.11
   $$P      d$'     ,    $$P     Resolution: 1366x768
   $$:      $$.   -    ,d$$'     WM: Awesome
   $$\;      Y$b._   _,d$P'      WM Theme: default
   Y$$.    `.`"Y$$$$P"'          CPU: Intel Core i5-2540M CPU @ 3.3GHz
   `$$b      "-.__               GPU: Mesa DRI Intel(R) Sandybridge Mobile 
    `Y$$                         RAM: 13040MiB / 15934MiB
     `Y$$.                      
       `$$b.                    
         `Y$$b.                 
            `"Y$b._             
                `""""           
]]>
https://matoken.org/blog/2017/03/01/try-mikutter-google-photos-uploader/feed/ 0
コマンドスニペットを手軽に調べられるコマンドのborg https://matoken.org/blog/2016/12/11/command-border-for-command-snippet-can-be-easily-examined/ https://matoken.org/blog/2016/12/11/command-border-for-command-snippet-can-be-easily-examined/#respond Sun, 11 Dec 2016 14:56:28 +0000 http://matoken.org/blog/?p=1497

borgはOK borgというsiteのスニペットをコマンドライン上から検索したり編集できるコマンドのようです.borgはgo製でApache License Version 2.0のソフトウェアです.

導入

導入方法は如何から対応バイナリを入手して適当な場所に置き,実行権をつけるだけです.arm linuxとか*BSDとか結構いろいろそろっています.

今回はこんな感じで導入しました.

$ wget https://github.com/ok-borg/borg/releases/download/v0.0.1/borg_linux_amd64 -O ~/usr/local/bin/borg && chmod +x ~/usr/local/bin/borg

利用方法

基本的にコマンドの後ろに調べたいキーワードをつけるだけです.規定値では5つの例が表示されます. bashでloopどう書くんだっけ?

$ borg "bash loop"
(1) Bash Shell Do While Loop Infinite loop?
         [11] while [ `prog -some flags` = "Another instance of this program is running, please exit it first" ]
              -
              bay=$(prog -some flags)
              while [ $bay = "Another instance of this program is running, please exit it first" ]
              do
              echo "Awaiting Access to program"
              bay=$(prog -some flags)
              done
              .....
         [12] while true
              do
         ...  

(2) Bash foreach loop
         [21] xargs cat <filenames.txt
              -
              for fn in `cat filenames.txt`; do
                  echo "the next file is $fn"
                  cat $fn
              done
         [22] for fn in `cat filenames.txt`; do cat "$fn"; done
         [23] while read filename
              do
                  echo "Printing: $filename"
                  cat "$filename"
         ...

(3) Bash loop ping successful
         [31] ((count = 100))                            # Maximum number to try.
              while [[ $count -ne 0 ]] ; do
                  ping -c 1 8.8.8.8                      # Try once.
                  rc=$?
                  if [[ $rc -eq 0 ]] ; then
                      ((count = 1))                      # If okay, flag to exit loop.
                  fi
                  ((count = count - 1))                  # So we don't go forever.
              done
              if [[ $rc -eq 0 ]] ; then                  # Make final determination.
         ...

(4) Limit for bash loop
        [41] for(( i=1; i <= 1000; i++ )); do
                 name=$(date --date="$i day ago" +%Y%m%d%H%M%S)
                 mkdir -p "$name" &&
                 touch "$name/${name}_file" ||
                 break
             done

(5) Bash 'for' loop syntax?
         [51] for (($i=0...
              -
              for ((i=0;i<10;i++))
         [52] for i in `seq 0 9`
              do
                  echo "the i is $i"
              done
         [53] for i in {0..9}
                do
                  echo $i
                done
         ...

画像をタイルに結合って?

$ borg "image tile"
(1) ImageMagick crop huge image
         [11] $ time convert -crop 512x512 +repage huge.tif x/image_out_%d.tif
              real    0m5.623s
              user    0m2.060s
              sys     0m2.148s
              $ time vips dzsave huge.tif x --depth 1 --tile-size 512 --overlap 0 --suffix .tif
              real    0m1.643s
              user    0m1.668s
              sys     0m1.000s
         [12]  convert -monitor -limit area 2mb myLargeImg.tif myLargeImg.mpc
              -
               #!/bin/bash
         ...

(2) Set clipboard to image - pbcopy
        [21] cat image.png | impbcopy -
        [22] # Copy image to clipboard
             uuencode SomeFile.jpg - | pbcopy
             -
             # Paste from clipboard to image file
             pbpaste | uudecode -o AnotherFile.jpg


(3) Using Amazon MapReduce/Hadoop for Image Processing
         [31] and should be able to be done using Bash
         [32] #!/usr/bin/env bash
              # NLineInputFormat gives a single line: key is offset, value is Isotropic Url
              read offset isofile
              # Retrieve file from Isotropic server to local disk
              echo "reporter:status:Retrieving $isofile" >&2
              target=`echo $isofile | awk '{split($0,a,"/");print a[5] a[6]}'`
              filename=$target.tar.bz2
              #$HADOOP_INSTALL/bin/hadoop fs -get $isofile ./$filename
              curl  $isofile -o $filename
         ...

(4) Convert multipage PDF to a single image
        [41] convert in.pdf -append out%d.png
             -
             convert *.png output.pdf
             -
             convert foo?.png output.pdf
        [42] convert in.pdf +append out%d.png

(5) bash cgi won't return image
        [51] echo -ne "Content-type: image/png\n\n"
             -
             echo -e "Content-type: image/png\n"
             -
               -n     do not output the trailing newline

とかとか.

オプションはこんな感じとりあえず省略されないように-fをつけてページャに渡すと良さそう.

$ borg --help
Usage of borg:
-f  (= false)
    Print full results, ie. no more '...'
-h (= "borg.crufter.com")
    Server to connect to
-l  (= 5)
    Result list limit. Defaults to 5
-p  (= false)
    Private search. Your search won't leave a trace. Pinky promise. Don't use this all the time if you want to see the search result relevancy improved

検索だけでなくスニペットの追加や編集もできるようです.

サーバも選べるので自分用のメモを蓄積することもできますね. ちょっと惜しいのはサーバと通信して結果を表示するのでオフラインでは使えないというところ. オフラインで使いたい場合はローカルにサーバを立てるか別の方法を使うしかなさそうです.

]]>
https://matoken.org/blog/2016/12/11/command-border-for-command-snippet-can-be-easily-examined/feed/ 0
端末をWeb共有できるttyd https://matoken.org/blog/2016/12/09/ttyd-which-can-share-the-terminal-on-the-web/ https://matoken.org/blog/2016/12/09/ttyd-which-can-share-the-terminal-on-the-web/#comments Fri, 09 Dec 2016 10:07:01 +0000 http://matoken.org/blog/?p=1485

端末をWebブラウザで共有できるソフトウェエアです. 以前似たものでGoTTYを試してみましたが,ttydはGoTTYインスパイアらしいです. ttydはc製でMITライセンスです.

導入

今回はDebian stretch amd64(testing)に導入しました. README.mdではUbuntu 16.04での手順が書かれていますがそのまま使えました.

$ sudo apt install cmake g++ pkg-config git vim-common libwebsockets-dev libjson-c-dev libssl-dev
$ git clone https://github.com/tsl0922/ttyd.git
$ cd ttyd
$ mkdir build
$ cd build
$ cmake ..
$ make

動かしてみる

$ ./ttyd -p 8080 bash

としてウェブブラウザで http://localhost:8080/ に繋ぐと利用できます. tmuxのセッションを共有して複数のブラウザで1つの端末の操作とかdocker利用とかGoTTYと同じように利用できます.

$ ./ttyd -p 8080 tmux new -A -s ttyd
[2016/12/09 18:54:25:5954] NOTICE: Initial logging level 7
[2016/12/09 18:54:25:5954] NOTICE: Libwebsockets version: 2.0.3 unknown-build-hash
[2016/12/09 18:54:25:5954] NOTICE: IPV6 not compiled in
[2016/12/09 18:54:25:5954] NOTICE: libev support compiled in but disabled
[2016/12/09 18:54:25:5954] NOTICE: libuv support compiled in but disabled
[2016/12/09 18:54:25:5955] NOTICE:  Threads: 1 each 1024 fds
[2016/12/09 18:54:25:5955] NOTICE:  mem: platform fd map:  8192 bytes
[2016/12/09 18:54:25:5955] NOTICE:  Compiled with OpenSSL support
[2016/12/09 18:54:25:5955] NOTICE:  SSL disabled: no LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT
[2016/12/09 18:54:25:5955] NOTICE: Creating Vhost 'default' port 8080, 2 protocols
[2016/12/09 18:54:25:5955] NOTICE:  Listening on port 8080
[2016/12/09 18:54:25:5955] NOTICE:  mem: per-conn:          920 bytes + protocol rx buf
[2016/12/09 18:54:25:5956] NOTICE:  canonical_hostname = x220
[2016/12/09 18:54:25:5956] NOTICE: TTY configuration:
[2016/12/09 18:54:25:5956] NOTICE:   start command: tmux new -A -s ttyd
[2016/12/09 18:54:25:5956] NOTICE:   reconnect timeout: 10s
[2016/12/09 18:54:25:5956] NOTICE:   close signal: SIGHUP (1)
[2016/12/09 18:54:25:6057] NOTICE: lws_protocol_init
[2016/12/09 18:54:25:9806] NOTICE: HTTP connect from localhost (127.0.0.1), path: /
[2016/12/09 18:54:25:0015] NOTICE: HTTP connect from localhost (127.0.0.1), path: /auth_token.js
[2016/12/09 18:54:26:3474] NOTICE: client connected from localhost (127.0.0.1), total: 1
[2016/12/09 18:54:26:3548] NOTICE: started process, pid: 30365
[2016/12/09 18:54:34:2928] NOTICE: HTTP connect from localhost (127.0.0.1), path: /
[2016/12/09 18:54:34:3132] NOTICE: error on reading from skt : 104
[2016/12/09 18:54:34:3132] NOTICE: sending SIGHUP to process 30365
[2016/12/09 18:54:34:3138] NOTICE: process exited with code 256, pid: 30365
[2016/12/09 18:54:34:3138] NOTICE: client disconnected from localhost (127.0.0.1), total: 0
[2016/12/09 18:54:34:5554] NOTICE: HTTP connect from localhost (127.0.0.1), path: /auth_token.js
[2016/12/09 18:54:34:5732] NOTICE: client connected from localhost (127.0.0.1), total: 1
[2016/12/09 18:54:34:5811] NOTICE: started process, pid: 30505
[2016/12/09 18:54:40:0073] NOTICE: wsi 0x556bcbc34500: TIMEDOUT WAITING on 3 (did hdr 0, ah 0x556bcbbc0c50, wl 0, pfd events 0)
[2016/12/09 18:54:40:0074] NOTICE: lws_header_table_detach: wsi 0x556bcbc34500: ah held 6s, ah.rxpos 0, ah.rxlen 0, mode/state 0 4,wsi->more_rx_waiting 0

20161209_18:12:56-1180

GoTTYについてはこちらを.


勉強会向けサーバを作ってみる2 / Rasbian jessieを試す/ Google Authenticatorのパスコードを作る from Kenichiro MATOHARA

]]>
https://matoken.org/blog/2016/12/09/ttyd-which-can-share-the-terminal-on-the-web/feed/ 1
wgetライクにbittorrentを取得するtget https://matoken.org/blog/2016/12/08/wget-like-bittorrent-client-tget/ https://matoken.org/blog/2016/12/08/wget-like-bittorrent-client-tget/#respond Thu, 08 Dec 2016 08:27:02 +0000 http://matoken.org/blog/?p=1481 wgetコマンドのような使い勝手のBittorrentクライアントのtgetを試してみました. node製MITライセンスのアプリケーションです.

導入はnpmで.tgetではなくt-getなので注意.

$ npm install -g t-get

torrentファイル,マグネットリンクの他torrent URLでもダウンロードできるようです. 実行すると以下のようなプログレスが表示されてダウンロードが始まります.行幅はハードコードされているようです.

$ tget https://downloads.raspberrypi.org/raspbian_latest.torrent
 downloading 1 files (1.4GB) [============================= ] 97% 64.0s 588.8KB/s 99 peers

ダウンロード完了時は以下のような感じ.ダウンロード完了後直ちに終了します.

$ tget https://downloads.raspberrypi.org/raspbian_latest.torrent
------------------
2016-11-25-raspbian-jessie.zip 1.4GB
------------------
 downloaded 1 files (1.4GB)

ファイルの保存先はカレントディレクトリで,カレントディレクトリに書き込めない場合はエラーにならずファイルが消えてしまうようです.

便利だけどアップロード関係なく終了してしまうのでBittorrentへの貢献度は低そうです. ちなみに最近はリモートのTransmissionをfile serverで動作させて,Transmission-remote-gtkで操作しています.

]]>
https://matoken.org/blog/2016/12/08/wget-like-bittorrent-client-tget/feed/ 0
Screenfetch的な情報表示コマンドのNeofetch https://matoken.org/blog/2016/12/07/screenfetch-like-information-display-command-neofetch/ https://matoken.org/blog/2016/12/07/screenfetch-like-information-display-command-neofetch/#respond Tue, 06 Dec 2016 21:27:09 +0000 http://matoken.org/blog/?p=1476 Screenfetch的な情報表示コマンドのNeofetch

よくデスクトップのキャプチャを取得するときに表示されているScreenfetchコマンドというものがあります.システムの情報とアスキーアートを素敵に表示してくれます. これににたものでNetfetchというものを見かけたので試してみました.こちらは画像も扱えるようです.

導入

以下のページに各種環境への導入方法が書かれています.

Debian sid/stretchにはパッケージがあるようなことが書かれていますが,

Neofetch is in Debian Unstable/Stretch's official repositories.

今はsidのみのようです.

ということでひとまずstretchではこんな感じで導入しました.

$ #-- /etc/apt/sources.list.d/neofetch を作る
$ sudo apt edit-sources neofetch
$ cat /etc/apt/sources.list.d/neofetch.list
deb http://dl.bintray.com/dawidd6/neofetch jessie main
$ #-- 鍵のインポート
$ wget "https://bintray.com/user/downloadSubjectPublicKey?username=bintray" -O Release-neofetch.key
$ gpg Release-neofetch.key
pub   rsa4096 2015-02-17 [SC]
      8756C4F765C9AC3CB6B85D62379CE192D401AB61
uid           Bintray (by JFrog) <bintray@bintray.com>
sub   rsa4096 2015-02-17 [E]
$ sudo apt-key add Release-neofetch.key
$ rm Release-neofetch.key
$ #-- pkg情報更新&pkg導入
$ sudo apt update
$ sudo apt install neofetch

早速実行

$ neofetch --help

    NEOFETCH

    USAGE: neofetch --option "value" --option "value"

    NOTE: There's also a config option for each flag below.

    Info:
    --disable infoname          Allows you to disable an info line from appearing
                                in the output.
                                NOTE: You can supply multiple args. eg.
                                'neofetch --disable cpu gpu disk shell'
                                NOTE: The arguments must all be lowercase.
    --os_arch on/off            Hide/Show OS architecture.
    --speed_type type           Change the type of cpu speed to display.
                                Possible values: current, min, max, bios,
                                scaling_current, scaling_min, scaling_max
                                NOTE: This only support Linux with cpufreq.
    --cpu_shorthand type        Shorten the output of CPU
                                Possible values: name, speed, tiny, on, off
    --cpu_cores type            Whether or not to display the number of CPU cores
                                Takes: logical, physical, off
                                NOTE: 'physical' doesn't work on BSD.
    --cpu_speed on/off          Hide/Show cpu speed.
    --cpu_temp on/off           Hide/Show cpu temperature.
                                NOTE: This only works on Linux and BSD.
                                NOTE: For FreeBSD-based systems, you need to enable coretemp
                                      kernel module.
    --distro_shorthand on/off   Shorten the output of distro (tiny, on, off)
                                NOTE: This option won't work in Windows (Cygwin)
    --kernel_shorthand on/off   Shorten the output of kernel
                                NOTE: This option won't work in BSDs (except PacBSD and PC-BSD)
    --uptime_shorthand on/off   Shorten the output of uptime (tiny, on, off)
    --refresh_rate on/off       Whether to display the refresh rate of each monitor
                                Unsupported on Windows
    --gpu_brand on/off          Enable/Disable GPU brand in output. (AMD/NVIDIA/Intel)
    --gtk_shorthand on/off      Shorten output of gtk theme/icons
    --gtk2 on/off               Enable/Disable gtk2 theme/icons output
    --gtk3 on/off               Enable/Disable gtk3 theme/icons output
    --shell_path on/off         Enable/Disable showing $SHELL path
    --shell_version on/off      Enable/Disable showing $SHELL version
    --ip_host url               Url to query for public IP
    --song_shorthand on/off     Print the Artist/Title on seperate lines
    --birthday_shorthand on/off Shorten the output of birthday
    --birthday_time on/off      Enable/Disable showing the time in birthday output
    --birthday_format format    Format the birthday output. (Uses 'date' cmd format)

    Text Formatting:
    --colors x x x x x x        Changes the text colors in this order:
                                title, @, underline, subtitle, colon, info
    --underline on/off          Enable/Disable the underline.
    --underline_char char       Character to use when underlining title
    --bold on/off               Enable/Disable bold text

    Color Blocks:
    --color_blocks on/off       Enable/Disable the color blocks
    --block_width num           Width of color blocks in spaces
    --block_height num          Height of color blocks in lines
    --block_range start end     Range of colors to print as blocks

    Bars:
    --bar_char 'elapsed char' 'total char'
                                Characters to use when drawing bars.
    --bar_border on/off         Whether or not to surround the bar with '[]'
    --bar_length num            Length in spaces to make the bars.
    --bar_colors num num        Colors to make the bar.
                                Set in this order: elapsed, total
    --cpu_display mode          Bar mode.
                                Takes: bar, infobar, barinfo, off
    --memory_display mode       Bar mode.
                                Takes: bar, infobar, barinfo, off
    --battery_display mode      Bar mode.
                                Takes: bar, infobar, barinfo, off
    --disk_display mode         Bar mode.
                                Takes: bar, infobar, barinfo, off

    Image:
    --image type                Image source. Where and what image we display.
                                Possible values: wall, ascii,
                                /path/to/img, /path/to/dir/, off
    --size 00px | --size 00%    How to size the image.
                                Possible values: auto, 00px, 00%, none
    --crop_mode mode            Which crop mode to use
                                Takes the values: normal, fit, fill
    --crop_offset value         Change the crop offset for normal mode.
                                Possible values: northwest, north, northeast,
                                west, center, east, southwest, south, southeast

    --xoffset px                How close the image will be to the left edge of the
                                window. This only works with w3m.
    --yoffset px                How close the image will be to the top edge of the
                                window. This only works with w3m.
    --bg_color color            Background color to display behind transparent image.
                                This only works with w3m.
    --gap num                   Gap between image and text.
                                NOTE: --gap can take a negative value which will
                                move the text closer to the left side.
    --clean                     Delete cached files and thumbnails.

    Ascii:
    --ascii value               Where to get the ascii from, Possible values:
                                distro, /path/to/ascii
    --ascii_colors x x x x x x  Colors to print the ascii art
    --ascii_distro distro       Which Distro's ascii art to print
                                NOTE: Arch and Ubuntu have 'old' logo varients.
                                NOTE: Use 'arch_old' or 'ubuntu_old' to use the old logos.
                                NOTE: Ubuntu has flavor varients.
                                NOTE: Change this to 'Lubuntu', 'Xubuntu', 'Ubuntu-GNOME'
                                or 'Ubuntu-Budgie' to use the flavors.
    --ascii_logo_size           Size of ascii logo.
                                Supported distros: Arch, Gentoo, Crux, OpenBSD.
    --ascii_bold on/off         Whether or not to bold the ascii logo.
    --logo | -L                 Hide the info text and only show the ascii logo.

    Screenshot:
    --scrot | -s /path/to/img   Take a screenshot, if path is left empty the screen-
                                shot function will use $scrot_dir and $scrot_name.
    --upload | -su /pth/t/img   Same as --scrot but uploads the scrot to a website.
    --image_host                Website to upload scrots to. Takes: imgur, teknik
    --scrot_cmd cmd             Screenshot program to launch

    Other:
    --config /path/to/config    Specify a path to a custom config file
    --config none               Launch the script without a config file
    --help                      Print this text and exit
    --version                   Show neofetch version
    -v                          Display error messages.
    -vv                         Display a verbose log for error reporting.

オプション結構多いです. とりあえず素で実行.

20161207_05:12:12-5188

情報もScreenfetchより増えています.

20161207_05:12:20-9093

次は画像を指定してみます.画像サイズが大きかったので25%に縮小もしています. 楽しい :)

20161207_05:12:35-3963

20161207_06:12:30-16979

画像の表示については環境によってうまく行く行かないがあるようです.うまく表示されない場合は以下のWikiを参照すると良さそうです.

]]>
https://matoken.org/blog/2016/12/07/screenfetch-like-information-display-command-neofetch/feed/ 0
マルチプラットホーム&スライドに特化したMarkdown WriterのMarpを試す https://matoken.org/blog/2016/12/03/markdown-writer-marp-specialized-for-multi-platform-slide-2/ https://matoken.org/blog/2016/12/03/markdown-writer-marp-specialized-for-multi-platform-slide-2/#respond Fri, 02 Dec 2016 17:55:22 +0000 http://matoken.org/blog/?p=1466

最近勉強会の発表資料はスライドにせずにMarkdownやAsciidocで書いてhtmlやpdfに書き出してました.これをSlideshareとかに置いているのですが,スライド形式に比べてアクセスが1桁少ないです. Markdownでスライドにする方法はいろいろあるのですが,1ページの分量がまちまちになってはみ出したりと言ったことをよくやってしまいあまりつかっていませんでした.

そんなところにプレゼンテーション向けのMarkdown Writerがあったので試してみました.

マルチプラットホームでElectron製です.PDFファイルへの書き出しも可能です.

雰囲気は以下の画像でだいたいわかるんじゃないかと思います.

https://yhatt.github.io/marp/images/marp-cast.gif

https://yhatt.github.io/marp/images/marp-cast.gif

左ペインでMarkdownを書いて右ページにプレビューが表示されます. プレビューは3種類選べますが,"1:1 slide/Slide List"のどちらかだとスライド形式でプレビューが表示されるのでレイアウトを確認しながら書くことができます.

試しにちょっと書いてみました. するとMarpのプレビュー,Evinceでは問題なかったのですが,SlideshareにPDFをアップロードすると背景画像やフッターが上下反転しています……. 試しにSpekerdeckにもアップロードしてみましたがこちらは問題なし. 恐らくSlideshareの問題ではないかと思います.

Electron製ということで降るmのマシンでは重いかなと思っていたのですが,Core2Duoのマシンでも試してみましたが一気にスクロールとかしなければ重く感じるところはなく実用範囲内に感じました.

]]>
https://matoken.org/blog/2016/12/03/markdown-writer-marp-specialized-for-multi-platform-slide-2/feed/ 0
マルチプラットホーム&スライドに特化したMarkdown WriterのMarpを試す https://matoken.org/blog/2016/12/03/markdown-writer-marp-specialized-for-multi-platform-slide/ https://matoken.org/blog/2016/12/03/markdown-writer-marp-specialized-for-multi-platform-slide/#respond Fri, 02 Dec 2016 17:55:22 +0000 http://matoken.org/blog/?p=1466

最近勉強会の発表資料はスライドにせずにMarkdownやAsciidocで書いてhtmlやpdfに書き出してました.これをSlideshareとかに置いているのですが,スライド形式に比べてアクセスが1桁少ないです. Markdownでスライドにする方法はいろいろあるのですが,1ページの分量がまちまちになってはみ出したりと言ったことをよくやってしまいあまりつかっていませんでした.

そんなところにプレゼンテーション向けのMarkdown Writerがあったので試してみました.

マルチプラットホームでElectron製です.PDFファイルへの書き出しも可能です.

雰囲気は以下の画像でだいたいわかるんじゃないかと思います.

https://yhatt.github.io/marp/images/marp-cast.gif

https://yhatt.github.io/marp/images/marp-cast.gif

左ペインでMarkdownを書いて右ページにプレビューが表示されます. プレビューは3種類選べますが,"1:1 slide/Slide List"のどちらかだとスライド形式でプレビューが表示されるのでレイアウトを確認しながら書くことができます.

試しにちょっと書いてみました. するとMarpのプレビュー,Evinceでは問題なかったのですが,SlideshareにPDFをアップロードすると背景画像やフッターが上下反転しています……. 試しにSpekerdeckにもアップロードしてみましたがこちらは問題なし. 恐らくSlideshareの問題ではないかと思います.

Electron製ということで降るmのマシンでは重いかなと思っていたのですが,Core2Duoのマシンでも試してみましたが一気にスクロールとかしなければ重く感じるところはなく実用範囲内に感じました.

]]>
https://matoken.org/blog/2016/12/03/markdown-writer-marp-specialized-for-multi-platform-slide/feed/ 0
Mumbleでリモート会議 https://matoken.org/blog/2016/12/03/remote-conference-with-mumble/ https://matoken.org/blog/2016/12/03/remote-conference-with-mumble/#respond Fri, 02 Dec 2016 16:53:14 +0000 http://matoken.org/blog/?p=1461

先週ですが,FSIJ 月例会に参加していました. といっても東京に出て行ったわけではなくネットワーク開催だったので家からの参加です.

ということでMumbleというソフトウェアで音声チャット + Etherpad(ウェブブラウザベース)でテキスト交換という環境でした. Mumbleを前もって試していればよかったのだけど直前に入れてなかなか参加できず途中からの参加になりましたorz~

MumbleはDebian stretch amd64環境ではパッケージが存在する( mumble )のでこれを導入するだけでした.マルチプラットホームで各種環境向けにも存在して,Androidなどでも利用できるようです. – Mumble, the open source VoIP solutionPlumble – Mumble VOIP (Free) – Google Play の Android アプリPlumble – Mumble VOIP – Google Play の Android アプリ

今回使用機器は以下のような感じ.でしたが,スピーカーは試行錯誤している時に繋いだもので後で試すと本体のスピーカーで大丈夫でした.

  • PC : Thinkpad X220(Debian stretch amd64)
  • マイク : 3.5mmジャックに直接挿せるもの(型番不明)
  • スピーカー : ELECOM LBT-SPTR01AV(Bluetooth)

このときMumble利用時に嵌ったところをメモしておきます. – ヘッドホンとマイクが1つの端子の端末でマイクを繋ぐとヘッドホンもそちらを向いてしまって音が出なかった – Bluetothヘッドセットを繋ぐとそちらから音が出るようになったがマイクがうまく働かない – PulseAudio Volume Control (pavucontrol)で見るとマイクがミュートになっていたので解除してMumbleに割り当て – 伝送方式を"push to talk"にしたがpushがわからなかった -> ショートカットで適当なキーに割り当て(Mumble非アクティブ時も有効)

  • その他
    • Awesome WM環境ではMumbleが最小化してしまうと窓を復帰させる方法が今のところわからない.タスクトレイのアイコンをクリックしても出てこない.(Xfce4はアイコンクリックで出てくるよう)
    • 一回設定できればフォーカスがなくてもショートカットが効いて話せるのでとりあえず使えるけどチャットと誰が話しているかのアイコンの確認(唇アイコンが赤くなる)が出来ない(オーバーレイの設定でどうにかなりそう?)
    • アイコンを右クリックしてそのまま離すと丁度終了になってしまう…….
    • Mumbleの音声品質は16kbps/40kbps/72kbpsから選択可能(規定値は40k)
    • push to talkを使うとその時しか音声が飛ばないので周りの環境に左右されにくくて良い(キー入力の音や環境音が入りにくい)

最近はUstream.tv/Youtube Liveなどの動画配信やBBB(BigBlueButton)などの動画を使ったオンライン会議システムなどで中継ということが多いですが,手弁当の勉強会なんかだと回線などの問題でうまく行かなかったりすることが多いですが割り切って音声のみの中継にしてしまうのもありだなと感じました.

最近リモート参加した勉強会

]]>
https://matoken.org/blog/2016/12/03/remote-conference-with-mumble/feed/ 0
形態素解析システムJUMAN++をちょっと試したメモ https://matoken.org/blog/2016/10/21/hey-tried-note-of-the-morphological-analysis-system-juman/ https://matoken.org/blog/2016/10/21/hey-tried-note-of-the-morphological-analysis-system-juman/#respond Thu, 20 Oct 2016 17:45:29 +0000 http://matoken.org/blog/?p=1457 京都大学 黒橋・河原研究室より2016-09-23にリリースされた新しい形態素解析システムだそうです.とりあえず手元の環境で動かしてみたのでそのメモです.

環境

Debian stretch amd64 / Ubuntu 16.10 amd64 で確認しました.どちらも以下の手順でOKでした.開発元ではCent OS 6.7で動作確認をしているようです.

build

必要なパッケージを導入してmake.

$ sudo apt install libboost-dev build-essential
$ wget http://lotus.kuee.kyoto-u.ac.jp/nl-resource/jumanpp/jumanpp-1.01.tar.xz
$ sha256sum jumanpp-1.01.tar.xz 0d587416a3eb7123638f9c1e30a649b72dfb483448839168dcb48be572c5919a  jumanpp-1.01.tar.xz
$ tar tvf ./jumanpp-1.01.tar.xz
$ tar xf ./jumanpp-1.01.tar.xz
$ ./configure --prefix=${HOME}/usr/local
$ make
$ make install

動作確認

適当に文章を入れてみたり.

$ ~/usr/local/bin/jumanpp
こんにちはJUMANPP++
こんにち こんにち こんにち 名詞 6 時相名詞 10 * 0 * 0 "代表表記:今日/こんにち カテゴリ:時間"
は は は 助詞 9 副助詞 2 * 0 * 0 NIL
JUMANPP JUMANPP JUMANPP 未定義語 15 その他 1 * 0 * 0 "品詞推定:名詞"
+ + + 未定義語 15 その他 1 * 0 * 0 "品詞推定:名詞"
+ + + 未定義語 15 その他 1 * 0 * 0 "品詞推定:名詞"
EOS

青空文庫の古典を流し込んでみたり.

$ wget -O - http://www.aozora.gr.jp/cards/000160/files/2617_ruby_23916.zip | zcat | iconv -f SJIS -t UTF-8 - | ~/usr/local/bin/jumanpp
三十 三十 三十 名詞 6 数詞 7 * 0 * 0 "カテゴリ:数量"
年 ねん 年 接尾辞 14 名詞性名詞助数辞 3 * 0 * 0 "代表表記:年/ねん 準内容語 カテゴリ:時間"
後 ご 後 接尾辞 14 名詞性名詞接尾辞 2 * 0 * 0 "代表表記:後/ご 内容語"
の の の 助詞 9 接続助詞 3 * 0 * 0 NIL
世界 せかい 世界 名詞 6 普通名詞 1 * 0 * 0 "代表表記:世界/せかい カテゴリ:場所-その他"
      :

古典とかよりTwitterとかのほうがいいかもしれない.

$ curl 'https://twitter.com/search?f=tweets&vertical=default&q=lang%3Aja%20near%3A%22%E6%97%A5%E6%9C%AC%22%20within%3A15mi&src=typd&lang=ja' | grep 'class="TweetTextSize  js-tweet-text tweet-text"' | lynx -stdin -dump -nolist | ~/usr/local/bin/jumanpp

ちなみにちょっと試したいだけであれば導入しなくても以下のページで試せます.ラティス表示も楽しい.

]]>
https://matoken.org/blog/2016/10/21/hey-tried-note-of-the-morphological-analysis-system-juman/feed/ 0
mind mappingアプリのFreeplaneを試す https://matoken.org/blog/2016/10/05/mind-mapping%e3%82%a2%e3%83%97%e3%83%aa%e3%81%aefreeplane%e3%82%92%e8%a9%a6%e3%81%99/ https://matoken.org/blog/2016/10/05/mind-mapping%e3%82%a2%e3%83%97%e3%83%aa%e3%81%aefreeplane%e3%82%92%e8%a9%a6%e3%81%99/#comments Tue, 04 Oct 2016 19:14:18 +0000 http://matoken.org/blog/?p=1437 FreeMindをDebian jessieに導入しようとしたらパッケージが見当たりません. 探してみるとメンテナンスされてないからjessie/sidから消されたようです.

We have Freeplane which is actively maintained and roughly equivalent in features.

でもFreeplaneというメンテされている似たものがあるよということでこれを試してみることにしました.

#ちなみにFreeMindのsiteを見るとstableのリリースが2013年で1.0.1.その後1.1.0-Beta1が2015年1.1.0-Beta2が2016年に出ていて,Debianでは0.9.0だったようです.

FreeplaneはどうもFreeMindのフォークのようです.見た目も使い勝手も似ています.JAVA製でマルチプラットホームなのも同じです.

導入はパッケージがあるのでそれを利用しました.

$ sudo apt install freeplane

起動ロゴ……何だろうこの虫?は.

20161005_01:10:30-30616

初回起動時にはWhats Newが表示されました.

20161005_01:10:09-30241

少し日本語が豆腐になってしまっている場所がありましたがフォントを日本語フォントに変更することで解決しました. 後はチュートリアルとかに目を通しておくと良さそうです.

チュートリアルなどのドキュメントは/usr/share/freeplane/doc/辺りにありました.

$ ls -1 /usr/share/freeplane/doc/*_ja.mm
/usr/share/freeplane/doc/freeplaneFunctions_ja.mm
/usr/share/freeplane/doc/freeplaneTutorial_ja.mm
/usr/share/freeplane/doc/freeplane_ja.mm

20161005_01:10:53-29876

20161005_01:10:09-28858

20161005_01:10:32-27112

未だそんなに使っていませんが,FreeMindと同じような操作性だし以前書いた.mmも読めるようなのでそのまま移行できそうです.

<追記>

Ubuntu 16.10 amd64(今は未だリリース前)にも入れてみましたが起動しませんでした.とりあえず本家から.zipを貰ってきて動かしています.一応報告はしてみました.

</追記>

]]>
https://matoken.org/blog/2016/10/05/mind-mapping%e3%82%a2%e3%83%97%e3%83%aa%e3%81%aefreeplane%e3%82%92%e8%a9%a6%e3%81%99/feed/ 2
byobu+screenでfunctionkeyを無効にする https://matoken.org/blog/2016/09/16/to-disable-the-functionkey-in-byobu-screen/ https://matoken.org/blog/2016/09/16/to-disable-the-functionkey-in-byobu-screen/#respond Fri, 16 Sep 2016 08:42:19 +0000 http://matoken.org/blog/?p=1402 機能覚えてないし遠いしたまに間違って押して混乱したりするので無効にしました.
Debian stretch amd64, Ubuntu 16.04 LTS amd64で確認.

$ vi ~/.byobu/keybindings

して

source $BYOBU_PREFIX/share/byobu/keybindings/common

の次の行頭で i して編集モードにした後
Ctrl+a !(aは設定してあるescape key)する.
するとこんなのが出てくるので,

:source /usr/share/byobu/keybindings/f-keys.screen

頭の : を消して

source /usr/share/byobu/keybindings/f-keys.screen.disable

を書いておく

保存して起動しなおして反映.

#viである必然性はないのでお好きなテキストエディタでどうぞ.
#tmuxの場合はこっち~/.byobu/keybindings.tmuxになるのかな?(それとも byobu-select-backend で切り替えるとファイル名入れ替わる?)

]]>
https://matoken.org/blog/2016/09/16/to-disable-the-functionkey-in-byobu-screen/feed/ 0
コマンドラインからGooglecastにcast出来るcastnowを試す https://matoken.org/blog/2016/09/16/try-the-cast-can-castnow-from-the-command-line-to-googlecast/ https://matoken.org/blog/2016/09/16/try-the-cast-can-castnow-from-the-command-line-to-googlecast/#respond Fri, 16 Sep 2016 08:30:02 +0000 http://matoken.org/blog/?p=1399 見つけたので試してみました

Debian stretch amd64, Ubuntu 16.04 LTS amd64で確認しています.

$HOME以下にPATH通してnpmで導入しています./usr/local以下で良ければnpm install castnow -gだけでいいかも.

$ sudo apt install npm nodejs-legacy
$ echo 'PATH="$PATH":$HOME/node_modules/.bin' >> ~/.bashrc
$ source ~/.bashrc
$ npm install castnow

入りましたがChromecastがみあたらない?

$ castnow --help
 
Usage: castnow [<media>, <media>, ...] [OPTIONS]
 
Option                  Meaning
--tomp4                 Convert file to mp4 during playback
--device <name>         The name of the Chromecast device that should be used
--address <ip>          The IP address or hostname of your Chromecast device
--subtitles <path/url>  Path or URL to an SRT or VTT file
--subtitle-scale <scale> Subtitle font scale
--subtitle-color <color> Subtitle font RGBA color
--myip <ip>             Your local IP address
--quiet                 No output
--peerflix-* <value>    Pass options to peerflix
--ffmpeg-* <value>      Pass options to ffmpeg
--type <type>           Explicitly set the mime-type (e.g. "video/mp4")
--bypass-srt-encoding   Disable automatic UTF-8 encoding of SRT subtitles
--seek <hh:mm:ss>       Seek to the specified time on start using the format hh:mm:ss or mm:ss
--loop                  Loop over playlist, or file, forever
--help                  This help screen
 
Player controls
 
Key                     Action
space                   Toggle between play and pause
m                       Toggle mute
up                      Volume Up
down                    Volume Down
left                    Seek backward
right                   Seek forward
n                       Next in playlist
s                       Stop playback
quit                    Quit
 
$ castnow
Error: device not found

名前解決が出来なかったようでipを指定するとcast出来ました.別のマシンでは通ったのでこのマシンがおかしいようです.

$ avahi-browse -a -t -l -r
+ wlp3s0 IPv6 x201s                                         Remote Disk Management local
+ wlp3s0 IPv4 Chromecast-KagoLUG                            _googlecast._tcp     local
= wlp3s0 IPv6 x201s                                         Remote Disk Management local
   hostname = [x201s.local]
   address = [fe80::222:faff:fe33:456a]
   port = [22]
   txt = []
= wlp3s0 IPv4 Chromecast-KagoLUG                            _googlecast._tcp     local
   hostname = [Chromecast-KagoLUG.local]
   address = [192.168.2.206]
   port = [8009]
   txt = ["rs=" "bs=FA8FCA59198D" "st=1" "ca=4101" "fn=Chromecast-KagoLUG" "ic=/setup/icon.png" "md=Chromecast" "ve=05" "rm=A652B47431F36207" "id=7c14aaaa62a6002dd95ba94814e5c5e0"]
$ castnow --address 192.168.2.206 http://commondatastorage.googleapis.com/gtv-videos-bucket/ED_1280.mp4
 
  State     : Playing....

パイプも使えるので色々応用できそうな気がします.
(最近Chromiumがamd64/i386しかなくなったようですが,これを使えば他のアーキテクチャでもスクリーンキャストもできそう?)

]]>
https://matoken.org/blog/2016/09/16/try-the-cast-can-castnow-from-the-command-line-to-googlecast/feed/ 0
Android端末をLinuxのタッチパッド替わりにしたい(Bluetooth利用のBlink) https://matoken.org/blog/2016/06/17/want-the-android-terminal-to-the-touch-pad-instead-of-linux-blink-of-bluetooth-use/ https://matoken.org/blog/2016/06/17/want-the-android-terminal-to-the-touch-pad-instead-of-linux-blink-of-bluetooth-use/#respond Fri, 17 Jun 2016 13:36:25 +0000 http://matoken.org/blog/?p=1394

最近またポインティングデバイスにApple Wireless Trackpadを利用するようになりましたが持ち運びには少し嵩張ります.マウスを持ち運ぶのもかさばります.
Ubuntu TouchでHDMI接続時にタッチデバイスになるというのを見てAndroid端末をタッチデバイスにすることが出来るのでは?それなら荷物増え無いしいいかもと思って少し調べてみました.

BlinkはBluetooth接続かつPC側でデーモンを動かす必要があります.
先ずBluetoothペアリングをしておき,PC側でデーモンを導入します.

  • 必要パッケージの導入

$ sudo apt install bluez python-bluez xdotoolsudo apt-get install bluez python-bluez xdotool
  • デーモンの導入

$ git clone https://github.com/drpain/blink-server.git ~/.blink

以下のようにしてデーモンを起動するのですが,この記事を書いている時点でのDebian stretch testing amd64では以下のようなエラーとなります.

$ sudo ~/.blink/bluetooth_server.py
Traceback (most recent call last):
  File "/home/mk/.blink/bluetooth_server.py", line 25, in <module>
    profiles         = [ SERIAL_PORT_PROFILE ]
  File "/usr/lib/python2.7/dist-packages/bluetooth/bluez.py", line 176, in advertise_service
    raise BluetoothError (str (e))
bluetooth.btcommon.BluetoothError: (2, 'No such file or directory')

GuihubのHELPを参考に*/etc/bluetooth/main.conf*を以下のように修正します.

diff --git a/bluetooth/main.conf b/bluetooth/main.conf
index 372fd8c..2f7cc4a 100644
--- a/bluetooth/main.conf
+++ b/bluetooth/main.conf
@@ -64,6 +64,9 @@
 # 'false'.
 #FastConnectable = false

+# "drpain/blink-server: This is the server you would need to be able to run the Blink Android Application." https://github.com/drpain/blink-server
+DisablePlugins = pnat
+
 #[Policy]
 #
 # The ReconnectUUIDs defines the set of remote services that should try

設定を反映するためにbluetoothdを再起動してサーバを再起動します.

$ sudo service bluetooth restart

サーバは要rootのようです.
この状態でAndroid側からクライアントPCを選択して接続すればok.

$ sudo ~/.blink/bluetooth_server.py
READY FOR CONNECTIONS, RFCOMM channel 1
('INBOUND CONNECTION ', ('68:76:4F:3B:D1:E0', 1))
COMMAND RECEIVED [{"action":"mouse-move","x":null,"y":null}]
['xdotool', 'mousemove_relative', '--', 'None', 'None']
COMMAND RECEIVED [{"action":"mouse-move","x":-1,"y":0}]
['xdotool', 'mousemove_relative', '--', '-1', '0']
COMMAND RECEIVED [{"action":"mouse-move","x":0,"y":0}]
['xdotool', 'mousemove_relative', '0', '0']
COMMAND RECEIVED [{"action":"mouse-move","x":-1,"y":0}]
['xdotool', 'mousemove_relative', '--', '-1', '0']

上の方のモード切替スイッチをタップして規定の「Swipe Area」から「Mouse」にします.「Mouse Area」で操作するとxdotoolのログが大量に出つつ操作できます.

27629912281 e0ba729509 n
27094267013 3fb8577a76 n

操作は少し解りづらくてこんな感じです.

  • タップ→左クリック

  • タップ, ホールド, リリース → 右クリック

中クリックやドラッグは多分未実装で使えません.
カーソル移動はちらつきますがとりあえず使える感じです.

でも導入に要設定変更&要rootなのが面倒ですね.

]]>
https://matoken.org/blog/2016/06/17/want-the-android-terminal-to-the-touch-pad-instead-of-linux-blink-of-bluetooth-use/feed/ 0