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.

2019年5月9日 星期四

cadence composer notes

[undo limits]
>> vi ~/.cdsinit

hiSetUndoLimit(10)     

or 
>> vi ~/.cdsenv
ui undoLevel int 10


[parameterized symbol]
fill pPar("parameter") into property boxes
http://www.egr.msu.edu/classes/ece410/mason/files/tutorialD.pdf

[CDL out pin order control]
ref. https://softwareoptimization.wordpress.com/2014/09/05/problem-solved-pin-order-virtuoso-cadence/

Step A:

  1. Open the CELL symbol using the Symbol Editor. Open the Pin Order setup by clicking on: EDIT -> Properties -> Pin Order. In the Edit Pin Order window, set the desired pin order. Click on Apply and OK. Save it.  Close the symbol editor.
  2. Open the CELL schematic using the Schematic Editor. Open the Pin Order setup by clicking on: EDIT -> Properties -> Pin Order. Select COPY From: Symbol, to get the pin order you set on step [A1]. If you didn’t get the desired pin order, change it manually and save it. Close the schematic editor.
  3. Open again (to make sure it was saved) both symbol and schematic and verify if the PIN ORDER is correct. If everything is “ok”, close both editors, if not, fix it by following step [A1] and [A2].

Step B:

  1. Check the root where you execute virtuoso (same directory where the cds.lib and .cdsinit are placed) for the file .simrc
    1. If the file (.simrc) doesn’t exist, create the file .simrc in the directory identified before.
  2. Edit the file (.simrc) and include the line: auCdlCDFPinCntrl=t
    1. If this line was already included, but with different value, change it. This will make the CDL use your PIN ORDER, instead of the default chosen by Cadence.

Step C:

  1. Go to the CIW window, and open the CDF Editor, by clicking on Tools -> CDF -> Edit.
  2. In the “Edit CDF” window, select the Scope: Cell, and  CDF Layer: Base.
  3. Now select the desired LIBRARY and CELL NAME that you want to change the PIN ORDER. You will have to change the PIN ORDER of each cell individually.
  4. After selecting the CELL, select the tab “Simulation Information” and them select “Choose Listing:By Simulator“. Select the simulator “auCdl” .
  5. Now edit the fields as follow. Change the pin names “my_pin_1,2,3” for the desired name/order you have chosen. You probably don’t need to change the namePrefix. Consult the CDF documentation if need any additional customization.
    1. netlistProcedure: ansCdlSubcktCall
    2. componentName: subcircuit
    3. termOrder: “my_pin_1” “my_pin_2” “my_pin_3”
    4. namePrefix: X
  6. Click on APPLY to confirm the change.
  7. Repeat step [C4 to C6] for each desired cell.
! IMPORTANT (STEP C4): The name of the PINS in the “termOrder“, should be enclosed by ” “.  If my cell is a NAND gate with pins A1 A2 ZN, the termOrder will be: “A1” “A2” “ZN”

End:

  1. Go to the CIW window, and open the CDL Exporter, by clicking on File -> Export -> CDL . Choose the desired schematic to export and confirm.
  2. Verify if the CELL pin order is correct. If not, review STEP A,B,C.
    1. Make sure the Step C was done properly. Close the environment, and open it again. Check if your changes were salved.
     
[schematic to layout] IC6
launch -> virtuoso XL -> connectivity -> update -> components and nets...
[ref]
http://www2.ece.rochester.edu/~maricic/autorouter_Cadence_XL.htm
http://web.nchu.edu.tw/~ycchiang/VLSI_Lab/Layout%20fundamental.pdf





2019年4月23日 星期二

omxplayer loop bash on Raspbian + RPi3B

#!/usr/bin/env bash
#
# Plays videos from playlist
#
# Copyright  2013 Janne Enberg http://lietu.net/
# This work is free. You can redistribute it and/or modify it under the
# terms of the Do What The Fuck You Want To Public License, Version 2,
# as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.
#

# setup loop times: -1/0: infinite; 1~999: repeat loop
# loop=3
loop=$1
echo "input loop number is: " $loop

# create a playlist in ./ folder
find "$PWD" -name "*.mp4" > playlist.m3u

# Where is the playlist
# PLAYLIST_FILE="${HOME}/.playlist"
PLAYLIST_FILE="playlist.m3u"

# make a copy of the original playlist
cp ${PLAYLIST_FILE} ${PLAYLIST_FILE}.tmp

# If you want to switch omxplayer to something else, or add parameters, use these
PLAYER="omxplayer"
PLAYER_OPTIONS=" -b "

# Process playlist contents
while [ true ]; do
        # Sleep a bit so it's possible to kill this
        sleep 1

        # Do nothing if the playlist doesn't exist
        if [ ! -f "${PLAYLIST_FILE}" ]; then
                echo "Playlist file ${PLAYLIST_FILE} not found"
                continue
        fi
       
        # Get the top of the playlist
        file=$(cat "${PLAYLIST_FILE}.tmp" | head -n1)

        # And strip it off the playlist file
        cat "${PLAYLIST_FILE}.tmp" | tail -n+2 > "${PLAYLIST_FILE}.rest"
        mv "${PLAYLIST_FILE}.rest" "${PLAYLIST_FILE}.tmp"

        # Skip if this is empty
        if [ -z "${file}" ]; then       
                if [ $loop -eq -1 ]; then
                        #cp ${PLAYLIST_FILE} ${PLAYLIST_FILE}.tmp
                        cp ${PLAYLIST_FILE} ${PLAYLIST_FILE}.tmp
                elif [ $loop -gt 1 ]; then               
                        cp ${PLAYLIST_FILE} ${PLAYLIST_FILE}.tmp
                        loop=$(($loop - 1))
                        echo "rest loop number is: " $loop
                else       
                        echo "Playlist empty or bumped into an empty entry for some reason"
                        continue
                fi
        fi

        # Check that the file exists
        if [ ! -f "${file}" ]; then
                echo "Playlist entry ${file} not found"
                continue
        fi

        echo
        echo "Playing ${file} ..."
        echo

        "${PLAYER}" ${PLAYER_OPTIONS} "${file}"

        echo
        echo "Playback complete, continuing to next item on playlist."
        echo    
done

2019年2月26日 星期二

Tapeout note

tone
-clear: 哪裡有圖樣, 挖哪裡,etch where the empty place is
-dark

Field:
-positive:
-negative: 沒保護的挖掉

最後只有兩種 tone/field: D/P or C/N