颜林林的“左耳听风ARTS”打卡记录

ARTS第五十五周(2020年10月5日~11日)

2020-10-05

Algorithm

LeetCode题库

编号 难度 题目 我的解答 执行用时 内存消耗 用时排名 内存排名 查看结果
344 简单 反转字符串 201011-1.cpp 76 ms 22.9 MB 8.91% 28.11% 查看结果
345 简单 反转字符串中的元音字母 201011-1.cpp 8 ms 7.7 MB 92.50% 58.02% 查看结果
347 中等 前 K 个高频元素 201011-1.cpp 36 ms 13.6 MB 84.74% 86.80% 查看结果

Review

1. C++中的using namespace std

分享链接:StackOverflow: Why is “using namespace std;” considered bad practice?

这个帖子的问答内容,详细解释了using namespace std;存在的问题及避免使用的原因。最终的结论是:不应该在头文件中使用,而建议在cpp实现文件中使用。

Tip

1. 显示dd命令的读写进度

分享链接:Linux dd Command Show Progress Copy Bar With Status

1
dd if=/path/to/input of=/path/to/output status=progress

2. PGP的使用,对下载文件的校验

分享链接:UNIX / Linux PGP TarBall File Signature Keys Verification

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# 下载文件
$ wget http://nginx.org/download/nginx-1.18.0.tar.gz
$ wget https://nginx.org/download/nginx-1.18.0.tar.gz.asc

# 校验
$ gpg nginx-1.18.0.tar.gz.asc
## OR ##
$ gpg --with-fingerprint nginx-1.18.0.tar.gz.asc
gpg: WARNING: no command supplied.  Trying to guess what you mean ...
gpg: assuming signed data in 'nginx-1.18.0.tar.gz'
gpg: Signature made Tuesday 21 April 2020 07:43:35 PM IST
gpg:                using RSA key 520A9993A1C052F8
gpg: Can't check signature: No public key

# 获取公钥
gpg --recv-key <publicKey>
## we can also get keys from speifici key server ##
gpg --keyserver pgpkeys.mit.edu --recv-key <publicKey>

# 校验
$ gpg --verify nginx-1.18.0.tar.gz.asc nginx-1.18.0.tar.gz

# 获取公钥
$ wget https://nginx.org/keys/mdounin.key
$ gpg --import mdounin.key
gpg: key 520A9993A1C052F8: 2 signatures not checked due to missing keys
gpg: key 520A9993A1C052F8: public key "Maxim Dounin <mdounin@mdounin.ru>" imported
gpg: Total number processed: 1
gpg:               imported: 1
gpg: marginals needed: 3  completes needed: 1  trust model: pgp
gpg: depth: 0  valid:   1  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 1u

$ gpg --verify nginx-1.18.0.tar.gz.asc nginx-1.18.0.tar.gz

Share

1. 关于R语言的电子书

分享链接:Getting used to R, RStudio, and R Markdown

对应GitHub:https://github.com/ismayc/rbasics