One principle not suit everywhere

When Dante enters Hell, Minos asks him, "Did Beatrice give you a smile when she came across you in the street?"

Dante replies, "No."

Minos shouts, "You're foolish, you and she are in two different parallel worlds, your zealousness is useless!"

Then Minos turns to Rhadamanthus, "Put the repairing task to him."

What's the task? For people in Nephalem hacked the message channel between Hell and Heaven, residents in Hell need a more secure channel reporting to Zeus.

Dante is very confident about the job, has done it in a week.

While Rhadamanthus runs through the source code Dante has just compiled and tested, Aeacus shakes his head violently, "Why do you not check the variables? You shouldn't call a memory operation function with null pointer parameters. Look here and there, so many 'free' routines you invoked didn't obey this law."

"Must check?" Dante says with contempt and looks to Rhadamanthus for a reply.

"Yes." replies Rhadamanthus without hesitation.

This drops Dante in a situation that he needs to check himself first. He returns to his computer and begins to google the libc specifications, but he stops, and appeals to Minos, "Boss, are they right?"

"Of course! Because it's too dangerous without check, are you intending to ruin the Hell?" as is the deciding vote from Minos.

git备忘录

1
2
3
4
5
6
7
8
git branch -a
git fetch
git checkout
git remote -v
git remote set-url origin https://github.com/euhat/EuhatExpert.git
git reset --soft HEAD^
git clean -xfd
git submodule update --init --recursive

copy and paste between vmware centos guest and host failed

some centos distribution has no open-vm-tools package, so we need to compile it by hand:

yum install libmspack-devel pam-devel xmlsec1-devel libXext-devel libXinerama-devel libXrender-devel libXrandr-devel libXtst-devel gtk3-devel gtkmm30-devel libtirpc-devel rpcgen libtool-devel

git clone https://github.com/vmware/open-vm-tools.git
cd open-vm-tools/open-vm-tools
autoreconf -i
./configure
make
make install

vmware-user

ps. how to enable auto-fitting with resolution

#install driver
yum install xorg-x11-drv-vmware
#add option to configure open-vm-tools
./configure --enable-resolutionkms
make
make install
#startup two vmtoolsds, one for vmusr, one for vmsvc which serves auto-resizing
vmware-user
vmtoolsd

refer to:
https://docs.vmware.com/en/VMware-Tools/11.3.0/com.vmware.vsphere.vmwaretools.doc/GUID-8B6EA5B7-453B-48AA-92E5-DB7F061341D1.html

mysql备忘录

密码问题

1
2
3
#/etc/my.cnf
[mysqld]
skip-grant-tables=1
1
2
FLUSH privileges;
ALTER USER 'root'@'localhost' IDENTIFIED BY 'admin@123';

重启

1
systemctl restart mysqld

com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException:
Could not create connection to database server. Attempted reconnect 3

https://www.cnblogs.com/ianhuafeng/p/12403626.html
https://zhuanlan.zhihu.com/p/632935077

Install MySql in Windows, download zip file from https://dev.mysql.com/downloads/windows/installer/5.7.html

mysqld --initialize --console
mysqld --install mysql
net stop mysql
mysqld --skip-grant-tables
	mysql -u root -p
		use mysql;
		select * from user;
		update user set authentication_string=password("123456") where user="root";
		flush privileges;
net start mysql

refer to:
https://www.cnblogs.com/huaisn/articles/14149356.html

comparing ubuntu with centos in package management

yum

1
2
3
4
5
6
7
8
9
10
11
12
# find which package the cmd 'a.out' belongs to
yum provides */bin/a.out
# check if 'wget' package is installed
yum list installed | grep wget
# download 'wget' package to /tmp/rpm/
yum install yum-plugin-downloadonly
yum download --downloaddir=/tmp/rpm/ --downloadonly wget
# list all files in 'wget' package
rpm -qlp /tmp/rpm/wget*.rpm
# another method listing files without downloading
yum install yum-utils
repoquery -l wget

