switch between shell and anaconda in serial console

as are indicated at the bottom of the console, there are 5 windows in anaconda, you 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

阅读更多

罗马历史年表

罗马时期

罗马十二主神
	Diana/Dĭāna: 狄安娜/月亮与橡树女神/Artemis、赫卡忒、腓尼基神话的刻勒斯塔女神
Janus: 雅努斯/门神

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

Gaul: 高卢

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

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

Lupin: 狼人

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/但丁·阿利吉耶里
1452-1519	Leonardo da Vinci/列奥纳多·达·芬奇
1475-1564	Michelangelo Buonarroti/米开朗基罗·博那罗蒂
1483-1520	Raffaello Sanzio da Urbino/拉斐尔·桑西
1776-1856	Ameldeo Avogadro/阿伏伽德罗

Carthagia: 迦太基

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

圣经

约阿施
	Gideon: 吉迪恩
印第安人

大航海

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

德国历史年表

二战

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

refer to:
https://baike.baidu.com/item/%E5%8D%8E%E6%B2%99%E8%B5%B7%E4%B9%89/13013998

how to turn off fans in linux

after running 'sensors-detect' command, kernel modules controlling fan speed will be loaded.

here is an occasion with 'Nuvoton NCT6102D/NCT6104D/NCT6106D Super IO Sensors' detected.

as nct6775 document said:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#/sys/class/hwmon/hwmon4
pwm[1-7]
    - this file stores PWM duty cycle or DC value (fan speed) in range:
	   0 (lowest speed) to 255 (full)
 
pwm[1-7]_enable
    - this file controls mode of fan/temperature control:
	* 0 Fan control disabled (fans set to maximum speed)
	* 1 Manual mode, write to pwm[0-5] any value 0-255
	* 2 "Thermal Cruise" mode
	* 3 "Fan Speed Cruise" mode
	* 4 "Smart Fan III" mode (NCT6775F only)
	* 5 "Smart Fan IV" mode
...

ps1. if set pwm[1-7]_enable to 0, you will not be able to change it to other value, unless reboot linux.
ps2. I still can't find a common way to turn off fans using ipmitool.

IPMI: Intelligent Platform Management Interface
BMC: Baseboard Management Controller
FRU: Field Replaceable Unit

refer to:
[linux-kernel-src-root]/Documentation/hwmon/nct6775.rst
https://bbs.archlinux.org/viewtopic.php?id=225349

c++ move forward

lvalue: loactor value
rvalue: read value

here is an example of class definition with only one constructor using template and 'forward' technique to tackle varying parameter:

rvalue.cpp

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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include <iostream>
#include <functional>
 
using namespace std;
 
template <typename T>
constexpr bool is_lvalue(T&) {
	return true;
}
 
template <typename T>
constexpr bool is_lvalue(T&&) {
	return false;
}
 
class MyStr
{
public:
	template<class T>
	MyStr(T&& t)
	{
		set(forward<T>(t));
	}
	template<class T>
	void set(T&& t)
	{
		if constexpr (conjunction_v<is_convertible<T&, MyStr&>>)
		{
			if (!is_lvalue(forward<T>(t)))
			{
				str_ = forward<string>(t.str_);
				cout << "is rvalue, type MyStr." << endl;
			}
			else
			{
				str_ = t.str_;
				cout << "is lvalue, type MyStr." << endl;
			}
		}
		else
		{
			str_ = forward<T>(t);
			cout << "is string." << endl;
		}
	}
	template<class T=char>
	void test()
	{
		cout << "test T size is " << sizeof(T) << endl;
	}
	string str_;
};
 
int main()
{
	cout << "call constructor:" << endl;
 
	MyStr str1("str1");
	MyStr str2(str1);
	MyStr str3(move(str1));
 
	cout << "call member function:" << endl;
 
	str1.set("set1");
	str2.set(str1);
	str3.set(move(str1));
 
	str3.test();
 
	return 1;
}

make

1
g++ -o rvalue -g -O0 -std=c++17 rvalue.cpp

output

1
2
3
4
5
6
7
8
call constructor:
is string.
is lvalue, type MyStr.
call member function:
is string.
is lvalue, type MyStr.
is rvalue, type MyStr.
test T size is 1

refer to:
http://www.javashuo.com/article/p-olwxiggw-q.html
http://c.biancheng.net/view/7829.html
https://zhuanlan.zhihu.com/p/99524127

AF-1020 ipsec

问题一:第三方对接都配置好了,实时抓包却未见AF-1020发isakmp或esp包。
1,第一阶段里要配线路出口,网络接口要选对接口并指定同样的线路出口。
2,VPN接口设置里要选择另一个网络接口为内网接口。
3,线路出口对应的网络接口与内网对应的网络接口不能相同网段。
问题二:第一阶段过后不进行第二阶段。
有可能在第二阶段设置中,出站策略与入站策略的源IP子网相同了。
问题三:同一个连接中无法生成多个ESP通道。
比如,同一个连接对应的第二阶段设置中,出站策略两个,入站策略两个,在AF-1020主动发起quick mode协商时,会一股脑儿向对端发2X2=4个esp sa isakmp包。
但根据ike协议的要求,每个包取hash需要的iv是放在ike sa的上下文中,这样其中3个esp sa isakmp包会被对端认为hash payload不正确而被抛弃。
而AF-1020 DLAN运行状态中却显示第二个通信连接成功了,其实是个BUG。
但是AF-1020在被动quick mode协商中,可以正确生成多个ESP通道。

refer to:
http://blog.itpub.net/81227/viewspace-2670399/