Wednesday, June 16, 2021

Linux查詢目錄大小

 du -chd 1 | sort -h 

這個指令才是把當前路徑中所有目錄所佔用大小做統計並且排序。


Reference:

https://www.mxp.tw/8171/


Sunday, September 2, 2018

Memory leak check command

valgrind --leak-check=full --show-leak-kinds=all --verbose opp_run -u Cmdenv -c uptp-2STAs-11ax-Udp-BoraFw-TPC -n ../..:../../../src -l ../../../src/inet biTp_fwcode_udp_tpc.ini -r 2 &> ul_twoSta_tpc_debug2.txt

Thursday, June 28, 2018

VIM 正規化 取代方法

    0, 'biTp_fwcode_udp_tpc.ini', 'uptp-4STAs-11ax-Udp-BoraFw-TPC-Topology3', 'throughput_sum.awk', '394.80736', 0, 1, # IRUI, 4STA MU-OFDMA, Max power, PER-based RA
    0, 'biTp_fwcode_udp_tpc.ini', 'uptp-4STAs-11ax-Udp-BoraFw-TPC-Topology4', 'throughput_sum.awk', '385.63856', 0, 1, # IRUI, 4STA MU-OFDMA, Max power, PER-based RA
    0, 'biTp_fwcode_udp_tpc.ini', 'uptp-4STAs-11ax-Udp-BoraFw-TPC-Topology5', 'throughput_sum.awk', '380.11392', 0, 1, # IRUI, 4STA MU-OFDMA, Max power, PER-based RA
 
取代成

    0, 'biTp_fwcode_udp_tpc.ini', 'uptp-4STAs-11ax-Udp-BoraFw-TPC-Topology3', 'throughput_sum.awk', '1', 0, 1, # IRUI, 4STA MU-OFDMA, Max power, PER-based RA
    0, 'biTp_fwcode_udp_tpc.ini', 'uptp-4STAs-11ax-Udp-BoraFw-TPC-Topology4', 'throughput_sum.awk', '1', 0, 1, # IRUI, 4STA MU-OFDMA, Max power, PER-based RA
    0, 'biTp_fwcode_udp_tpc.ini', 'uptp-4STAs-11ax-Udp-BoraFw-TPC-Topology5', 'throughput_sum.awk', '1', 0, 1, # IRUI, 4STA MU-OFDMA, Max power, PER-based RA

可以用
:'<,'>s/, '[0-9].*'/, '1'/g

Monday, September 25, 2017

PDF 處理工具 pdftk in CentOS 7

下載篇:
https://www.linuxglobal.com/pdftk-works-on-centos-7/

指令篇:
http://seisman.info/introduction-to-pdftk.html

Friday, September 22, 2017

install FTP in CentOS

Refer to
http://luyaku.pixnet.net/blog/post/188199646-vsftpd%EF%BC%9Aftp-server-%E5%AE%89%E8%A3%9D%E8%88%87%E8%A8%AD%E5%AE%9A

install Samba 4.4.4 in CentOS

yum --nogpgcheck localinstall samba-common-libs-4.4.4-14.el7_3.x86_64.rpm samba-libs-4.4.4-14.el7_3.x86_64.rpm samba-common-tools-4.4.4-14.el7_3.x86_64.rpm libsmbclient-4.4.4-14.el7_3.x86_64.rpm samba-client-4.4.4-14.el7_3.x86_64.rpm samba-4.4.4-14.el7_3.x86_64.rpm libwbclient-4.4.4-14.el7_3.x86_64.rpm samba-client-libs-4.4.4-14.el7_3.x86_64.rpm samba-common-4.4.4-14.el7_3.noarch.rpm


CentOS 7更新後的暫純檔位置

/var/cache/yum/x86_64/7/updates/packages

Friday, September 8, 2017

ouput the standard output to variable

1. 引入library
import subprocess

2. 定義函數
def get_cmd_line_results(input_string):
    os.chdir(INET_DIR)
    proc = subprocess.Popen(input_string, stdout=subprocess.PIPE, shell=True)
    #"git symbolic-ref HEAD"
    (out, err) = proc.communicate()
    os.chdir(CUR_DIR)
    return out[:-1]



3. 在主程式內容呼叫
inet_branch = get_cmd_line_results("git symbolic-ref HEAD")

Tuesday, August 29, 2017

crontab usage rule in Linux

1. create new crontab task:
crontab -e
https://code.kpman.cc/2015/02/11/%E5%88%A9%E7%94%A8-crontab-%E4%BE%86%E5%81%9A-Linux-%E5%9B%BA%E5%AE%9A%E6%8E%92%E7%A8%8B/

2. delete crontab task text in "crontab -e":
crontab -r
3. lookup current crontab task in "crontab -e":
crontab -l
4. delete on-going crontab task:
ps -o pid,sess,cmd afx
For example:
(4-1) find the task executed by cron:
 88588  88588 /usr/sbin/crond -n
160149  88588  \_ /usr/sbin/crond -n
134979  88588  \_ /usr/sbin/CROND -n
134982 134982      \_ /bin/sh -c python /dataVol/homes/yarco.yang/omnetpp/inet_11ax/examples/wireless/ieee80211ax/feature_test_script/auto_peak_txop_ps_per0.py 1 > ~/run_11ax_txop.log
134984 134982      |   \_ python /dataVol/homes/yarco.yang/omnetpp/inet_11ax/examples/wireless/ieee80211ax/feature_test_script/auto_peak_txop_ps_per0.py 1
170760 134982      |       \_ sh utility_script/vector_filter_fast.sh results/dntp-4STAs-11ax-AMSDU-UDP-AlgoA-4A0B-TXOP-4NSS-4.vec resul ...

(4-2) crontab start executing a python script, you can kill this python script task by
kill -9 134984 

ref: https://superuser.com/questions/232144/how-to-stop-a-currently-running-cron-job/834110

Friday, April 1, 2016

OMNeT++/OMNEST priority schedule for the event at the same time

In OMNeT++/OMNEST, sometimes two events may arrive at the same time. However, the OMNeT++/OMNEST can only handle both events in sequence based on the arrival time of each event. If we hope to always handle a event before the other event, we can use the following function to handle this problem.

setSchedulingPriority(short p)

where p is the priority, the smaller number of p has higher priority.
refer to.
https://omnetpp.org/doc/omnetpp/api/classcMessage.html#a205278b4eaf8a54a901537f6e6cfae59


Examples:
cMessage *timer1 = new cMessage("tiemr1");
cMessage *timer2 = new cMessage("tiemr2");

timer1->setSchedulingPriority(1); // lower priority
timer1->setSchedulingPriority(-1); // high priority

send(timer1, Gate);
send(timer2, Gate);