apt

1
2
3
4
5
6
# find which package 'Python.h' belongs to
apt install apt-file
apt-file update
apt-file search Python.h
# list all files in 'wget' package
dpkg -L wget

package names

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
34
35
36
37
38
39
40
41
42
43
44
45
  ubuntu			  centos
install build-essential		groupinstall "Development tools"
xfce4				@xfce-desktop
ssh				openssh-clients
udev				systemd-udev
libc6-dev			glibc-devel
libglib2.0-dev			glib2-devel
libffi-dev			libffi-devel
libncurses5			ncurses
libncurses5-dev			ncurses-devel
libsqlite3-dev			sqlite-devel
libnet1-dev			libnet-devel
libreadline6			readline
bridge-utils			bridge-utils
libpcre3-dev			pcre-devel
libyaml-dev			libyaml-devel
libmagic-dev			file-devel
liblua5.1-0-dev			lua-devel
libssl-dev			openssl-devel
zlib1g-dev			zlib-devel
lm-sensors			lm_sensors
ifenslave			iputils
ntpdate				ntp
redis-server			redis
libperl-dev			perl-devel
libjpeg-turbo8-dev		libjpeg-turbo-devel
libfreetype6-dev		freetype-devel
iproute2			iproute
iputils-ping			iputils
ifupdown			NetworkManager
net-tools			net-tools
libpython3.8-dev		python3-devel
mysql-server			mysql5-server
libmysqlclient-dev		mysql5-devel
tofrodos			dos2unix
				kernel-headers
				kernel-devel
qemu-user-static
initramfs-tools
gcc-5-plugin-dev
build-essential
libprelude-dev
libzmq3-dev
libhtp-dev
fbset				maybe in xorg-x11-server

deprecated in ubuntu

1
2
sysv-rc-conf
libjpeg-dev # why?

refer to:
https://blog.csdn.net/mimosa2008/article/details/102833837
https://forums.centos.org/viewtopic.php?t=14711
https://blog.csdn.net/xldwhj/article/details/72831674
https://www.cnblogs.com/orcl-2018/p/13276558.html
https://blog.csdn.net/HAOMCU/article/details/7268687
https://mirrors.tuna.tsinghua.edu.cn/help/fedora/

switch between shell and anaconda in serial console

as are indicated at the bottom of the console, there are 5 windows in anaconda, we can toggle any of them by press:

<Ctrl> + <b> + <window number>

in a tmux style.

refer to:
https://docs.centos.org/en-US/centos/install-guide/Trouble-x86/
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/installation_guide/sect-consoles-logs-during-installation-x86

automatic disk performance test

mkdir like test_case1, copy three files below in it:

test_case1/test.py

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
#!/bin/python3
import os
 
def shell_run(name, cmd):
	os.system('mkdir result')
	os.system(cmd + '> ./result/' + name)
 
def run_cmds(cmds):
	for name, cmd in cmds.items():
		shell_run(name, cmd)
 
