import 在typescript中的千奇百怪写法

学习angular的时候,有个使用第三方库query-string, 死活不对。老师使用的是ng8,我是ng10

老师写的是

import queryString from 'query-string';

我必须写成

import * as queryString from 'query-string';

其他时候格式都是

imprt {a, b, c } from "foo.bar"

从这里我找到了解释

https://zhuanlan.zhihu.com/p/137856912

sync the time/date in docker with host

Thanks for the tips from this post:

https://medium.com/better-programming/docker-tips-synchronize-container-timezone-with-host-machine-via-docker-compose-in-ubuntu-18-04-6f01615efc24

Two changes must be added in docker-compose.yml. First need to add TZ in enviroment, then add localtime and timezone in Volumns.

Like so

environment:
– TZ=Europe/Berlin

volumes:

- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro

upgrade nodejs from 8 to newest version in ubuntu

The default node version in Ubuntu 18 is 8.0. I need to update it.

  1. Download the newest version from https://nodejs.org/en/download/ and save it.

2. extact the file from tar and copy it to /usr/local

sudo tar –strip-components 1 -xJf node-v14.15.0-linux-x64.tar.xz -C /usr/local/

Please note, -C /usr/local/ must be the last params, otherweise it will not work, at most not work for me.

Now check version with

node -v

It should show like v14.15.0

solve winhq dependency hell in Ubuntu 18

today I need to install a new pc with xubuntu 18.04 bionic. But I got problem while installing winhq, the apt-get always says some dependency issues, and can not install it.

Finally I found the solution here:

The key is to install following package before wine:

sudo apt-get install libgnutls30:i386 libldap-2.4-2:i386 libgpg-error0:i386 libxml2:i386 libasound2-plugins:i386 libsdl2-2.0-0:i386 libfreetype6:i386 libdbus-1-3:i386 libsqlite3-0:i386

Thanks Ji M!

找到一个有意思的pdf

中国科学院武汉病毒研究所 (链接已失效)
http://www.whiov.cas.cn/tzgg_105342/201801/W020180104550979209392.pdf

中国科学动物研究院(2020.10.01)
http://www.ioz.ac.cn/xwzx/tzgg/201801/P020180112541907522850.pdf

2018年国家科学技术奖励大会 (2019-01-08)
中国蝙蝠携带重要病毒研究
http://www.cas.cn/zt/hyzt/2018gjkjjldh/zrkxj/201901/t20190108_4676163.shtml

config ssmtp in docker

I found I can not send email with php in dokcer, because the ssmtp not installed.

I added following section in Dockerfile:

...
# install MTA
RUN apt-get update && apt-get install -y ssmtp

MAINTAINER hongyi.chen

# Sendmail
COPY ./ssmtp.conf /etc/ssmtp/ssmtp.conf
...

The SSMTP config like this:

root=postmaster
AuthUser={{smtp_username}}
AuthPass={{smtp_password}}
mailhub={{smtp_host}}:{{smtp_port}}
UseTLS=YES
UseSTARTTLS=YES
rewriteDomain={{force_domain}}
hostname={{host_name}}

Ref:

https://linuxhandbook.com/linux-send-email-ssmtp/

https://www.techrepublic.com/blog/it-security/use-ssmtp-to-send-e-mail-simply-and-securely/

winhq的key无效

今天apt-get update的时候报错。说winHQ的key无效。

  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 818A435C5FCBF54A

后来在 http://ubuntuhandbook.org/index.php/2018/09/how-to-install-wine-stable-3-0-3-in-ubuntu-18-04/ 找到答案,需要安装新的key:

Did you successfully install the repository key?

Download the key via command:

wget -nc https://dl.winehq.org/wine-builds/Release.key

Then install the downloaded key file:

sudo apt-key add Release.key

然后apt-get update后问题解除。

这样我可以继续安装我的nodejs14.

curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -

sudo apt-get install -y nodejs

需要看看是否需要升压电路

昨晚看hyperion 的wiki( https://hyperion-project.org/wiki/Supported-hardware) 文中提到灯带的控制信号是4v的,但是pi的gpio输出都是3.3v的,勉强能用.但是最好是配升压线路.

这里说的WS系的灯带,不是我用的APA102.所以我需要检查APA102的技术指标.