發表文章

目前顯示的是 10月, 2018的文章

[工具] 前端 excel - Handsontable

Ref :  https://handsontable.com/ 最近有需要在網頁上用到類似 excel 的功能 於是使用 Handsontable 這個套件 這個套件有分 CE 跟 Pro 版本 CE也就是 Community Edition, 通常是免費的 Pro 則是有額外強大的功能, 要收費的 這邊就簡單筆記一下我用到的部分 (CE) <!-- 需要一個裝 handsontable 的容器 --> <div id="handsome-table"> <button class="btn btn-success pull-right" id="export-btn">匯出EXCEL</button> 底下是 js 的部分 // 定義好欄位名稱 const COL_HEADER = [ 'Permalink', '觸及', '點擊', '點擊率', '負評', '負評率' ]; let container = document.getElementById('handsome-table'); // 裝 handsontable 的 data array // handsontable 是直接操控 data, 也就是 data-binding // 這個到後面很好用 let data = []; // 定義匯出 handsontable 的按鈕 let $exportBtn = $('#export-btn'); // 初始化 handsontable let hot = new Handsontable(container, { data: data, // 定義資料的 schema, 讓資料不要只是用陣列呈現, 而是物件 dataSchema: { permalink: null, impression: null, click: null, clickRate:

[Linux] Linux 流量監測工具 - iftop

Ref: https://www.tecmint.com/iftop-linux-network-bandwidth-monitoring-tool/ https://www.adamfei.com/iftop-linux-traffic-monitoring-tool-most-comprehensive-iftop-tutorial/ https://blog.gtwang.org/linux/iftop-linux-network-traffic-monitor/ 不得不說 iftop 真的非常好用 安裝 # 在CentOS/RedHat中需要安裝epel-release yum install epel-release yum install iftop apt-get install iftop # 假設系統太老舊無法使用yum/apt安裝的話可以自己編譯 yum install flex byacc libpcap ncurses ncurses-devel libpcap-devel # Debian系列的使用以下 apt-get install flex byacc libpcap0.8 libncurses5 wget http://www.ex-parrot.com/pdw/iftop/download/iftop-0.17.tar.gz tar zxvf iftop-0.17.tar.gz cd iftop-0.17 ./configure make && make install 常用方法: # 把 ip, port 都顯示出來 iftop -P # 指定網卡, 如果一開始使用iftop會跑出 # pcap_open_live That device is not up 這種訊息 # 就可以使用指定網卡這招 iftop -i eth0 TX:發送流量 RX:接收流量 TOTAL:總流量 Cumm:執行 iftop 到目前時間的總流量 peak:流量峰值 rates:分別表示過去 2s 10s 40s 的平均流量 常用的參數 -i 設定監測的網卡,如:# iftop -i eth1 -B 以 bytes 為單位顯示流量(預設是 bits),如:# iftop -