cmds = {
	'1_small_read'		: 'fio -name iops -rw=read -bs=4k -runtime=60 -iodepth 32 -filename /dev/sda6 -ioengine libaio -direct=1',
	'1_small_randread'	: 'fio -name iops -rw=randread -bs=4k -runtime=60 -iodepth 32 -filename /dev/sda6 -ioengine libaio -direct=1',
	'1_small_write'		: 'fio -name iops -rw=write -bs=4k -runtime=60 -iodepth 32 -filename /dev/sda6 -ioengine libaio -direct=1',
	'1_small_randwrite'	: 'fio -name iops -rw=randwrite -bs=4k -runtime=60 -iodepth 32 -filename /dev/sda6 -ioengine libaio -direct=1',
	'1_big_read'		: 'fio -name iops -rw=read -bs=10M -runtime=60 -iodepth 32 -filename /dev/sda6 -ioengine libaio -direct=1',
	'1_big_randread'	: 'fio -name iops -rw=randread -bs=10M -runtime=60 -iodepth 32 -filename /dev/sda6 -ioengine libaio -direct=1',
	'1_big_write'		: 'fio -name iops -rw=write -bs=10M -runtime=60 -iodepth 32 -filename /dev/sda6 -ioengine libaio -direct=1',
	'1_big_randwrite'	: 'fio -name iops -rw=randwrite -bs=10M -runtime=60 -iodepth 32 -filename /dev/sda6 -ioengine libaio -direct=1',
	'4_small_read'		: 'fio -name iops -rw=read -bs=4k -runtime=60 -iodepth 32 -filename /dev/sda6 -ioengine libaio -direct=1 -numjobs=4',
	'4_small_randread'	: 'fio -name iops -rw=randread -bs=4k -runtime=60 -iodepth 32 -filename /dev/sda6 -ioengine libaio -direct=1 -numjobs=4',
	'4_small_write'		: 'fio -name iops -rw=write -bs=4k -runtime=60 -iodepth 32 -filename /dev/sda6 -ioengine libaio -direct=1 -numjobs=4',
	'4_small_randwrite'	: 'fio -name iops -rw=randwrite -bs=4k -runtime=60 -iodepth 32 -filename /dev/sda6 -ioengine libaio -direct=1 -numjobs=4',
	'4_big_read'		: 'fio -name iops -rw=read -bs=10M -runtime=60 -iodepth 32 -filename /dev/sda6 -ioengine libaio -direct=1 -numjobs=4',
	'4_big_randread'	: 'fio -name iops -rw=randread -bs=10M -runtime=60 -iodepth 32 -filename /dev/sda6 -ioengine libaio -direct=1 -numjobs=4',
	'4_big_write'		: 'fio -name iops -rw=write -bs=10M -runtime=60 -iodepth 32 -filename /dev/sda6 -ioengine libaio -direct=1 -numjobs=4',
	'4_big_randwrite'	: 'fio -name iops -rw=randwrite -bs=10M -runtime=60 -iodepth 32 -filename /dev/sda6 -ioengine libaio -direct=1 -numjobs=4'
}
run_cmds(cmds)

test_case1/parse.cpp

Read more

罗马历史年表

罗马时期

罗马十二主神
	Diana/Dĭāna: 狄安娜/月亮与橡树女神/Artemis、赫卡忒、腓尼基神话的刻勒斯塔女神
Janus: 雅努斯/门神
Somnus: 索莫纳斯/睡神
Bellona: 贝罗纳/战争女神/Mars之妻/Enyo

Flora: 芙罗拉/克罗丽丝/花神
Zephyr: 西风之神

Gaul: 高卢

努米托/兄弟阿穆利乌斯
	雷亚西尔维亚/女祭司/维斯太贞女/被阿穆利乌斯丢弃

Mars: 马尔斯/战神
	Remus: 莱姆斯/雷亚西尔维亚之子
	Romulus: 罗慕路斯/雷亚西尔维亚之子/杀兄成战神奎里纳斯

Lupin: 狼人

Alexander the Great: 亚历山大/前356-前323

Carthage: 迦太基/前8世纪-前146年
	Hannibal Barca: 汉尼拔_巴卡/前247-前183

Gaius Julius Caesar: 恺撒/前100-前44
Spartacus: 斯巴达克斯/前69

