在阿里云中安装Docker

安装脚本

1
2
3
4
5
6
#Docker
sed -i -r 's/^(up route add \-net 172\..*)$/#\1/' /etc/network/interfaces
ifdown eth0
ifup eth0
curl -sSL https://get.docker.io/ubuntu/ | sh
sudo docker run -i -t ubuntu /bin/bash

说明

Docker 的文档 中说到容器会使用 172.17/16 这个段的 IP 连接外部网络。

从文件 /etc/network/interfaces 中的 up route add -net 172.16.0.0 netmask 255.240.0.0 gw 10.172.223.247 dev eth0 可知,这个段的 IP 已经默认被阿里云的内网网卡 eth0 占用了。

1
2
3
10101100 00010000 00000000 00000000 172. 16. 0. 0 # 网络
11111111 11110000 00000000 00000000 255.240. 0. 0 # 子网掩码
10101100 00011111 11111111 11111111 172. 31.255.255 # 广播地址

因而需要先注释掉占用 172.16/16 这个段 IP 的配置,再安装 Docker。

Chinese Character Problem With 'Javac' and 'Javap' in Mac Shell

To learn the class initialization process of java, I get this article from google. However, when I write the code to a local file and compile it with javac, I get some encoding problem with the output. The same problem happens when I run javap as well.

I can find the solution here and here. This is what I adopt:

1
2
3
4
5
6
JAVA_OPTS="${JAVA_OPTS} -Dfile.encoding=UTF-8"
# JAVA_OPTS="${JAVA_OPTS} -Dclient.encoding.override=UTF-8"
export JAVA_OPTS
JAVA_TOOL_OPTIONS="${JAVA_TOOL_OPTIONS} -Dfile.encoding=UTF-8"
export JAVA_TOOL_OPTIONS

Install Tomcat on Mac Os X

  1. This doc is a modified copy of this one with serveral changes.
  2. The steps here are tested on Mavericks.

This tutorial explains how to install the Apache Tomcat 6.0.x on Mac OS X 10.5 or 10.6. This document is not tested to work with other versions of Tomcat or Java. For complete details, please consult the specific documentation for those software installations.

Read More

从 Markdown 生成 Pdf

BracketsMarkdown 写完简历后,想到需要将 markdown 文件转为其他格式才能作为简历分发出去。这其他格式,就支持程度来说,自然是 PDF 了。于是乎,google 之,大概有两种思路:

  1. 将 markdown 文件直接转化为 PDF,可以使用 pandoc
  2. 将 markdown 文件转化为 HTML ,然后将 HTML 转化为 PDF ,可以使用 markedphantomjs

第一种思路

  • 下载并安装 pandoc for win
  • 下载并安装 MiKTeX for win
  • 安装完后所需工具会自动添加到系统路径中去
  • 下载 这个模板,以支持中文的自动换行等
  • 用文本编辑器(我用的是 Sublime Text 3)打开 pm-template.latex,找到这一行:

Read More