2013年6月25日 星期二

[Software] 文件轉檔工具

好用的文件轉檔工具: Pandoc

常用指令: pandoc -s input.format -o output.format

這邊 format可以是 .tex, .html, .pdf, .doc, ...等等, 相當多, 注意: 這邊的 -s指的是 standalone而非 source

option 選項:

  • 可下 -m做數學轉換, 還有 --webtex或 --mathjax等可轉換, 但注意, 主要以 $...$排版, \begin{equation} 等環境並無法使用
  • --toc: table of content, 產生目錄 
  • -A: 加入內容於後, e.g. pandoc -s input.txt -A sample.html -o output.html, 則程式會將 input.txt轉成 html格式, 並在檔案後頭加入 sample.html的內容
  • -B: 加入內容於前
  • -c ./sample.css: 可加入 css的排版樣式

2013年6月10日 星期一

[Shell] string process

Ref: http://www.thegeekstuff.com/2010/07/bash-string-manipulation/

2013年6月5日 星期三

[Vim] Mac中 Vim 設定


  • 預設路徑
    • binary: /usr/bin
      support file: /usr/share/vim/vim73
      rc: ~/.vim/vimrc (若沒有, 請自己建)
  • 細節

    • 單一檔案的 plugin 應放在 ~/.vim/plugin下, e.g. a.vim
    • 其他 plugin一句底下的資料夾放置(例如: ctrlp)
      • ~/.vim/autoload/ctrlp/
      • ~/.vim/autoload/ctrlp/ctrlp.vim
      • ~/.vim/doc/ctrlp.txt
      • ~/.vim/plugin/ctrlp.vim
    • plugins/colorschemes/scripts 放在 ~/.vim下, not /usr/share/vim/vim73
  • 推薦 plugins:
    • a.vim: 在 header與 source file間切換
      • :A =>切換
      • :AT =>切換至新開的 tag page
      • :AS => split? 垂直分割
      • :AV => horizontal 分割
      • 不知為啥, 我覺得 :AS與 :AV 沒作用
  • Ref:

[Vim] vim 快攻


  • 重要參數
    • 可單獨操作
      • b  before
      • e  end
      • w  word
      • $  行末
      • 0  行頭
    • g global
    • c confirm
    • ! 強制
  • 移動
    • hjkl  分別是左下上右, 應該主要是右手食指上中指下
    • gg  檔案起始處
    • #shift-G  #代表行號, 沒輸入則是到檔案最後一行  
  • 檔案操作
    • :q     quit
    • :wq  write & quit
  • 文件編輯
    • i  insert
    • x  ...這不知道是啥
    • a  append, A  可在行末 append
    • d  delete, 可搭配參數, e.g: dw, d$, d0
    • p  paste
    • u  undo, U: 還原整行, ctrl-R為還原先前操作
    • o  open new line
    • %  找到配對的括號
    • dd 刪除行
  • 搜尋與取代類
    • /   向下搜尋, 找到後用 n跳至下一個, shift-N至上一個
    • ?  向上搜尋
    • 環境可設定 :set hls  highlight search, 便會有如 source Insight中 F8的功能啦, 要讓它消失則下 :noh   noHightLight
    • r   replace 單一字元
    • R  是同進入取代模式
    • c  change, 搭配參數用, e.g. cw: change word, 會取代掉 cursor所在的 word
    • :s  strike, 應該會是最常用的功能
      • s/old/new/g  將 old用 new取代, 若後面加 /g則為 global
      • s/old/new/gc  c是 confirm用
      • #,#s/old/new/gc  #是行號, 代表在這兩行之間的取代動作
  • 執行外部指令
    • :!script, script為 shell script, e.g. :!ls, 但有些動作還是不能操作, 剛試驗了一下, :!cd ~/Desktop, 再執行 :!pwd, 似乎並沒改變
    • :r fileName, 可將檔案 fileName的內容貼到目前 cursor處
  • 外掛類
    • a.vim
      • :a  switch between header/source code
    • ctag
    • auto complete
      • Ctrl-N

2013年6月1日 星期六

[Linux] GRUB2 開機順序

  • cd /etc/grub.d/ (開機順序存放在此資料夾, 以 prefix數字小到大的順序開機, 預設 linux為 10_linux, 優於 30_os-proper的 windows作業系統, 因此, 執行以下兩步驟, done!)
    • 30_os-proper 更名為 08_os-proper (mv ./30_os-proper ./08_os-proper)
    • sudo update-grub