Nero: 尼禄/37-68/
Decius: 德修/249-251/全国性地迫害基督教
Constantine the Great: 君士坦丁一世/272-337/第一位信仰基督教的皇帝
Theodosius I: 狄奥多西一世/347-395/330年将帝国一分为二/393年宣布基督教为国教
	西罗马/476年在蛮族的侵袭下灭亡
		800年罗马教宗里奥三世为查理曼大帝加冕
		814-858,Pope Joan/约翰娜/女教皇
	Byzantine Empire: 拜占廷帝国/395-1453/东罗马/东正教
		Julia: 尤利安/361-363/apostate
		希拉克略/620年定希腊语为官方语言
		726年利奥三世下令捣毁帝国境内所有圣象
		查士丁尼/将北非以西、意大利和西班牙的东南并入版图,554年击败法兰克王国
		1054年天主教和东正教大分裂
		1095年穆斯林再度兵临城下,东正教向天主教求救,罗马教宗乌尔班二世发起了第一次十字军东征
		1204年首都君士坦丁堡被第四次十字军东征洗劫

Ammonius Saccas: 阿摩尼阿斯 萨卡斯/175-242
	Plotinus: 普罗提诺/204-269/新柏拉图主义

Philo Judeaus: 斐洛尤迪厄斯/前15-40
Pantaenus: 潘代诺
	Titus Flavius Clemens: 革利免/150-215/
		Origenes Adamartius: 俄利根/185-254/

Athanasius: 296-373
Theophilus: 提阿非罗/391/
	Cyril: 西里尔/375-444/

Theon: 赛翁
	Hypatia/: 希帕蒂娅/370-415/
		Orestes: 奥瑞斯特斯/Alexandria总督
		Synesius of Cyrene: 辛乃西斯

希波的奥古斯丁/Augustine of Hippo/354-430

Damascius: /逃亡波斯

1265-1321	Dante Alighieri/但丁·阿利吉耶里

1479-1555	Juana/胡安娜/西班牙女王

?-1557		塔塔尼亚/口吃
			卡尔丹诺/三次方程一般解/令y = x + (a over 3)/给自己算死期不准,自杀
			费拉里/四次方程一般解

1776-1856	Ameldeo Avogadro/阿伏伽德罗

			开普勒/死在讨薪

1824		阿贝尔/Norway/无钱出论文/肺结核

Carthagia: 迦太基

Punic Wars: 布匿战争
巴卡家族
	汉尼拨

圣经

莎乐美和圣约翰
约阿施
	Gideon: 吉迪恩
印第安人

大航海

1452-1506	Columbus/哥伦布
1480-1521	Ferdinand Magellan/麦哲伦

refer to:
闲时乱翻书

德国历史年表

Prussia 普鲁士

1
2
3
4
5
1224		Deutscher Orden 条顿骑士团建国
1512		Albrecht von Brandenburg-Ansbach 阿尔布雷希特
1483-1546	Martin Luther 马丁_路德
 
1712-1786	Friedrich II 腓特烈二世/七年战争

Austria 奥地利
Hungary 匈牙利
Bohemia 波希米亚 = Czech 捷克
Bavaria 巴伐利亚 = Bayern 拜仁

1
2
3
4
5
1576-1612	Rudolf II/欧洲三十年战争
1717-1780	Maria Theresa 玛丽亚_特蕾莎/Franz Stephan 弗朗茨_斯蒂芬之妻
			Marie Antoinette 玛丽_安托瓦内特/路易十六王后
1837-1898	Elisabeth Amalie Eugenie 茜茜公主/被刺杀
1863-1914	Archduke Franz Ferdinand of Austria 弗朗茨·斐迪南大公/茜茜公主之侄/被Gavrilo Princip刺杀的萨拉热窝事件

二战

1
2
3
4
193910月		纳粹完全占领波兰/盖世太保搜杀波兰精英人士/卡廷惨案
1943年初		德军在斯大林格勒战役中惨败
1943419日		华沙犹太人起义
194481日		华沙起义/避免波兰被苏联赤化

沙俄

1
2
3
4
5
彼得一世
Catherine I 叶卡捷琳娜一世
安娜女皇
伊丽莎白女皇
叶卡捷琳娜二世

refer to:
杨藩讲艺术
黄娜老师
https://baike.baidu.com/item/%E5%8D%8E%E6%B2%99%E8%B5%B7%E4%B9%89/13013998