2020年5月22日 星期五

Excel tips

[add analysis toolpak]
file -> option -> addon -> analysis toolpak -> execute -> check on 'analysis toolpak' & 'analysis toolpak-VBA' -> OK

[array to list]
idea: auto calculate the new index by mod function
template: https://drive.google.com/file/d/19USrMKCdxX2rjd_XbNw22r9lC0a7GZbL/view?usp=sharing

[histogram]
Method 1: analysis toolpak
Con: have to regenerate histogram manually every time, when the data changes
step 1: data -> analysis -> histogram ->

'input range' : data to be analysis; eg. sheet1!A1:LR259
'range' : the x-axis of the histogram eg. B4:B24
'output range' : the count results D1
check on the plot out
-> OK

Method 2: using frequency function
Pros: update the data automatically
Cons: additional techniques to plot
Steps:
1. evaluate the max/min of data
2. create the x-axis
3. using frequency function:
3.1 select the output array  eg. B2:B22
3.2 input '=FREQUENCY(HG_data!$A$1:$LR$259,$A$2:$A22)' in the function slot
3.3 press 'Ctrl+Shift+Enter' to generate the histogram data
4. plot the histogram
4.1 insert -> histogram plot
4.2 right click on the empty plot and choose (E)
4.3 Add new data & axis
4.4 add some labels as you like
4.5 add variable content: create a text box, select the text box, put '=A1' or some other text or variable, enter
Method 3: 數據透視圖
數據透視圖
not trying this

template:
https://drive.google.com/file/d/17q_Tm6EeQ5qmAQhTF-nGKRb8711FZ4-R/view?usp=sharing

ref.1 https://kknews.cc/zh-tw/code/peqojnp.html
ref.2 https://isvincent.pixnet.net/blog/post/37718302-excel-%E8%AE%93%E5%9C%96%E8%A1%A8%E7%9A%84%E6%A8%99%E9%A1%8C%E8%87%AA%E5%8B%95%E6%9B%B4%E6%96%B0
ref.3

[fill a long list]
Method 1: left click on the green square dot and drag down

Method 2: ctrl+G
step 1: select J1
step 2: ctrl+G and input 'J1:J6', then OK
step 3: type the command for J1, eg. =INDEX($A$1:$C$2, MOD(ROW(H1)-1, 2)+1, MOD( FLOOR((ROW(H1)-1)/2, 1), 3)+1)
step 4: press 'ctrl+enter'

template: https://drive.google.com/open?id=19USrMKCdxX2rjd_XbNw22r9lC0a7GZbL

ref.1 https://superuser.com/questions/948175/fill-a-large-range-with-a-formula-in-excel-without-mouse-dragging-to-extend

2020年4月8日 星期三

PTT 自動登入 (auto PTT login through ssh)

[Linux]:
[ref]
1. https://gist.github.com/M157q/ad375e227ec0f1ba450915df65433473
2. http://tcl-eval.blogspot.com/2018/11/tclexpect-auto-login-to-ptt-bbs-using.html
3. https://www.cnblogs.com/lzrabbit/p/4298794.html

@CentOS8
>> dnf install tcl expect
>> vi ssh2PTT.sh

script:
>>
#!/usr/bin/env expect
# Login into PTT via SSH.
# Combine crontab with this script so you don't forget to login PTT everyday.
# Usage: /bin/bash -c ${FILE_PATH_OF_THIS_SCRIPT}
# Example in crontab:
# ptt auto login, every day at 12:00 PM
# 0 12 * * * /bin/bash -c ${ABSOLUTE_FILE_PATH_OF_THIS_SCRIPT}

spawn ssh -oBatchMode=no -oStrictHostKeyChecking=no bbsu@ptt.cc
set BBS_ID "REPLACE_WITH_YOUR_ID"
set BBS_PW "REPLACE_WITH_YOUR_PASSOWRD"
expect {
      "請輸入代號" { send "$BBS_ID\r" ; exp_continue }
      "請輸入您的密碼" { send "$BBS_PW\r" ; exp_continue }
      "您想刪除其他重複登入的連線嗎" { send "N\r" ; exp_continue }
      "您要刪除以上錯誤嘗試的記錄嗎" { send "N\r" ; exp_continue }
      "密碼不對喔" { exit }
      "裡沒有這個人啦" { exit }
      "請勿頻繁登入以免造成系統過度負荷" { send "\r" ; exp_continue }
      "請按任意鍵繼續" { send "\r" ; exp_continue }
      "oodbye" { exit }
 }
