JavaScriptで変数名?でつまづいた

7年以上、JavaScriptから離れたいたので気づかなかった、Optional Chaining。

result = function_x()

if (!result?.code || !result?.msg) {
    return null;
}

!result? 何コレ?変数の中身に正規表現かけて評価? JavaScript 変数名 + ? で検索しても全くわからず。 いろいろ検索したら、 ES2020で追加された使用らしい。 result.code が定義されていなかったら undefined 、TypeError にならずに済む。 result.code が定義されていたら、その値。 いちいち変数が定義されているかチェック手間が省けて便利。

Docker install

sudo apt-get remove docker docker-engine docker.io
sudo apt-get update
sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88

pub   4096R/0EBFCD88 2017-02-22
      Key fingerprint = 9DC8 5822 9FC7 DD38 854A  E2D8 8D81 803C 0EBF CD88
uid                  Docker Release (CE deb) <docker@docker.com>
sub   4096R/F273FCD8 2017-02-22
sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"
sudo apt-get update
sudo apt-get install docker-ce

Ubuntu 16.04 Docker を GUI つきで動作させる (ローカルホスト)

Ubuntu 16.04 Docker を GUI つきで動作させる (ローカルホスト)

コンテナイメージのダウンロード

Get Docker for Ubuntu

sudo gpasswd -a your-login-name docker

ubuntu-desktop-lxde-vnc

docker pull dorowu/ubuntu-desktop-lxde-vnc

新規コンテナ起動

(localhost の場合)

docker run -d --name lxde -p 6080:80 -p 6022:22 -e DISPLAY=$DISPLAY -v /tmp/.X11-unix/:/tmp/.X11-unix dorowu/ubuntu-desktop-lxde-vnc

(remote host の場合)

docker run -d --name lxde -p 6080:80 -p 6022:22 dorowu/ubuntu-desktop-lxde-vnc

WebブラウザからVNC接続する

localhost:lxde

コンテナのターミナルで。

adduser your-login-name
gpasswd -a your-login-name sudo
service ssh restart

(localhostの場合) localhostからX-Serverへのアクセス許可を出す。

xhost local:

コンテナにSSH接続

ssh your-login-name@ip-address -p 6022 -X

(localhostの)コンテナにSSHで接続したターミナルで。

export DISPLAY=:0
gnome-www-browser

(remote hostの)コンテナにSSHで接続したターミナルで。

gnome-www-browser

コンテナ新規起動後にホストをリブートしたあとの作業

作成済みコンテナの開始

docker run を使用するのではない。

docker start lxde

sshデーモンの開始

docker exec lxde service ssh start

Ubuntu 16.04 LTS Comod Internet Security install

Comodo Antivirus for Linux

Virus Protection Comodo Antivirus for Linux Download cav-linux_x64.deb

インストールエラー

$ sudo dpkg -i cav-linux_x64.deb 
[sudo] password for tosihide: 
Selecting previously unselected package cav-linux.
(Reading database ... 241548 files and directories currently installed.)
Preparing to unpack cav-linux_x64.deb ...
Unpacking cav-linux (1.1.268025-1) ...
dpkg: dependency problems prevent configuration of cav-linux:
 cav-linux depends on libssl0.9.8 (>= 0.9.8m-1); however:
  Package libssl0.9.8 is not installed.

dpkg: error processing package cav-linux (--install):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 cav-linux

libssl0.9.8 のイストー

32bit

$ wget http://snapshot.debian.org/archive/debian/20110406T213352Z/pool/main/o/openssl098/libssl0.9.8_0.9.8o-7_i386.deb

64bit

$ wget http://snapshot.debian.org/archive/debian/20110406T213352Z/pool/main/o/openssl098/libssl0.9.8_0.9.8o-7_amd64.deb

ダウンロードしたパッケージをインストー

$ dpkg -i libssl0.9.8_0.9.8o-7_amd64.deb

Comodo Antivirus for Linux のインストー

$ sudo dpkg -i cav-linux_x64.deb 
(Reading database ... 241788 files and directories currently installed.)
Preparing to unpack cav-linux_x64.deb ...
Unpacking cav-linux (1.1.268025-1) over (1.1.268025-1) ...

Uninstallation succeed!

Setting up cav-linux (1.1.268025-1) ...
$Starting cmdagent: The cmdagent started successfully!
$Starting cmgdaemon: The cmgdaemon started successfully!

Installation succeed, but it must be properly configured before using. 
Please run /opt/COMODO/post_setup.sh script manually to configure it.
$ sudo /opt/COMODO/post_setup.sh

あとは表示内容の指示通りに作業を行う。

アンインストール方法

sudo apt-get --purge remove cav-linux