Friday, July 21, 2017

作業系統和瀏覽器的 dns cache

公司做的 SAS 服務常常在更改 dns 對應的 ip ,所以我的 chrome 也常常會出現 dns 的錯誤。還是把常用的指令記錄下來好了:

# 重新整理 windows 7 的 dns cache (需要用系統管理員身分啟動 console)
net stop dnscache
net start dnscache

# 重新整理 chrome 的 dns cache
chrome://net-internals/#dns

# 重新整理 linux 下的 dns cache
service nscd reload

Friday, July 14, 2017

clojure vim 開發環境設置 --- vim-sexp

vim-sexp 是我最晚發現的好用的 plugin 。而且是一旦使用習慣,就覺得不可或缺。

安裝方式:
cd ~/.vim/bundle
# vim-sexp will maintain the balanced state of matched character
git clone git://github.com/tpope/vim-sexp-mappings-for-regular-people.git
git clone git://github.com/guns/vim-sexp.git
git clone git://github.com/tpope/vim-repeat.git
git clone git://github.com/tpope/vim-surround.git

會需要一口氣裝好幾個,是因為要裝了另外三個,有簡單易懂的 mapping 快捷鍵之後,才會容易上手。

Text object 選擇功能:
ae -> an element              dae   刪除所見的 element
af  -> a   form                   daf   刪除所見的 form

移動功能:
W     向前移動一個 sexp
B      向後移動一個 sexp 

其它功能:
dsf         delete surrounding form                  刪去包圍 form 的括號
cseb       surround element in parentheses     新增包圍 element 的括號
cse[       surround element in brackets
cse{       surround element in braces
>e    在同一階層的 s-expression 裡右移 element              (1 2 3)       =>   (1 3 2)
>)     slurp , 讓 s-expression 吃掉右邊外面的 element   (1 2 3) 4   =>   (1 2 3 4)
<)     barf    ,   讓 s-expression 吐出右邊外面的 element   (1 2 3 4)   =>  (1 2 3) 4