interact 
exit
>>
>> ./ssh2PTT.sh


[Windows 10 X64]:
[ref]
1. https://www.ptt.cc/bbs/Linux/M.1285695860.A.B95.html
2. https://bobjin.com/blog/view/3568ea7f829d9609b31806beab906e97.html
3. https://dreamtails.pixnet.net/blog/post/28197814
4. https://www.jianshu.com/p/94827688e093
5. https://blog.51cto.com/superleedo/2119076
6. https://www.cnblogs.com/zy6103/p/10222996.html
7. https://pypi.org/project/wexpect/
PS. winpexpect stop maintaining

Method 1. Python + pexpect + openssh/plink ... bad
1. download & install anaconda
https://www.anaconda.com/distribution/#download-section
note: check 'path' option would be easier
2. C:\> pip install wexpect
Comment: bad solution
1. winpexpect is obsolete and stop maintaining
2. pexpect doesn't work on Windows
3. wexpect works only on python 2.7 and will be obsolete soon

Method 2: cygwin + expect + openssh
wait for trying

2020年3月30日 星期一

sickness exam and chip test

[ref]
https://imgur.com/vxPbMRl













https://www.ptt.cc/bbs/Gossiping/M.1585593748.A.8FC.html
https://books.google.com.tw/books?id=biu_BAAAQBAJ&pg=PA70&lpg=PA70&dq=chip+test+overkill+rate&source=bl&ots=XIV-nEMKA1&sig=ACfU3U00ecNSFwuN8cLqjfO0tUxiQvQrbg&hl=zh-TW&sa=X&ved=2ahUKEwjJmvTCxMPoAhVyxYsBHfnHDqoQ6AEwAXoECAsQLQ#v=onepage&q=chip%20test%20overkill%20rate&f=false


疾病檢測跟晶片檢測有相似之處
樣本空間: 所有待測人/晶片

生病的人/生產不良的晶片

做一個檢驗, 驗出相信是生病的人/壞掉晶片
兩個圈圈會切出四個區域
醫學領域:
盛行率prevalance: p=(a+b)/(a+b+c+d)
敏感度sensitivity, sen= a/(a+b)
特異度specificity, spe= d/(c+d)
陽性預測值, PPV = a/(a+c)
陰性預測值, NPV = d/(b+d)


晶片領域:
配合[ref]1定義, 
b 為誤放, 要準備面對面訴及返修成本提高或賠償, 
c為誤砍 (overkill) 晶片業的大忌, 面對報廢品增多/成本提高
盛行率 <-> 全部晶片裡壞掉的比例
敏感度 <-> 壞晶片裡, 驗出為壞掉的比例
特異度<-> 好晶片裡, 驗出為好的晶片
陽性預測值 <-> 測試宣告為壞的晶片裡, 真的壞掉的比例
陰性預測值 <-> 測試宣告為好的晶片裡, 壞掉的機率

2020年3月3日 星期二

Cadence: default environment setting

ref. https://community.cadence.com/cadence_technology_forums/f/custom-ic-design/24143/default-font-size-for-virtuoso-visualization-analysis

>> vi ~/.cdsenv
   ; define output waveform format
   spectre.outputs simOutputFormat string "psfbin"
   ; define undo step counts
   ui undoLevel int 10
   ; do not show what's new window
   ddserv  showWhatsNew    string  "no"
   layout  showWhatsNew    string  "no"
   asimenv showWhatsNew string "no"
   asimenv showWhatsNew string "5.1.0"
   ; update CDF property automatically
   auCore.misc updateCDFtermOrder boolean t
   ;set default font
   viva.axis font string "Default,16,-1,5,:50,0,0,0,0,0"

[CIW font]
CIW -> options -> fonts -> CIW: uncheck "use text font" adjust by your like

2020年2月13日 星期四

linux non-technique topics

[dphys-swapfile]
a famous and default swap management tool in debian/raspbian by 20200214.
dphys: the department of Phsyics of ETH Zurich

website: https://github.com/isgphys?language=shell
Thanks for their kindly contribution and great work.