$ minicom -s或進入 minicom 後按 Alt-a o 開啟選單
選擇 Serial port setup 設定 console
Serial Device : /dev/ttyUSB1 Bps/Par/Bits : 115200 8N1 Hardware Flow Control : No Software Flow Control : No選擇 Screen and keyboard 設定自動斷行
Line Wrap : Yes
$ minicom -s或進入 minicom 後按 Alt-a o 開啟選單
Serial Device : /dev/ttyUSB1 Bps/Par/Bits : 115200 8N1 Hardware Flow Control : No Software Flow Control : No選擇 Screen and keyboard 設定自動斷行
Line Wrap : Yes
... "require": { "laravel/framework": "4.2.*", "zizaco/confide": "dev-username-optional", },執行
$ composer update
$ composer create-project laravel/laravel=4.2 foo --prefer-dist建立 Laravel 4 的最後版本
$ composer create-project laravel/laravel foo ~4.0 --prefer-dist
$ pip install jieba安裝正體中文的擴充套件
$ git clone https://github.com/enhao/sphinx.ext.search.zh_TW.git _extension修改專案目錄下的 conf.py
# If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. sys.path.insert(0, os.path.abspath('_extension')) ... # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = ['search-zh_TW'] ... # Language to be used for generating the HTML full-text search index. # Sphinx supports the following languages: # 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja' # 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr' html_search_language = 'zh_TW' # A dictionary with options for the search language support, empty by default. # Now only 'ja' uses this config value html_search_options = {'dict': '_extension/dict/zh.dict'}sphinx.ext.search.zh_TW 的字典檔是用結巴中文分詞的 dict.txt.big ,不設定 html_search_options 的話,會使用結巴中文分詞的預設字典
會顯示為...
#include <stdio.h> int main(void) { printf("hello, world\n"); return 0; }如果不要顯示行號
常用的程式語言...
Brush name | Brush aliases |
---|---|
Bash/shell | bash, shell |
C++ | cpp, c |
CSS | css |
Diff | diff, patch |
JavaScript | js, jscript, javascript |
Java | java |
Perl | perl, pl |
PHP | php |
Plain Text | plain, text |
Python | py, python |
Ruby | rails, ror, ruby |
Scala | scala |
SQL | sql |
XML | xml, xhtml, xslt, html, xhtml |
#include <errno.h> /* errno */ #include <arpa/inet.h> /* htonl */ #include <netinet/in.h> /* in_addr_t */ /** * @param start start IP adress in host byte order * @param end end IP address in host byte order * @param addr_cb callback * @param data callback argument. * @return If failed, between_addr() returns -1. Otherwise, retrun a value from callback */ int between_addr(uint32_t start, uint32_t end, int (*addr_cb)(in_add_t, const void *), void *data) { int ret = -1; uint32_t addr, limit; if (!addr_cb) { errno = EINVAL; return ret; } addr = start < end ? start : end; limit = start > end ? end : start; for (; addr < limit; addr++) { ret = addr_cb(htonl(addr), data); if (!ret) break; } return ret; }
... # Language to be used for generating the HTML full-text search index. # Sphinx supports the following languages: # 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja' # 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr' html_search_language = 'ja' # A dictionary with options for the search language support, empty by default. # Now only 'ja' uses this config value html_search_options = {'type': 'default'}
$ make html $ ls _build doctrees html而在 _build 下會產生快取的目錄 doctrees
$ sphinx-build -d _build/doctrees . /usr/local/nginx/html其中 -d 是指定快取的目錄,/usr/local/nginx/html 是匯出的目錄
... language = 'zh_TW' ... latex_elements = { # The paper size ('letterpaper' or 'a4paper'). 'papersize': 'a4paper', # The font size ('10pt', '11pt' or '12pt'). #'pointsize': '10pt', 'classoptions': ',english', 'inputenc': '', 'utf8extra': '', # Additional stuff for the LaTeX preamble. 'preamble': ''' \usepackage{xeCJK} \setCJKmainfont[BoldFont=Heiti TC, ItalicFont=STKaiti]{Heiti TC} % 設定中日韓字型 \setCJKmonofont[Scale=0.8]{Courier New} % 設定中日韓等寬字型 \XeTeXlinebreaklocale "zh" % 設定斷行演算法為中文 \XeTeXlinebreakskip = 0pt plus 1pt % 設定中文字距與英文字距 ''', # Latex figure (float) alignment #'figure_align': 'htbp', }字型可以參考網頁中英文字型(font-family)跨平台設定最佳化或檢視系統已安裝的字型
$fc-list :lang=zh-tw匯出 PDF
$ make latex $ cd _build/latex $ xelatex *.tex
#include <netinet/in.h> /* in_addr_t */ in_addr_t calc_network(in_addr_t addr, in_addr_t netmask) { return addr & netmask; }計算 broadcast
#include <netinet/in.h> /* in_addr_t */ in_addr_t calc_broadcast(in_addr_t addr, in_addr_t netmask) { return addr | ~netmask; }
$ pip install sphinx_rtd_theme修改專案目錄下的 conf.py
import sphinx_rtd_theme ... html_theme = "sphinx_rtd_theme" html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
$ pip install sphinx_bootstrap_theme修改專案目錄下的 conf.py
import sphinx_bootstrap_theme ... html_theme = "sphinx_bootstrap_theme" html_theme_path = [sphinx_bootstrap_theme.get_html_theme_path()]
$ pip install solar-theme修改專案目錄下的 conf.py
import solar ... html_theme = "solar" html_theme_path = [solar.get_html_theme_path()]
$ pip install sphinx指定專案名稱、作者、版本,使用 EPUB 來建立文件專案
$ sphinx-quickstart -q -p example -a author -v 1.0.0 --epub docs或以互動的方式,回答問題來建立
$ sphinx-quickstart docs建完會產生一個專案目錄
$ tree docs docs ├── Makefile ├── _build ├── _static ├── _templates ├── conf.py ├── index.rst └── make.bat 3 directories, 4 files直接編輯 index.rst 就可以開始撰寫文件了,語法可以參考 A ReStructuredText Primer
$ make html $ make singlehtml $ make epub $ make latexpdf分別匯出 HTML、EPUB 和 PDF 在 _build 目錄底下,匯出 PDF 要先安裝 MacTeX
$ ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl ~/bin/subl localhost$ subl
$ pip install virtualenv建立 Python 虛擬環境
$ virtualenv ENV可以加 --python 指定版本
$ virtualenv --python=python2.7 ENV或加 --no-site-packages 不依賴系統已安裝的 Python 套件
$ virtualenv --no-site-packages ENV其中 ENV 是放虛擬環境的目錄,刪除目錄就可以移除虛擬環境。
$ source ENV/bin/activate離開虛擬環境
(ENV)$ deactivate撰寫 script 也可以指定虛擬環境
#!/path/to/ENV/bin/python ...參考