Tom.TH_Lin's blog

sub


  • Home

  • Categories

  • About

  • Archives

  • Tags

mdtable2csv

Posted on 2015-09-21   |   In Tools , tomroy   |  

mdtable2csv

Recently I was trying to find an easy way to convert the tables in md to excel, instead of just copy paste.
After some research, I found that there are so many converters on the internet, but none of them can convert markdown file to excel. So I guess I have to make one on my own. And I was just happen to be learning Python, so I decided to write a Python! I also put it in my GitHub repo.

After lots of search on the internet, I found that GitHub provides a Markdown API that can convert your markdown to html. So I can send my markdown file using json format to github, and it’ll return the html format to me.

After I got the html, I first find all the contents in the <table>...</table> tags, extract the rows in the HTML table from <tr> tag. Then get the Header cells <th> which contains the header information and Standard cells <td> which contains data
separate headers and data by delimiter ,.

最近由於工作上為了一些文件,有可能需要將markdown上面的表格貼到Excel上,但是總覺得用人工不是很可靠,所以想先找找看網路上有沒有人寫好工具可以用。
但是找了半天都只有轉成markdown的,或是把markdown轉成html之類的,並沒有轉成excel可以開的檔案。
剛好最近對Python有點興趣,就想說用Python來做一個吧!我也把我寫好的程式放在我的GitHub repo裡面了。

由於並沒有直接把.md轉成.csv的工具,但是在找的過程中發現GitHub有提供一個 Markdown API 可以讓你把markdown的內容包在json裡面丟上去,他就會把它轉成html的形式,我發現滿適合的就拿來用了。
當拿到html之後,剩下的就是從裡面把 <table>...</table> 標籤裡面的東西找出來,把每一行 <tr> 的標題 <th> 跟內容 <td> 然後用 , 把每個內容分開,輸出成.csv的格式就完成了!

Here are some sample results of my work :

Read more »

Markdown tips

Posted on 2015-09-16   |   In tips   |  

Markdown tips


半形空白(Halfwidth space) = &ensp; 或 &#8194;
全形空白(Fullwidth space) = &emsp; 或 &#8195;
不斷行的空白格(non-breaking space) = &nbsp; 或 &#160;

半形空白(Halfwidth space)

1
2
哈囉!這邊&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;有五個半形空白。
Hello! We have&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;5 halfwidth spaces here.

執行結果如下:

哈囉!這邊     有五個半形空白。
Hello! We have     5 halfwidth spaces here.

Read more »

LeetCode 1 - TwoSum

Posted on 2015-09-15   |   In Algorithm , LeetCode   |  

https://leetcode.com/problems/two-sum/

一、問題描述

Given an array of integers, find two numbers such that they add up to a specific target number.

The function twoSum should return indices of the two numbers such that they add up to the target, where index1 must be less than index2. Please note that your returned answers (both index1 and index2) are not zero-based.

You may assume that each input would have exactly one solution.

Input:numbers={2, 7, 11, 15}, target=9
Output:index1=1, index2=2

Big-O Cheat Sheet

Posted on 2015-09-15   |   In Algorithm   |  

Know The Complexities!

在準備面試的時候通常會花很多時間在網路上到處找各種演算法的best, worst, average case, 才不會在問到的時候掛在那邊,下面這個網站的作者 Eric 佛心來著幫大家準備了 Big-O cheat sheet,感謝他。

Big-O Cheat Sheet

Big-O Complexity Chart

Big-O Complexity Chart

Read more »

使用Hexo在GitHub Pages上架設自己的Blog

Posted on 2015-09-11   |   In Hexo   |  

什麼是 Hexo

簡單介紹一下 Hexo ,引用 Hexo 官方網站上面的一句話

Hexo is a fast, simple and powerful blog framework.
Hexo 是一個快速、簡單且強大的網誌框架。

剩下的大家可以自己點進去 Hexo 看。
作者是台灣人喔,感覺是個肥宅XD
有興趣可以看一下作者對 hexo 的介紹。

什麼是 GitHub Pages

也是引用 GitHub Pages 官方網站上面的一句話

Hosted directly from your GitHub repository. Just edit, push, and your changes are live.
直接把你的網頁放到你的 GitHub repository ,這樣全世界就都看得到你的網頁啦。

GitHub Pages 不止讓可以你放網站,同時還給你一組專屬的URL http://username.github.io,省去了不少申請DNS的麻煩呢,當然如果有自己的DNS也是可以拿來使用的。
設定的方式 GitHub Pages 上寫得圖文並茂、淺顯易懂,就請各位自己點進去看啦。

好,終於進入正題,現在開始一步一步來架我們的Blog吧。

安裝 Hexo

安裝需求
在安裝前您必須先檢查下列您的電腦是否已經安裝下列軟體:

Read more »
123
Tom.TH_Lin

Tom.TH_Lin

11 posts
12 categories
19 tags
LinkedIn GitHub
© 2015 - 2016 Tom.TH_Lin
Powered by Hexo
Theme - NexT.Mist