ARTS-week52

Algorithms

Hamming Distance

1
2
3
4
5
6
7
8
9
10
11
12
class Solution {
public:
int hammingDistance(int x, int y) {
int val = x ^ y;
int cnt = 0;
while (val) {
val &= val - 1;
++cnt;
}
return cnt;
}
};

Review

本周阅读英文文章:
1、Cybersecurity In Industrial Control Systems: The Evolving Threat Landscape

2、New malware attack turns Elasticsearch databases into DDoS botnet

Technique

用Prometheus和Grafana搭了MariaDB性能监控系统,步骤单独记录在下面的文章中了:
使用Prometheus和Grafana搭建MariaDB性能监控系统

Share

让Ubuntu SSH登录时显示系统信息,如下这样:

1
2
3
4
5
6
System information as of Sun Jul 28 11:51:10 CST 2019

System load: 0.25 Processes: 231
Usage of /: 27.8% of 48.96GB Users logged in: 1
Memory usage: 19% IP address for ens32: 192.168.0.1
Swap usage: 0%

只需安装landscape-common,系统会依次执行/etc/update-motd.d/内的文件输出到/run/motd.dynamic中:

1
sudo apt install landscape-common

再次登录时,可以在MOTD中看到这些信息啦

参考

https://elkpi.com/topics/ubuntu-ssh-login-show-system-info.html