Commit bec1f763 authored by whzecomjm's avatar whzecomjm
Browse files

add software notes

parent 7bb473fb
Loading
Loading
Loading
Loading

Git.md

0 → 100644
+76 −0
Original line number Diff line number Diff line
Git学习笔记
===

git是一个分布式版本控制软件,最初由林纳斯·托瓦兹(Linus Torvalds)创作,于2005年以GPL发布。最初目的是为更好地管理Linux内核开发而设计。

git最初的开发动力来自于BitKeeper和Monotone。git最初只是作为一个可以被其他前端包装的后端而开发的,但后来git内核已经成熟到可以独立地用作版本控制。很多著名的软件都使用git进行版本控制,其中包括Linux内核、X.Org服务器和OLPC内核等项目的开发流程。

常见的Git托管平台有:

- [Github](https://github.com)
- [Gitcafe](https://gitcafe.com/) (GitCafe 已加入 CODING)
- [Bitbucket](https://bitbucket.org/)
- [Git@OSC](http://git.oschina.net/)
- [Coding](https://coding.net/)


## Git 配置方法

Windows下有现成的Git for Windows,配置比较简单,详情参见参考文献 [Git for Windows 配置](http://www.cnblogs.com/monodin/p/3268679.html)。下面介绍Linux下的[git的相关配置](https://github.com/chenzhiwei/linux/tree/master/git)**不使用root终端**):

1. 下载Git,`sudo apt-get install git`(Ubuntu自带)
2. 配置Git config 作者信息。
3. 配置SSH:详见[Github 官方帮助](https://help.github.com/articles/generating-ssh-keys/)
4. 开始工作:先检查ssh通道可用(Gitcafe,Github必须检查`ssh -T`)。
5. 开发:获取到源码之后,就可以进行开发,修改完文件以后,
	```
	git add .  //往暂存区域添加已添加和修改的文件,不处理删除的文件
	git commit -m "commit directions" //提交代码,并添加提交说明
	git push
	```

## Git Gui 查看分支历史中文乱码解决

1. 在Git Gui工具栏上选择-编辑-选项。
2. 选择:Default File Contents Encoding, 改为`UTF-8`

## Git warning: LF will be replaced by CRLF

    git config --global core.autocrlf  false

## Github Pages 自定义网站绑定子域名

1.`usename.github.io`绑定**顶级域名**
2. 创建一个项目repo及gh-pages分支。
3. 在 repo 的 gh-pages 分支用cname文件绑定子域名。
4. 在 DNSPod 等域名解析管理中添加cname记录。

## 同时使用 GitHub 和 GitCafe 托管博客

因为 GitHub 和 GitCafe 的 Pages 使用不同的分支,所以无法在 remote 里添加两个 url(如果分支相同可以通过执行如 `git push all gh-pages` 同时 push。具体参见[链接](http://liberize.me/tech/host-your-blog-on-both-github-and-gitcafe.html)),可以在 .git/config 中添加一个 alias 来实现:

    [alias]
    publish = !sh -c \"git push github master && git push gitcafe master:gh-pages\"

当需要 push 的时候,只需执行 `git publish` 就可以了。

## Git 生成变更历史文件

一些项目要求生成变更日志changelog,通过键入<sup>[1]</sup>

    git log > ChangeLog

## 利用Dropbox或者Google Drive建立私人仓库

    cd /Dropbox/repo.git
    git init --bare
    cd ~/local_repository
    git remote add origin ~/Dropbox/repo.git
    git add .
    git commit -a -m "init repo."
    git push origin master

## 参考文献及其它内容
1. [Git 魔法(教程)](http://www-cs-students.stanford.edu/~blynn/gitmagic/intl/zh_cn/ch02.html)
2. [Git 命令大全](https://gist.github.com/whzecomjm/d8aff13611b81076419d)
3. [Astral: 整理Starred项目](https://app.astralapp.com/dashboard)
+43 −0
Original line number Diff line number Diff line
LaTeX 简单英文模板
===

我用的模板,这里只是备份一下。

```
\documentclass{article}
\title{Notes on Aperiodic Oderer}
\author{whzecomjm}
\usepackage{amsmath,amsfonts,amsthm}
\usepackage[colorlinks=true,urlcolor=blue]{hyperref}

\theoremstyle{plain}
\newtheorem{thm}{Theorem}[section]
\newtheorem{lem}[thm]{Lemma}
\newtheorem{prop}[thm]{Proposition}
\newtheorem*{cor}{Corollary}

\theoremstyle{definition}
\newtheorem{defn}{Definition}[section]
\newtheorem{conj}{Conjecture}[section]
\newtheorem{exmp}{Example}[section]

\theoremstyle{remark}
\newtheorem*{rem}{Remark}
\newtheorem*{note}{Note}

\newcommand{\R}{\mathbb R}
\newcommand{\C}{\mathbb C}
\newcommand{\N}{\mathbb N}
\newcommand{\Q}{\mathbb Q}
\newcommand{\Z}{\mathbb Z}
\newcommand{\cA}{\mathcal A}
\newcommand{\tuple}[1]{\langle #1 \rangle}
\begin{document}

\maketitle

\begin{thebibliography}{99}
\bibitem{solo1} B. Solomyak, \href{http://u.math.biu.ac.il/~solomyb/GRAD/14/Aper/Aperiodic.docx}{Mathematics of Aperiodic Order}, 2015.
\end{thebibliography}
\end{document}
```
 No newline at end of file

latex/latexnotes.md

0 → 100644
+57 −0
Original line number Diff line number Diff line
Latex 学习笔记
===

## [数学符号表](https://www.dropbox.com/s/vqzjd7slebrvt0r/maths-symbols.pdf?raw=1)

## 宏包的使用

*  使用 `\usepackage{CJKutf8}` 支持中文;
*  加载宏包 amscd 可以输入交换图。[用法](http://www.jmilne.org/not/Mamscd.pdf)
*`\tableofcontents` 生成目录,如果目录要带链接的话:`\usepackage{hyperref}`[详情](http://hi.baidu.com/thinks_thinkin/item/2e3cf7384b275bc8392ffaf5)
*  `\usepackage{enumerate}`,可以在变成 `\begin{enumerate}[A.]`使得编号为 A. B. C.等,而不是1,2,3。
*   `\mathscr`是花体字,不过要先加入宏包{mathrsfs}


## 公式环境
*  `boxed{ }`可以加一个边框。放在`begin{\equation}``end{\equation}`之间。
*  subequation可以使得编号不变两(多)个公式区分,实际加入了a。进一步我们可以记录。
*`\begin{document}`后面加入`\numberwithin{equation}{section}`可以让公式按照小节来编号。

## 定理环境
*   定理环境:usepackage{amsthm} 。定理的替代表示  `\newtheorem{thm}{Theorem}``\newtheorem{defn}{Definition}`  (还有Remark和Note),之后就会有`\begin{thm}  & \end{thm}`。如输入`\newtheorem{thm}{Theorem}[chapter]`就可以改变命名。或者是`[section]`。如果是不编号,则newtheorem后加上* 即`\newtheorem*`。
*  `newcommand{new command}{old command}`,原来的命令也是可以用的。
*  证明环境{proof},环境里自带`\qed`
*  newcommand是对旧的指令重新命名,而renewcommand则是更新指令,是指重命名内部。


## 空格
- `\, \> \;` 能给出空格,其中`\;`空格更大;
- `\phantom{}`插入一个括号内宽度的空格,相当于键入一个不可见、但是仍然占字符位置的符号;

## 写书
*  book形式下可以用 `\mainmatter` 重新定义页码。
*   `\mathop{}` 是把括号里的内容作为数学运算符。
*   去掉book的单双页规定用`[openany]{book}`
- `\imath,\jmath` 给出没有头部一点的 i,j,即 $\imath,\jmath$;

## 其它使用技巧
*  插图 `\begin{figure}[thispage]`,thispage是一个很好的参数,可以很好地控制图片位置。

## 箭头汇总

[access2science 整理了一个十分全面的表](http://www.access2science.com/latex/Arrows.html),几乎应有尽有,但是即便如此,我还是找到了一些未在列表中的箭头,现增补如下:

| Latex 代码 |	符号 |	描述|
|:-------------|:----:|:----------------|
|\gets|	←	| 左箭头 | 
|\to	| → |	右箭头 | 
|\iff|$\iff$|	当且仅当|
|\mapsto	|$\mapsto$	|元素映射箭头|
|\dashleftarrow|$\dashleftarrow$| 虚线向左箭头|
|\dashrightarrow|$\dashrightarrow$| 虚线向右箭头|
|\Lsh|$\Lsh$| 左转弯箭头(向上转)|
|\Rsh|$\Rsh$| 右转弯箭头(向上转)|
|\curvearrowleft|$\curvearrowleft$|从左边掉头箭头|
|\curvearrowright|$\curvearrowright$|从右边掉头箭头|
|\circlearrowleft|$\circlearrowleft$|逆时针箭头|
|\circlearrowright|$\circlearrowright$|顺时针箭头|

latex/mathjax.md

0 → 100644
+27 −0
Original line number Diff line number Diff line
Mathjax 配置方法
===

正如 [MathJax 官网](http://docs.mathjax.org/en/latest/configuration.html#loading-and-configuring-mathjax)给出来的方法一样,我们可以选择用其自带的 CDN 在线加载共式。实际上对于一般虚拟空间来说,这种方式反而比在自己空间安装来得更快。
 
具体的操作很简单,只需要在主题文件 header.php 的 </head> 之前(当然也可以只加在 post.php 内)加入如下代码调用代码。下面这个代码是加载 TEX 和 LaTeX 而不考虑 MathML的做法。接下来就是自定义如单个`$`符号表示公式一些配置代码了,如下:
   
    <script type="text/x-mathjax-config">
          MathJax.Hub.Config({
            extensions: ["tex2jax.js"],
            jax: ["input/TeX", "output/HTML-CSS"],
            tex2jax: {
              inlineMath: [ ['$','$'], ["\\(","\\)"] ],
              displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
              processEscapes: true
            },
            "HTML-CSS": { availableFonts: ["TeX"] , scale: 90}
          });
    </script>
    <script 
    type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML">
    </script>

上述代码中 output 模式可以改为其他比如 SVG 等等。当然还有更多设置,比如从 2.5 版本之后,还可以设置 Fast-Preview。

whzecomjm  
2014-6-25
 No newline at end of file

latex/pandoc.md

0 → 100644
+97 −0
Original line number Diff line number Diff line
# Pandoc

[toc]

[Pandoc](http://pandoc.org/)是文本格式转换的“瑞士军刀”,它可以让很多文档源文件之间转换。现在我用 Markdown 已经十分熟练了,具体的 Markdown 语言的介绍见先前的一篇[Markdown简介](soft:latex:markdown)。下面分两个部分讲一讲 Pandoc,第一部分是 Pandoc 的使用,第二是 Pandoc's Markdown 的一些新的书写规则。

## Pandoc的使用

先讲Pandoc的使用,首先安装完Pandoc以后需要配置系统路径, `.\Local\Pandoc`,照理来说安装程序是应该会把这个目录添加到Path中去的,但是并不能保证自动添加,因此有时候要将这个目录手动加入到Path中,这样才能在任何的目录下进行调用。

### 生成HTML文件

使用 Pandoc 最主要的功能就是利用它来生成 HTML 和 PDF 文件,用 markdown 文件生成 html 文件,是Pandoc最基本的一个功能,使用起来也是非常简单的。 pandoc 支持加入 css 一起渲染,可以用如下的命令得到带有 css 的 HTML 文件:

    pandoc in.md -c style.css out.html


### 生成PDF文件

同样,在安装了 latex 以后,就可以将 markdown 文件转化为 pdf 了,最简单的方式也是(此处用 xelatex 时个人喜好,并且生成的 pdf 比默认的 pdflatex 要小,看起来要好)。当然,要对中文支持的话,就需要用模板来解决了,在编译的过程中可以加入模板文件。

    pandoc in.md -o out.pdf --latex-engine=xelatex
    pandoc in.md -o out.pdf --latex-engine=xelatex --template=template.latex

这时就能生成一个比较完美的 pdf 文件了。模板文件可以放在需要编译的 Markdown 文件夹内,也可以放在系统默认文件夹 `/AppData/local/pandoc/templates/`。需要注意的是,该文件夹默认并不存在,需要自己创建 `pandoc``templates` 文件夹。下面介绍两种简单的调用方式。

#### 用bat文件调用
有两种简单的方式可以快速调用 Pandoc。一是新建一个文件夹比如在桌面创建`pandoc`用于转换,文件夹内写类似这样如下的一个`.bat`文件,之后每次调用时直接运行 bat 文件即可:   

    @echo off
    d:
    cd \desktop\pandoc
    pandoc -f markdown in.md -o out.pdf --template=template.tex --latex-engine=xelatex --variable fontsize=12pt
    out.pdf

#### 用Notepad自带运行调用
上述方法比较笨拙,如果需要换目录或者文件名的话都要修改文件(夹)名,比较麻烦。由于我常用 Notepad++,可以使用其自带的运行功能,在运行中保存如下代码,并且存为快捷键,使用起来会很方便。更多内容参见[Notepad++ 常用运行脚本](soft:notepad-scripts)

### 编译电子书

首先新建一个`title.txt`的文件,文件内容模板如下:

    ---
    title:  "我的文章"
    author:  whzecomjm
    rights:  Creative Commons Non-Commercial Share Alike 3.0
    language:  "zh-Hant-CN"
    ---

其它章节用markdown文件书写即可,编译时用下列代码即可生成epub电子书。同样我的日记之前也是用pandoc编译的,基本和上述方法相同:

    pandoc -S -o articles.epub title.txt high-school.md mails.md
    pandoc -S -o diary.pdf title.txt 2012.md 2013.md 2014.md 2015.md --template=template.tex --latex-engine=xelatex


## Pandoc中的Markdown语法 

如果你需要强制**换行**,在行尾放上两个以上的空白字元即可。一个反斜线后跟著一个换行字元,同样也有强制换行的效果。原始 markdown 语法在标题之前并不需要预留空白行。Pandoc 则需要(除非标题位於文件最开始的地方)。这是因為以`#`符号开头的情况在一般文字段落中相当常见。

除了标准的缩进代码区块外,Pandoc 也支持了围栏 (fenced) 代码区块的语法。这区块需以包含三个以上波浪线或反引号的一行作为开始.

### 文件标题区块

    % title
    % author(s) (separated by semicolons)
    % date
    # 标题可以包含多行文字,但接续行必须以空白字元开头
    % My title
      on multiple lines   

### 脚注和行内注释
Pandoc’s markdown 支持脚注功能,使用以下的语法:

    Here is a footnote reference.[^1]
    [^1]: Here is the footnote.
    #Pandoc 也支援了行内脚注:
    Here is an inline note.^[Inlines notes are easier to write.]

### 定义
这和 php-markdown-extra 一样,如下例子:

    Apple
    :   Pomaceous fruit of plants of the genus Malus in the family Rosaceae.

### 图片的问题
只要图片显示的名字**不是文件名**(带.png的全名),插入以后会自动有居中,并且显示名字:`Figure 1. XX`。 如果不想显示的话,只需要将 `![XX][1]` 内的 `XX` 改为文件名或者留空即可。在 Typecho,smark 中则自动不显示图片名称,并且需要添加 `<center>` 方可居中。

另,图片地址不能含有中文,否则无法编译,但是markdown文件本身支持中文地址。

### 多行公式的使用
Pandoc 可以在一个**独立段**直接插入 `\begin{eqnarray}` 等环境,也可以在 `$$TeX$$` 内插入 `\begin{aligned}` 来解决。 注意对其的符号前面加入 `&` ,这比 Latex 前后都要加入 `&` 更方便。

## 参考文章
- [神器Pandoc的安装与使用](http://zhouyichu.com/misc/Pandoc.html)
- [Pandoc's markdown(翻译版)](http://pages.tzengyuxio.me/pandoc/)
- [php Markdown Extra](https://michelf.ca/projects/php-markdown/extra/)
- [搭建Pandoc+Markdown写作环境](http://www.annhe.net/article-3145.html)
 No newline at end of file
Loading