In physics, symmetry is synonymous with invariance. When everything follows rules, the universe is deterministic. Uncertainty does not change and no information is produced. Under quantum mechanics, the world undergoes only reversible transformations. A purported collapse of state results in multiple universes that remain indefinitely unless it is observed one way or the other. If not, the multiplicity will merge and the “out come” will be irrelevant and immaterial.
Author: chunchung
Where should npm go?
I am doing this on my Debian:
npm config set prefix ~/.local
npm install npm@latest -g
Since ~/.local/bin
is already in my PATH
, there is no need to tweak my environment.
Biological structures
Biological structures are shaped by dynamic functional requirements. The purported process is termed evolution. Studies of biological structures should be placed in these functional context with mechanisms of emergence.
教、學與自我
一個人的成長、學習的主角是她自己。雖然在當下的社會中,我們在各個情況下提供了教導者的角色來幫助,要注意的是不要讓教導者成了主角。如果一個人會因為教導者的表現水準的限制而無法學習其所教導的內容,則她所有的成長,是沒有希望高過她所能夠遇到的教導者的。這有如讀一篇文章只看到了紙墨而看不見文字,看到了字、句而不能明暸文義。讀通了文義卻體會不到為文者的心意。舉一隅、反一隅,無異於器,這是何其可惜啊!
才能、控制、成就
專注力
創造力
適應力
同中求異,異中求同
簡單的道理往往有深遠的運用、蘊涵。
Certificate for courier esmtpd
To enable SSL/TLS support for the ESMTP, you need to have a server certificate. Usually, the installation process of the package in a Linux distribution will create a default, self-signed certificate for you. However, if you want to create a proper certificate for your site, following is some simple steps to do so.
First, you need to generate a key for your server if you don’t already have one:
openssl genrsa -out server.key 2048
With that key, you can then generate a certificate request:
openssl req -new -key server.key -out server.csr
If you did not customize your openssl.cnf configuration file, the above command will prompt you for the details of identify for the server in the certificate. Answer all questions as you please except for the common name “CN”, which should be the host name to connect to your server.
Now, you need to get a Certificate Authority to sign your request. For example, if you have a demoCA setup for your openssl installation, you can do:
openssl ca -config openssl.cnf -policy policy_anything -out server.crt -infiles server.csr
This results in the certificate file server.crt. You then can combine the server key and certificate files to create the certificate file for the courier mail server.
cat server.key server.crt > esmtpd.pem
This used to be sufficient. However, the newer version (0.73) of courier requires a “DH parameters” block in the certificate file. This can be generated and appended with:
openssl dhparam 1024 >> esmtpd.pem
Now, you can point the “TLS_CERTFILE” in all the configuration files to the certificate esmtpd.pem and restart your server.
Example: data preprocessing with BASH
Case situation
I have run some batch jobs on a cluster to process data files for different systems (msc, ms, sh, rd) and parameters (i and w). The files are in different subdirectories:
[cjj@gust pattern]$ ls d-*/*.spd
d-msc/i275w042526.spd d-ms/i285w025017.spd d-rd/i295w042812.spd
d-msc/i280w040241.spd d-ms/i290w023034.spd d-sh/i275w051138.spd
d-msc/i285w036791.spd d-ms/i295w020787.spd d-sh/i280w047315.spd
d-msc/i290w031925.spd d-rd/i270w065151.spd d-sh/i285w043415.spd
d-msc/i295w026791.spd d-rd/i275w060475.spd d-sh/i290w039589.spd
d-ms/i270w034433.spd d-rd/i280w055777.spd d-sh/i295w035791.spd
d-ms/i275w030644.spd d-rd/i285w051257.spd
d-ms/i280w027133.spd d-rd/i290w046948.spd
[cjj@gust pattern]$
While, the output files are in the current directory:
[cjj@gust pattern]$ ls *.o*
i270w034433.spd.o172489 i275w060475.spd.o172496 i285w036791.spd.o172486
i270w065151.spd.o172495 i280w027133.spd.o172491 i290w023034.spd.o172493
i275w030644.spd.o172490 i280w040241.spd.o172485 i290w031925.spd.o172487
i275w042526.spd.o172484 i285w025017.spd.o172492 i295w026791.spd.o172488
[cjj@gust pattern]$
The format of the output log files are as follows:
[cjj@gust pattern]$ cat i270w034433.spd.o172489
MinTemplateNumber = 3
JT = 5
JN = 1
spikeResolution = 2
Number of initial spike patterns have been found : 562
ans = Creating surrogate data
ans = Creating time jittering surrogate data
ans = Creating neuron jittering surrogate data
Number of spike patterns have been valid by checking with sorrogate : 542
Number of spike patterns have been ruled out because of having less complex : 205
Number of valid spike patterns have been found : 337
[cjj@gust pattern]$
Problem task
Gather the stats in the log files as those marked in red.
Solution 1
This is done with a one-liner:
[cjj@gust pattern]$ for i in d-*/*.spd;do n=${i%/*};n=${n#d-};s=${i#*/};if [ -f ${s}.o* ];then w=${s%.spd};w=${w#*w}; echo ${n} ${s:1:2}.${s:3:1} $((1${w:0:2}-100)).${w:2} `grep ':' ${s}.o* | awk '{print $NF}'`;fi;done > matching_stat.txt
which can be broken down to:
for i in d-*/*.spd;do
n=${i%/*}
n=${n#d-}
s=${i#*/}
if [ -f ${s}.o* ];then
w=${s%.spd}
w=${w#*w}
echo ${n} ${s:1:2}.${s:3:1} $((1${w:0:2}-100)).${w:2} `grep ':' ${s}.o* | awk '{print $NF}'`
fi
done > matching_stat.txt
The data file generated is:
[cjj@gust pattern]$ cat matching_stat.txt
msc 27.5 4.2526 81 75 22 53
msc 28.0 4.0241 237 217 103 114
msc 28.5 3.6791 393 371 156 215
msc 29.0 3.1925 335 322 132 190
msc 29.5 2.6791 445 437 144 293
ms 27.0 3.4433 562 542 205 337
ms 27.5 3.0644 1037 1006 331 675
ms 28.0 2.7133 1141 1093 341 752
ms 28.5 2.5017 1325 1274 462 812
ms 29.0 2.3034 1652 1609 747 862
rd 27.0 6.5151 1031 953 313 640
rd 27.5 6.0475 1042 963 345 618
[cjj@gust pattern]$
教學相長
方法很重要:錯的話,簡單的事也會變難。對的話,難的事也可以辦得到。像是推拉車過野地:你可以用盡力氣推它、拉它。但是如果你不知道去引導,它是到不了你要它去的地方。
學東西是這樣,教人家東西也是這樣。
要有方法!
一定的時間
小孩子要花一定的時間在自己有興趣,可以專注進行的時情上。但是比例不能過高,可以隨成熟度增加。而在成人之後,也須要有一定的時間花在自己沒有興的事情上。這一定的時間,可能是兩到三成左右吧?