Monthly Archives: September 2018

find files modified in 1 day

找出最近更動的檔案(1 day),這在清查設定檔或是程式被更動時方便使用的指令 find . -mtime -1 -ls 參考:https://stackoverflow.com/questions/16085958/scripts-find-the-files-have-been-changed-in-last-24-hours

Posted in System Administration | Leave a comment

rootpath module

https://www.npmjs.com/package/rootpath 在vsphere rest sdk sample看到的一個用法,這對於library更動目錄時不需要再改寫require path非常方便,但是須注意webpack使用時,應該用webpack resolve configuration來處理

Posted in nodejs | Leave a comment

git tips

delete a tag locally and remotely git push –delete origin tagNamegit tag -d tagName

Posted in System Administration | Leave a comment

socks5 proxy

SOCKS5 rfc可參考1996年 rfc 1928 (其他: rfc 3089 socks based gateway)須注意socks5本身並未加密,最好是透過ssh port forwarding SOCKS5 proxy設置最簡單的方式 是 putty ssh tunnel ssh -D 1080 user@server 注意port number 1024以下的權限問題(root) -D [bind_address:]port Specifies a local “dynamic” application-level port forwarding. This works by allocating a socket … Continue reading

Posted in System Administration | Leave a comment

callback style與promise的整合

在需要呼叫多次callback時,async await可改善callback hell的現象而nodejs在8.x支援原生的async await,在設計callback api時,可設計成同時支援舊的callback style與新的promise style,這樣一來可以使api同時支援’async’ library與async/await語法 作法1: 作法2: 參考: https://zaiste.net/node_js_functions_simultaneously_supporting_callbacks_promises/ 使用:

Posted in nodejs | Leave a comment

mysql shell clear screen

mysql>system clear system呼叫系統shell執行

Posted in System Administration | Leave a comment