Friday, June 26, 2015

Write Markdown

Write Blog with Markdown

What is markdown

Markdown is a way to write content for the web. It’s written in what nerds like to call “plaintext,” which is exactly the sort of text you’re used to writing and seeing. Plaintext is just the regular alphabet, with a few familiar symbols, like asterisks ( * ) and backticks ( ` ).

Basic Syntax

  • Italic and Bold:

    To make a phrase italic in Markdown, you can surround words with an underscore ( _ ). For example, this word would become italic.

    To make a word bold, we can use to asterisks( ** ). For example, we can make word bold has bold effect.

  • Header

    To make headers in Markdown, you preface the phrase with a hash mark (#). You place the same number of hash marks as the size of the header you want.

  • Link

    Example: to create a hyperlink to www.github.com, with a link text that says, Visit GitHub!, you'd write this in Markdown: Visit GitHub!

    To add an image, we can use ![text](Some link)

  • Quote

    To create a block quote, all you have to do is preface a line with the "greater than" caret (>).

    You can also place a caret character on each line of the quote. This is particularly useful if your quote spans multiple paragraphs.

  • Indent Lists

    Indent each asterisk one space more than the preceding item.(No blank line)

  • Addtional Context after Lists

    Must start with a blank line beforehead!!! (Or two spaces)

  • Hard Break and Soft Break

    Hard break is a blank line where soft break is two spaces after a line of words.

How to use pandoc

  • Use pandoc to read markdown file
    1. install pandoc

    2. make alias

      alias mdless='function _mdless(){ pandoc -s -f markdown -t man $@ | groff -T utf8 -man | less;};_mdless' 
    3. use 'mdless' to read markdown file

    4. use 'pandoc' to convert markdown file to html
      HTML with smart quotes, table of contents, CSS, and custom footer

      pandoc -s -S --toc -c pandoc.css -A footer.html README -o example3.html  

      Here are some examples of pandoc.

TO DO......

Change Color theme for Gnome-terminal

Untitled Document I want to change the terminal theme color because I am so tired of default purple color of Ubuntu. Last time bob said that he used tomorrow color theme. It seems beautiful. So I change my terminal color theme today.
  • First of all, check the gnome-terminal version:
    gnome-terminal --version
    
    I found that my gnome-terminal version is 3.6.2. That is an old terminal version
  • Download tomorrow color theme from github:
    git clone https://github.com/chriskempson/tomorrow-theme.git
    
    And then I put them in the folder '~/Source/' (I put some source files there)
  • Set up editor vim color.
    Copy all files under folder 'vim/colors' to the local ' ~/.vim/colors/'. And then add a line in the '~/.vimrc'
    colorscheme Tomorrow-Night-Eighties
    
    Even though, we still need to add a line in the '~/.bashrc'
    export TERM=xterm-256color
    
  • Set up color of terminal
    Run 'setup.sh' under the folder 'tomorrow-color-theme/Gnome-terminal/' And then choose the 'edit -> profiles' from the menu. Choose default as 'tomorrow' After these settings, the color theme of terminal is 'tomorrow'.
Another beautiful color theme is solarized. Besides, the documents of this color theme is more user friendly. I use this color theme for my mac's iterm. However, I already forgot how did I install this color theme. So I decide write this blog in case I need to set up color theme again.

Tuesday, April 28, 2015

Setting Memo


Dual systems

At first, the department gives us computer with Windows. I shrink disk D and leave 600GB unallocated. This unallocated disk space can be used to install ubuntu. Choose "install alongside windows7" while installing ubuntu. I am so lazy that I didn't choose "others" option. Later on, I may need to learn more about linux system and try to allocate more proper disk space for all kinds of directory. For example, I need larger space for my /usr/local and /home directory.

Network settings

It is very important to set up proxy under linux otherwise you cannot surf the internet.
To set up proxy properly, please refer to this wiki page
Besides, we also need to configure all the IP address for IPV4 connection. Follows are IP configure for my office computer. My computer is PC90087, so my IP is 137.189.90.87
  • Gateway: 137.189.91.254 
  • IP: 137.189.90.87 
  • Subnet mask: 255:255:252:0 
  • DNS server: 
    • Prefer: 137.189.91.188 
    • Alternative: 137.189.91.187 
  • Proxy: http://proxy.cse.cuhk.edu.hk/proxy/cse.pac 
  • Other: Please refer to the wiki page of CSE 

Mount unix home directory

  • Linux: 
    • mkdir ~/UnixFolder
    • sshfs xwchen@linux1:/uac/gds/xwchen ~/UnixFolder
  • My Mac 
    • mkdir ~/UnixFolder
    • sshfs -o sshfs_debug xwchen@gw.cse.cuhk.edu.hk:/uac/gds/xwchen ~/UnixFolder 
  • Windows 
    • Config all the network settings 
    • \smb2\xwchen (Network directory) 

Printer set up

  • Linux: please refer to this article by Qin Liu 
    • sudo apt-get install samba
    • choose the driver HP LJ 4000 PS 
    • Note: we also need to add search domain as "cse.cuhk.edu.hk"
    • If "held authentication", just right click and input user name and password
  • Windows: please refer to our wiki

Dropbox

  • Windows: Download dropbox from official website 
  • Linux: Download dropbox from official website 

Vim

I have not installed many plugins. I think Bob's article is very good and I need to install them later on.
What I have installed?
  • neocomplete, neobundle 
  • trinity, taglist, source explorer, nerdtree, neospinnets 
Many of them can be managed by neobundle, but I do not remember which of them are managed by neobundle...
To use all kinds of plugins, we need to install vim 7.4
  • Install vim7.4
  • sudo apt-get install ctags 
  • Use my old .vimrc file and .vim directory 

Input method

  • Download 汉语 in the language settings; 
  • To use sogou pinyin, we need to install fcitx; 
  • Restart; 
  • Download sogou pinyin from official website; 
  • Install sogou 
  • Set input method in settings center; 
  • Done; 

Email

Use thunderbird mail client, we set up incoming and outcoming server as wiki . I add my cse mail account and two google mail accounts.

SSH remote login from my mac

I spent a lot time trying ssh login. Finally, I found that I need to add some options after ssh command. Since the finger printer of remote host has changed, use this command and the known_hosts file can be updated.

  • ssh xwchen@linux1.cse.cuhk.edu.hk
  • rm .ssh/know_hosts
  • ssh from my mac to gateway then ssh to my office computer

ssh -o UserKnownhostsFile=.ssh/known_hosts - o StrictHostKeyChecking=no pc90087

Install matlab

It is very easy to install MATLAB2014 since all install operations can be finished under GUI. However, I think I need to learn PYTHON later on since MATLAB install package is so huge and cumbersome.
  • Mount matlab iso file on media 
  • Click on install icon 
  • Use crack file to activate matlab 
  • Revise the .bashrc file and add /usr/local/bin to the user path (if you install the matlab in usr/local 

Secure copy file to remote host

Use scp command. For example, if I want to copy file from my mac to my unix home directory, I can use:
scp my_local_file xwchen@gw.cse.cuhk.edu.hk:target_directory

Install latexmk 

  • install texlive-full (if texlive is not full, some packages cannot be found)
  • install latexmk, modify .latexmkrc

Install person wiki

  • Remember backup data/pages
  • After setup, install plugins

What else

Read CSE wiki carefully! Know more about network settings. Organize my personal page.