boost 学习笔记 0: 安装环境

这篇文章讲如何安装 boost 库,最完整的教程永远在官网。以下内容部分翻译自官方文档。

首先来看一看在Linux下安装 boost 库。

Ubuntu/Debian/Linux Mint 安装boost


sudo apt-get install libboost-all-dev

然后输入密码,安装,安装完之后目录在 /usr/include/boost 下。


Eclipse或者其他IDE中使用 boost 时,需要以下几步,引入头文件,添加库。

C/C++ Build, Cross G++ Linker,Libraries, 添加相应Libraries(-l),并添加相应Library search path(-L) /usr/include

boost config


Max 下安装 boost 最简单的方式,就是用 brew:

brew install boost



  1. 下载 boost_1_60_0.tar.bz2
  2. 解压 tar –bzip2 -xf /path/to/boost_1_60_0.tar.bz2
  3. 一部分组件(Header-Only Libraries)在完成1和2以后就能直接用,因为是直接写在hpp的inline函数,但是要利用其它功能,需要build boost库里面的各个组件(步骤4-6)

    需要单独编译的库有: - Boost.Chrono - Boost.Context - Boost.Filesystem - Boost.GraphParallel - Boost.IOStreams - Boost.Locale - Boost.MPI - Boost.ProgramOptions - Boost.Python (see the Boost.Python build documentation before building and installing it) - Boost.Regex - Boost.Serialization - Boost.Signals - Boost.System - Boost.Thread - Boost.Timer - Boost.Wave

  4. 进入解压后的目录 cd path/to/boost_1_60_0
  5. 输入./ 开始配置,添加 --prefix 选择安装地址 ./ –prefix=path/to/installation/prefix
  6. 输入 ./b2 install 开始安装

备注:如果第5步直接输入./ 则默认会安装到/usr/local下面的include和lib目录下,而/usr是在Macintosh HD下面的一个隐藏目录,到此boost就安装到了电脑上,可以使用它进行编程了。

Mac下默认安装地址是在 /usr/local/include/usr/local/lib 下,因此在配置环境的时候需要注意将boost地址写入。



  1. 用xcode创建控制台应用程序,在项目设置->build Settings->Search Paths->Header Search Paths和Library Search Paths里面分别添加上述默认安装地址 /usr/local/include//usr/local/lib 目录
  2. 在项目设置->build Phases->Link Library With Libraries里面点加号,选择option,找到上述lib目录,选中里面以.a 或者 .dylib 结尾的文件,添加即可


其他操作系统请参考以上 YouTube Playlist,我收集整理了一些基本够用了。

2015-12-20 boost , C++



Change password

The first thing you login into your VPS using root is to change your root password your VPS provider gave. Run the passwd to change your root password.

After you run this command, your terminal will prompt you to input new password. So just type your new password twice. Linux will check your new password to prevent simple password or short password. So don’t use any exist words or any password only contains number.

Create a new User

One of the most important security thing is try your best not to login to your VPS using root account. A better way is to create a new user account and do anything you like as this new user.

Following command is to create a new user and set a password for this user. Please replace einverne as your own name.

# create a new user called einverne
adduser einverne
# set password for user einverne
passwd einverne

After you create a new user account successfully, we give the new user root privileges. Someone may be curious about why we create a new user and grant root privileges, so why don’t we just use root account. There are two points. One is that this can prevent user making system-destroying mistakes, second is that all command run by sudo will have a record in /var/log/secure which can be reviewed later if needed.

Run visudo command to enter sudo config file. Find a section called user privilege specification. And add a new line under this section like this:

# User privilege specification
root    ALL=(ALL)       ALL
# new add
einverne	ALL=(ALL)	ALL

ssh configuration

Now it’s time to make the server more secure. You can set the ssh configuration to permit root login. But before doing this config, please make sure to have a new account have the root privileges.

Edit ssh config file:

 sudo vim /etc/ssh/sshd_config

Then change follow line:

Port 22
PermitRootLogin no

Port means the ssh port you can connect, you can set any number between 1025 and 65535. PermitRootLogin means you can disallow root login, if you set to no.

Finally, add AllowUsers einverne at the bottom of the sshd_config file.

Then reload the config file to make ssh work.

service ssh reload

To test the new ssh config, do not logout of root. Open a new terminal and login with your new account like:

ssh -p port einverne@server.address


After you set up server ssh, you can generate SSH key at local computer and use SSH key to connect to server rather than using password. Generating a key at local computer:


follow the instruction of this command, for example you name it vps , just enter to skip password of key, and you will get two files under ~/.ssh/, vps is your private key, keep it safe. And is the public key. And Now use ssh-copy-id to copy public key to server.

ssh-copy-id user@server.address

Then type the password. And it will be the last time to type your password to connect to server. If your computer don’t have the command ssh-copy-id, you have to copy the public key to server ~/.ssh/authorized_keys manually.

scp ~/.ssh/ user@server:~/.ssh/

Then copy the file content to authorized_keys file.

cat >> authorized_keys

Finally to check the permission of the folder .ssh and file authorized_keys

drwx------ 2 einverne einverne       4096 Apr 19 21:25 .ssh
-rw------- 1 einverne einverne  744 Apr 19 21:14 authorized_keys

and if not:

chmod 700 ~/.ssh/
chmod 600 authorized_keys

setup alias

Add alias to .bashrc or .zshrc file.

alias vps = "ssh username@server -p port"

Then next time, you can just type vps to connect to server.

ssh config

There are two config file to setup ssh. One is system wide configuration file which can be found /etc/ssh/ssh_config. And another is per-user configuration file which is located under user home directory ~/.ssh/config. Most time we only care about user config.

Try to set up:

Host ds #this can be anything just a alias
	HostName server
	Port 22
	User username

Then we can use ssh ds to connect to server. If you have multi config just add to following like:

Host ds
	HostName server
	Port 22
	User einverne

Host github
	Port 22
	User einverne
	IdentityFile ~/.ssh/private_key_name

After all this, you can type following command to have a try:

scp filename ds:~/filename   # copy file to server
ssh ds "ls ~" 		# list server files

setup hostname

hostnamectl set-hostname example_hostname

setup timezone

dpkg-reconfigure tzdata

Test VPS

Processor test

There are a serveral things need to check. The first thing is to test CPU, menory and hard drive.

cat /proc/cpuinfo
cat /proc/meminfo
df -lh

Network test

You can use this solution to solve the problem. Or there are some download test file.

Install speedtest package:

pip install speedtest-cli


easy_install speedtest-cli


$ speedtest-cli -h
usage: speedtest-cli [-h] [--bytes] [--share] [--simple] [--list]
                     [--server SERVER] [--mini MINI] [--source SOURCE]
                     [--timeout TIMEOUT] [--secure] [--version]

Command line interface for testing internet bandwidth using

optional arguments:
  -h, --help         show this help message and exit
  --bytes            Display values in bytes instead of bits. Does not affect
                     the image generated by --share
  --share            Generate and provide a URL to the share
                     results image
  --simple           Suppress verbose output, only show basic information
  --list             Display a list of servers sorted by
  --server SERVER    Specify a server ID to test against
  --mini MINI        URL of the Speedtest Mini server
  --source SOURCE    Source IP address to bind to
  --timeout TIMEOUT  HTTP timeout in seconds. Default 10
  --secure           Use HTTPS instead of HTTP when communicating with
            operated servers
  --version          Show the version number and exit


description: VPS的网络性能,主要分出口和入口二个指标,入口可以用wget文件得到。 看下载速度,如果是11M/s,大概就是百兆口,70M/S,大概就是G口。 您的VPS搭建好网站环境后,可以用其它的VPS去拽这个文件,得到出口的带宽。

Directspace机房/10M.100M测试包 Portland


I/O test

The speed of read and write of your hard drive.

dd if=/dev/zero of=test bs=64k count=4k oflag=dsync
dd if=/dev/zero of=test bs=8k count=256k conv=fdatasync


sock5 proxy.

  • first install pip

      yum update && yum install python-setuptools
      easy_install pip

    or use command yum -y install python-pip to install pip

  • install shadowsocks using pip

      pip install shadowsocks

    just run this command

  • create json config file

      vim /etc/shadowsocks.json

    edit file as follow:


    Explanation of each field:

      - server: your hostname or server IP (IPv4/IPv6).
      - server_port: server port number.
      - local_port: local port number.
      - password: a password used to encrypt transfer.
      - timeout: connections timeout in seconds.
      - method: encryption method, "bf-cfb", "aes-256-cfb", "des-cfb", "rc4", etc. Default is table, which is not secure. "aes-256-cfb" is recommended.
  • start server

    ssserver -c [json_path] -d start

    start service


Second thing is to install lnmp, if you want to host a website on your VPS. You can use screen to install lnmp.

Screen can prevent network connection error during the lnmp installation. You can find more details on the lnmp official site

  1. install screen
  2. run this command: screen -S lamp to create a screen session
  3. download packages wget -c
  4. uncompress the package tar zxf lnmp1.1-full.tar.gz
  5. enter directory: cd lnmp1.1-full/
  6. install lnmp If you are using Centos run ./ , If you are using Debian run ./ , If you are using Ubuntu run `./

If you’re ssh connection suddenly failed, you can connect to your server. Then run command screen -r lnmpto restore your lnmp installation.


After installation, you will see some short instructions.

lnmp status manage: /root/lnmp {start|stop|reload|restart|kill|status}
default mysql root password:12345678
phpinfo : http://yourIP/phpinfo.php
phpMyAdmin : http://yourIP/phpmyadmin/
Prober : http://yourIP/p.php
Add VirtualHost : /root/

The path of some dirs:
mysql dir: /usr/local/mysql
php dir: /usr/local/php
nginx dir: /usr/local/nginx
web dir : /home/wwwroot/default

LNMP is a tool to auto-compile & install Nginx+MySQL+PHP on Linux
This script is a tool to Manage status of lnmp
For more information please visit

Usage: /root/lnmp {start|stop|reload|restart|kill|status}


2015-12-08 linux , vps , lnmp

Nexus 6 tips

说是N6的Tips,当然里面很多都是Android 6.0 隐藏的功能。只要是原生 6.0 的系统都能够开启。


Nexus 6 double tap to wake, root 之后安装一个app即可。



原生 Android 6.0 有个小技巧能够开启状态栏的电池百分比,下拉通知栏,长按开启设置的齿轮,会打开Android 6.0 隐藏的设置,此时进入系统设置,会多出一个“System UI Tuner”,进入打开“Show embedded battery percentage”,则能在状态栏电池上显示百分比。


另一个Android 6.0 隐藏功能,可能是官方并未完成对这个功能的开发和测试,但是就使用来看稳定性OK。开启过程如下,一句话就是修改 /system/build.prop。

  1. 复杂来说,如果手机root过,用任何可以编辑 /system/build.prop 的app,类似下面链接中提到的 build.prop.editor,或者像我一样使用 Root Explorer,直接找到文件,打开文件找到””一行,将原先的”user”值修改成为”userdebug”。保存之后重启手机。
  2. 重启手机之后,进入设置,开发者选项,然后在 “drawing”设置下,开启多窗口模式。
  3. 测试多窗口。点开多任务按钮应该能看到一个黑色的框。


LED for Notifications




  1. Elementalx link
  2. franco.Kernel link

unlock root recovery all in one

写给自己备忘:电源键+音量下可以进入recovery mode




  1. 屏幕的问题,虽然是2K屏,但是 AMOLED 的屏幕黄屏问题始终存在
  2. 待机时间,也就是耗电水平,正常使用一天是肯定没有问题的,当然重度用户是怎么也不会够的。不过N6的待机时间在同等水平的机子中也并不是很好的。
  3. 不要使用涡轮快充来给手机充电,一些N6老用户使用涡轮充电给电池造成了伤害,导致手机电池膨胀,从而使得 N6 后壳开裂。


摩托罗拉官方网站显示Nexus 6将会有两个版本,分别是美国版的XT1103和国际版的XT1100,两者在基本硬件规格上大部分相同,只是支持的数据流模式和频谱略微有差别。美国版XT1103支持制式频段较少,国际版相对比较通用。

Americas Model (XT1103)
GSM/GPRS/EDGE (850, 900, 1800, 1900 MHz)
CDMA (800, 1900, secondary 800 MHz)
WCDMA (1, 2, 4, 5, 8)
LTE (2, 3, 4, 5, 7, 12, 13, 17, 25, 26, 29, 41)
CA DL (B2-B13, B2-B17, B2-29, B4-B5, B4-B13, B4-B29)

Global Model (XT1100)
GSM/GPRS/EDGE (850, 900, 1800, 1900 MHz)
WCDMA (1, 2, 4, 5, 6, 8, 9, 19)
LTE (1, 3, 5, 7, 8, 9, 19, 20, 28, 41)
CA DL (B3-B5, B3-B8)

XT1100国际版联通3G WCDMA制式可以直接使用,4G LTE部分支持1、3、5、7、8、9、19、20、28、41这些频段,国内联通和电信主要采用FDD-LTE制式中的1、3、7频段,移动则是TD-LTE中的41频段,因此理论上两种制式都可以直接使用。当然理论上永远是理论,毕竟国内运营商具体每个地方用何种频段并不一定,购买前还需要考虑这个问题。


移动用户:从频段上看无论国际版还是北美版都支持band41,可以接收移动2.6G的4G信号。但用起来肯定不爽,具体原因跟Nexus 5相同,因为移动目前用于广覆盖和室内分布的TDD频段是39和40,而Nexus 6不支持这两个频段。另外Nexus 6也不支持移动3G,导致其极有可能出现Nexus 5一样的情况,接打电话后需要手工调才能返回4G待机。

联通用户:应该无忧,无论国际版还是北美版都支持band3,也就是联通的4G主频段。另外和Nexus 5一样,Nexus 6肯定也是完美支持CSFB语音回落,所以4G会用的很爽。不过话说回来,Nexus 6有的这些东西,Nexus 5国际版同样也有。

电信用户:总的来说,Nexus 6比Nexus 5强,至少在网络支持方面。如果可以接受Nexus 6的6寸巨屏。电信主力4G频段band3,两个版本的Nexus 6都支持,但仅有北美版支持CDMA,因此电信用户只能选择北美版。不过有一点要注意,电信在很多城市还用band1部署了4G,而北美版沿袭了摩托罗拉一贯的鸟样,对于美国本土不用的频段一律不支持,这次竟然连Nexus 5都支持的band1都删了。这样的后果就是,Nexus 6在未来用电信4G时,由于接收不到band1,可能网速会不如其他国内机子。不过亮点是,这次Nexus 6北美版支持Verizon的网络,这意味着,Nexus 5在电信网络上无法实现的CDMA语音回落,在Nexus 6上有99.999999%的可能会完美解决。因为Verizon与电信相同,其4G语音回落方案是:iPhone采用srlte,其他机型svlte。Nexus 5之所以没办法实现电信4G回落,是因为电信没有在基站侧部署1x CSFB,而1x CSFB是美帝Sprint支持的FDD-CDMA语音回落方案。


2015-12-01 Nexus , Android





火星救援 马特达蒙



这部电影的剧情其实很简单,如果稍微做过一些了解,看电影之前应该就能预料到电影中发生的事情,而正是对于这样一部电影,我更加期待的是导演和演员如何在故事剧情整体都被观众了解的情况下去推动剧情的发展。这部电影由Andy Weir小说改编,虽然没有看过小说,但是经过小说的验证,剧情并不会离谱到哪里,所以在看完这部电影之后对整个剧情的设定,情节的发展都没有找到比较大的漏洞。电影基本在沿用两条线叙事,火星上马特达蒙的生存挑战,地球上的营救计划的展开,总体沿用这两条故事线,而中间也穿插了赫尔梅斯号飞船上的故事,到影片的结束,赫尔梅斯号上的故事线和马特达蒙的线合二为一。从剧情上来看,故事整体发展都很平淡,也像之前看到的一些评论说的那样,导演尽量的在克制并没有打温情牌,即使是在片尾才出现的爱情线,也只是淡淡的一笔带过,而主角的亲情戏也是一再的克制,犹记得其中的一个镜头就是马特坐在火星的高地上,镜头从背后绕到前面,而中间伴随着马特的遗言式的自白,这也是我唯一能够想到的提交亲情的戏份。而相比《星际穿越》中的亲情带来的感动,导演Ridley Scott一再的将电影的重心放到营救的整个过程中。



在说到娱乐性,对我来说,娱乐性对于这部电影来说应该就算是话题效应了,如果从今年6月份算起,我已经期待这部电影超过了5个月了。对我来说,娱乐性的体现已经足够充分,而在11月份,好莱坞电影集中上映的前提下,我相信《火星救援》也还是依然能够保证充足的话题性。而从另一方面,电影创造出的火星场景来看,也足够具有话题性,从《地心引力》创造的宇宙世界观,《星际穿越》创造的黑洞,好莱坞几乎在以一年一部的速度刷新着我们的宇宙观。而今年几乎是 NASA 的新世纪元年,就在《火星救援》美上映的前几天,NASA 宣布火星发现水,这简直就是给这部影片一个巨大的广告宣传,再到 NASA 今年公布的冥王星的图片,整个世界都被宇宙震撼到了。

冥王星 NASA








  1. 两辆漫游车 书中对于漫游车的改造远远超出电影中的描述,沃特尼花费了大量的时间去改造漫游车,而这部分情节在电影上被省去了,或许是从电影表现来看并不是最佳的情节。在电影后半段时期,火星上的交代变少,更多的是展现火星神奇的地貌,而书中反而不是这样,在漫游车改造的过程中,沃特尼失去了地球的联络,只能依靠自己的知识改造漫游车。并且在之后的移动过程中是没有和 NASA 的联络的。

  2. 电影中删减了很多沃特尼去往3000+公里外的 MAV 的情节 这也是在上面说到的一点,沃特尼在前往 MAV 的过程中没有人去协助,只依靠自己的努力,小说中甚至描述了他遭遇火星沙尘暴的情节,而在电影中几乎完全没有被提及,这也导致我在观影中感受到的电影中后段故事趋于平缓,当然这可能也是为了缩减电影时长而不得已为之,但是这一段沃特尼自救的部分真是惊心动魄,既紧张又充满刺激,当然在我为沃特尼这种临危不乱的精神敬佩的时候,沃特尼用自己的聪明才智已经快到达目的地了。

  3. 小说中对配角形象的塑造更加成功 这里我不得不说,小说对这些配角的形象塑造更加生动。小说中在赫尔梅斯上得情节描述较电影多,而小说对地面 NASA 等的描述较小说少,所以从小说中能看到诙谐幽默,时常开玩笑的马丁尼兹,能看到指挥果断地刘易斯指挥官,还有搞办公室恋爱的约翰森,他们的形象,加上之前在电影中留下的记忆,共同组成他们成为一个角色的特征。

  4. 对指挥官刘易斯的改编 看过电影的人应该都知道,最后是指挥官刘易斯去营救的沃特尼,其实当时看完电影并没有感觉到什么不适,但是后来想一想,虽然航天员什么方面都会训练一下,但是指挥官并没有什么特殊的理由让自己代替另一个专业航天员去营救沃特尼,当然这也可能是电影剧本的要求吧,因为我对那个人也真没多少印象,赫尔梅斯上一共六个人,上面提到的3个加上沃特尼,剩下的两个实在是没什么印象了,所以在最后电影中换成指挥官也情有可原吧。

2015-11-26 影评 , MattDamon

lua installation

Install Lua in Linux

You can install lua in Linux Mint/Debian/Ubuntu.. You can find all verions of lua here.

tar zxf lua-5.3.1.tar.gz
cd lua-5.3.1
make linux test

Finally, if test have passed, then install lua into the right place by running sudo make install:

einverne@mint ~/Downloads/lua-5.3.1 $ sudo make install
[sudo] password for einverne:
cd src && mkdir -p /usr/local/bin /usr/local/include /usr/local/lib /usr/local/man/man1 /usr/local/share/lua/5.3 /usr/local/lib/lua/5.3
cd src && install -p -m 0755 lua luac /usr/local/bin
cd src && install -p -m 0644 lua.h luaconf.h lualib.h lauxlib.h lua.hpp /usr/local/include
cd src && install -p -m 0644 liblua.a /usr/local/lib
cd doc && install -p -m 0644 lua.1 luac.1 /usr/local/man/man1

According to the output, we know that lua header files are located under /usr/local/include. And liblua.a lib is located under /usr/local/lib. This two paths may be used later when coding with C/C++. And most important thing executalbe file is located under /usr/local/bin. Most of the Linux distributions are installed lua by default. But most of them don’t have liblua.a installed.

Install Lua on Mac OS X

If you want to build from source code like under linux, just change make linux test into make macosx test. And all the following steps are the same as I mentioned in the Linux section.

If you want a more convenient way to install lua, you can download binary package here. And click next and next to finish installation.Default installation path is same as in Linux.

And id you are using Homebrew just run brew install lua, everything is done.

And you can find more ways to install lua on

For other OS

please see:

Testing Lua

After installation , run lua -v to check the lua version. Test lua by printing “hello world” using following code. Run lua in terminal:

einverne@mint ~ $ lua
Lua 5.3.1  Copyright (C) 1994-2015, PUC-Rio
> print "hello world"
hello world

Type Control+D to exit.

lua IDE

If you want to find a lua IDE, I highly recommend Zerobrane Studio. It is cross-platform and support different versions of lua from 5.1 to lastest 5.3. And it has a debugger build-in, which is great for debug lua code from local or remote. It is worth to have a try.

2015-10-31 lua , linux

Things to do after install Linux Mint

I have changed my desktop environment to Linux, and after I tried Ubuntu and Debian, I finally choose the Linux Mint distribution. I think there are some reasons why this distribution take the first place in distrowatch. User-friendly desktop environment and convenient software package manager make me very comfortable. Cause it is based on the Debian and Ubuntu, most of the applications are familiar.

Install a theme

The simplest way to install a new Cinnamon theme is with the Themes manager in System settings.

Go to System Settings -> Themes -> Get More Online -> Refresh list. You can choose Most Popular or Latest. The theme will be installed to your hidden folder ~/.themes

Dark Blue Glass

I highly recommend my modified Dark Blue Glass theme link. It is a mix of Dark Glass and mint numix blue theme. Or you can find more themes on the following sites:


You can install a new icon set in two ways. One is by adding a PPA. You add the PPA, install the icon set. But you won’t find icon sets for all the icon themes. Therefore, the other way round is to download the compressed file and extract it to ~/.icons or ~/.local/share/icon . If this directory doesn’t exist, create one using the following command:

mkdir ~/.icons

The icons extracted in the above directory will be available for the current user only. If you want the icons to be available for all the users, you should extract the icons to /usr/share/icons .

Now, once you have installed the icon set, you can use a Unity Tweak Tool to change the icon theme. Use the following command to install Unity Tweak Tool:

sudo apt-get install unity-tweak-tool

Or in Linux mint you can just change icons under setting -> theme -> icons.

I highly recommend this one: papirus icons

sudo add-apt-repository ppa:varlesh-l/papirus-pack
sudo apt update
sudo apt install papirus-icons

Software Sources

You didn’t need to edit/etc/apt/sources.list and files under /etc/apt/sources.list.d/ mannually. All customs can be changed through UI. Just click “start menu” and choose the “Software Sources”. And this application can even custom the PPAs.

linux mint software sources managers

Necessary applications


First is web browser, and of course Chrome. I am crazy about Google, and all Google related things. I have used Chrome since year 2011, after I am tried of the Firefox’s slowness. Although Firefox become more and more light, faster this years, I get used to Chrome. And what Chrome done makes me really happy. First thing is the bookmark and extension etc sync. I can reach all of my staff and customizations, after I login into my account. I don’t even need to worry about anything. All my Apps, Extensions, Settings, Autofill informations, History, Themes, Bookmarks, Passwords, and even Open tabs always follow my account. I can reach my opening tab on desktop from my Android phone. I can reopen bookmarks on my home laptop, which I added in my laboratory computer. And I can open chrome://history page to check all current opening tags from signed-in devices, and even check the unread article in the opening tab on my phone and browser all my chrome history.

sogou input method

It is necessary to have an input method for typing Chinese which I speak. I choose the sogou input method, because it is easy to use and have a very Good word dictionary. Sogou input method is based on fcitx. In Linux mint setting panel, we have the Language setting, we can choose to install fcitx components.

More detail information can be found in this blog article.

Following can be done through user interface, no need to run. Pasting here only for reference.

sudo apt-get install fcitx fcitx-table-wubi-large fcitx-frontend-all fcitx-frontend-gtk2 fcitx-frontend-gtk3 fcitx-frontend-qt4 fcitx-config-gtk fcitx-ui-classic fcitx-module-kimpanel fcitx-module-dbus fcitx-libs-qt
sudo apt-get install fcitx fcitx-bin fcitx-config-common fcitx-config-gtk fcitx-data fcitx-frontend-all fcitx-module-cloudpinyin fcitx-module-dbus fcitx-module-kimpanel fcitx-module-x11 fcitx-modules fcitx-qimpanel-configtool

After installation, “start”, “Fcitx Configuration” can config the input method, just add “Sogou Pinyin” to the panel.


Use to cross China’s great firewall. Don’t need to talk more.

 pip install shadowsocks # install command line tool

If pip is missing, install pip first.

PPA is for Ubuntu >= 14.04.

sudo add-apt-repository ppa:hzwhuang/ss-qt5
sudo apt-get update
sudo apt-get install shadowsocks-qt5

To install Qt version of shadowsocks. From:GitHub.

Nvidia driver

“System settings” , “Driver Manager”, choose the right latest driver and install. After installation, you will find Nvidia icon at the right-bottom corner. Double click the icon to open the setting panel. In order to save the battery , you can use Intel(Power Saving Mode) for most time. And if choose NVIDIA(Performance Mode) for high performance need.

Nvidia driver


Install hardinfo tool to check hardware information through GUI

 sudo apt-get install hardinfo

System tools

If there is no special instruction, all of the following applications can be installed from the Software Manager in Linux Mint.

gnome do

As it official introduction said “Do things as quickly as possible (but no quicker) with your files, bookmarks, applications, music, contacts, and more!”. I set a shortcut Alt+Space to launch Gnome do. And you can just type several keys to start any application quickly.

install following package:

  • gnome-do
  • gnome-do-plugins


Use F12 to open a terminal. Dropdown terminal, you can right click the terminal after you press F12 to configure your guake.


“PlayOnLinux is a front-end for wine. It permits you to easily install Windows Games and software on Linux. It is advised to have a functional internet connection.” I use playonlinux to install Evernote and cloudmusic(网易云音乐). Although I met a lot of problems during installation of Evernote. But finally evernote 5.8.x can be installed on wine 1.7.x.

There are several packages you need to install to make PlayOnLinux work.

  • wine
  • wine mono
  • wine gecho
  • ttf-mscorefonts-installer


Most of the following can be installed from default Software Manager. Just type name of the application and search then click install.


cloud music client and my favourite music client. Here is the link to it’s official site, where you can found clients for all platforms include linux.


my favourite cloud notebook with a very clean Android client.


Linux mint 17 has a default screenshot software called Screenshot. It is a very simple screenshot software. Shutter is more powerful.


Sync all my files. When I installed Dropbox through it’s offical installer, there was a problem I cannot connect to Dropbox directly from China. Here is a solution to redirect connections to shadowsocks sock5 proxy. You should install proxychains.

sudo apt install proxychains
# config socks4 9050  To socks5 1080 which is the default of shadowsocks
vi /usr/local/etc/proxychains.conf
# then use proxychains to start dropbox
proxychains4 dropbox start -i

Then dropbox will start to start and install, then after installation you can set sock5 proxy in dropbox settings.


Baidu pan linux port. It is really a great work. Thank the author.

You can download here


Remote desktop connection client able to display and control a remote desktop seesion. It supports multiple network protocols in an integrated and consistant user interface. Currently RDP, VNC, NX, XDMCP and SSH protocols are supported.


linux firewall.


E-book manager, 电子书管理. It is very efficient when you plug in kindle using USB port Calibre is prepare to serve.


Evernote like cloud notebook client. Find more information here. You can install through PPA:

$ sudo add-apt-repository ppa:wiznote-team
$ sudo apt-get update
$ sudo apt-get install wiznote


one of the screenrecoders I use.


Best image and picture manager ever from Google.

audacity audio editor

record and edit audio files

kdenlive video editor

non-linear video editing suite.

WPS Office for Linux

Office software include writer, spreadsheets and presentation.


Password manager. But I prefer LastPass.

youdao dict

This client really make me impressed. It is faster and simple than any other platform client. Launch it with Gnome do, and use it to check English word is a very happy work. Someone used to recommand me the StarDict, but I think youdao dict is a better choice for me.


Elegant, powerful, clean dock.

Or there is another choice Cairo Dock.

ntfs configuration tool

Install this tool using this command:

 sudo apt-get install ntfs-config

and you can find NTFS Configuration Tool in the menu. It is a very efficient tool to auto mount windows NTFS partitions. You can setup to auto-mount when your Linux mint start up. It is really useful if you have a second hard drive installed and you want it to auto-mount each time you restart your system.

smplayer or vlc

video player always need one. Personally, I like smplayer more.

Nuvola Player 3

You can follow the instruction on it’s official site. It was great, espcially when you want to listen to music at Google Play Music, or other cloud stream music. It support a lot of services, like Amazon Cloud Player, Play Music, Plex Music, Spotify, Tuneln, etc.


Birdie is beautiful Twitter client for GNU/Linux.

PPA (14.04) Birdie can be installed from our PPA, which provides automatic updates whenever we improve the application.

$ sudo add-apt-repository ppa:birdie-team/stable
$ sudo apt-get update
$ sudo apt-get install birdie

from it official site:


all the detail information can be found at it’s official site.

$ sudo add-apt-repository ppa:mc3man/trusty-media
$ sudo apt-get update
$ sudo apt-get install ffmpeg


Remote control application. I need it to help to connect my mac in lab and other Windows machine. You can download here. And because it is cross-platform. You can install in other OS and connect it easily.

Programming tools


Use apt-get search vim to search related vim packages, you will find several packages,like vim-gtk, vim-gnome etc. Install vim and vim-gtk package to install vim and gvim. And config my vim with my dotfile,


best version control system. And I am using SmartGit.



Sublime Text

Text Editor. Later I found Atom which is also great.


markdown editor.

eclipse with jdt and cdt

sometime need java and c++ IDE for test.


install boost library from source using the following code:

 sudo apt-get install libboost-all-dev

all boost library is located at /usr/include/boost

Android Studio

Check official site for more information.


Python IDE

ZeroBrane Studio



Sqlite manager



You can have your local weather forecast in desktop.

Desktop Capture

Screenshot and screencasting tools which saves me a lot of time.

I have created a list in Youtube, you can check it for information.

2015-10-24 linux , linux mint , applications

Install fonts under Linux

Most of computer fonts people using are TrueTpye fonts. TrueType fonts end with .ttf , which stand for TrueType Font. This tutorial shows how to install TrueType fonts in Linux (Debian, Ubuntu, Linux Mint, etc).

General way to install TrueType fonts

All of the TrueType fonts are under /usr/share/fonts/truetype, simplest way is to copy ttf file to this directory and give it the right permission. For example, if you want to install Ubuntu font family manually. You can download the font file from official site.

In the terminal, download the package:


unzip the file into directory ubuntu-font-family-0.80


and then use copy command to copy all the files to /usr/share/fonts/truetype,/usr/share/fonts directory and sub directory need root to write, so you should add sudo before command. The -r paramater represent recursive, it means all the files under ubuntu-font-family-0.80 will be copied to the right place.

 sudo cp -r ubuntu-font-family-0.80/ /usr/share/fonts/truetype/

finally, you shoulde give this directory and all the ttf under this directory right permission. All the new fonts now can only be used by root. We need to change the permission to let all the users to use these fonts:

 sudo chmod 755 /usr/share/fonts/truetype/ubuntu-font-family-0.80/ -R

then, refresh the font cache to let system detect these fonts:

 fc-cache -f -v

Install new fonts only for current user

As I mentioned in the first part, if you copy the ttf file to /usr/share/fonts directory, all the users can use these new fonts. But if you only want to provide these fonts to specific user, like current login user , you can just copy the file to ~/.fonts directory. If there is no such directory, just create it. The ~ stand for current user’s home directory, full path is /home/<username>. So repeat the operation to install Ubuntu font family:

mkdir ~/.fonts
cp -r ubuntu-font-family-0.80/ ~/.fonts/
fc-cache -fv

Install microsoft core fonts

Microsoft Core Fonts include these fonts:

  • Andale Mono
  • Arial Black
  • Arial (Bold, Italic, Bold Italic)
  • Comic Sans MS (Bold)
  • Courier New (Bold, Italic, Bold Italic)
  • Georgia (Bold, Italic, Bold Italic)
  • Impact
  • Times New Roman (Bold, Italic, Bold Italic)
  • Trebuchet (Bold, Italic, Bold Italic)
  • Verdana (Bold, Italic, Bold Italic)
  • Webdings

Debian/Ubuntn/Linux Mint user just open terminal and run these command:

sudo apt-get install ttf-mscorefonts-installer

or Linux Mint user can find this package in the Software Manager, just search it and click install.

Install Chinese fonts

.ttf files are the English fonts, while .TTF files are Chinese fonts. If we check the C:\Windows\Fonts under Microsoft Windows, there are 3 kind of fonts. One is the .fon fonts, which is the DOS system font, and other two fonts are .ttf and .TTF. We can just make a copy of all .ttf and .TTF file and copy all the files to /usr/share/fonts/ directory under Linux. Although it is illegal under Microsoft’s TOC, but we can still do it. :)

If you dual boot your computer, mount the Windows and copy the files

sudo mkdir /usr/share/fonts/truetype/WindowsFonts
sudo cp -r /media/Windows/Fonts/*.ttf /usr/share/fonts/truetype/WindowsFonts/
sudo cp -r /media/Windows/Fonts/*.TTF /usr/share/fonts/truetype/WindowsFonts/

Install open source Chinese fonts, like文泉驿-微米黑 文泉驿-正黑

sudo apt-get install ttf-wqy-microhei ttf-wqy-zenhei

several Chinese font we can choose:

To check more about Chinese font visit Arch wiki


Install Software Manager under Linux Mint

Linux Mint user can find a font manager under Software Manager. It is really a cool tool to manager your fonts.

List all available fonts

fc-list is a quick and handy command to lists fonts and styles available on the system for applications using fontconfig. You can use fc-list to find out whether particular language font is installed or not.

To list all font faces:

$ fc-list

To lists font faces that cover Chinese language:

$ fc-list :lang=zh

Output will be all available Chinese fonts.

Fix WPS for Linux font missing error

After I installed WPS for Linux under Linux Mint 17.2, I met this problem, “系统缺失字体symbol、wingdings、wingdings 2、wingdings 3、wedding”. According to the copyright, WPS for Linux doesn’t contains these five fonts. You can only find these five fonts and install them in the right place like I said before. One way to find these fonts is to find them in Microsoft Windows system. And another way is to download these files from Internet and install.

Install Korean fonts

Use following command to search Korean font

apt-cache search korean font

and use this command to install Korean font to linux:

sudo apt-get install fonts-unfonts-core fonts-unfonts-extra

Common sense

Fonts type:

  • Sans-serif=无衬线体=黑体:并不是具体一款字体,而是一类字体,选择它其实等于选择这类字体中优先级最高的那款字体。
  • Serif=衬线体=白体:同上
  • Monospace=等宽字体,意思是字符宽度相同:同上
  • 点阵字体=位图字体



For more information check Debian page Arch wiki and Ubuntu wiki

2015-10-21 linux , linux mint , fonts

git presentation

之前做过一个简单的 git 的介绍,下面是 PPT 的摘录。

What is Git

Git is a free and open source distributed version control system(VCS) designed to handle everything from small to very large projects with speed and efficiency.

Git 是一个分散式版本控制软件,最初由林纳斯·托瓦兹(Linus Torvalds)创作,于 2005 年以 GPL 发布。最初目的是为更好地管理 Linux 内核开发而设计。Linus Torvalds 自嘲的取名“git”,该词源自英国俚语,意思大约是“混账 1”。


Version Control Example

Microsoft Word 如果你用 Microsoft Word 写过长篇大论,那你一定有这样的经历:

想删除一个段落,又怕将来想恢复找不回来怎么办?有办法,先把当前文件“另存为……”一个新的 Word 文件,再接着改,改到一定程度,再“另存为……”一个新文件,这样一直改下去,最后你的 Word 文档变成了这样:


Undo Windows: Ctrl+z Mac: Command+z


Version control has a very long histroy.

  • Source Code Control System (SCCS)
  • 1972, closed source, free with Unix
  • Revision Control System (RCS)
  • 1982, open source
  • Concurrent Versions System (CVS)
  • 1986-1990, open source
  • Apache Subversion (SVN)
  • 2000, open source

BitKeeper SCM

  • 2000, closed source, proprietary
  • distributed version control
  • “community version” was free
  • used for source code of the Linux kernel from 2002-2005
  • Controversial to use proprietary SCM for an open source project
  • April 2005: the “community version” not free anymore

Git is born

  • April 2005
  • created by Linus Torvalds
  • replacement for BitKeeper to manager Linux kernel source code
  • distributed version control
  • open source and free software
  • compatible with Unix-like systems (Linux, Mac OS X, and Solaris) and Windows
  • faster than other SCMs (100x in some cases)

Git become popular, GitHub launched in 2008 to host Git repositories:

  • 2009: over 50,000 repositories, over 100,000 users
  • 2011: over 2 million repositories, over 1 million users


Git 是一种分布式版本控制,不需要服务器端软件也可运行

  • 不同用户维护自己的版本库,而不是和核心版本库交换数据
  • 追踪 “change sets” 或者 ”patches”
  • 无需网络,随时随地进行版本控制
  • 分支的新建、合并非常方便、快速,没有任何成本,基本不耗时

Who use Git?

anyone wanting to track edits

  • review a histroy log of changes made
  • view differences between versions
  • retrieve old versions

anyone needing to share changes with collaborators

anyone not afraid of command-line tools


  1. 只能跟踪文本文件的改动,二进制文件不行,也就是说 如果使用 Git 追踪 Word ,版本控制系统并不知道改动了那些行,只能知道二进制变化了。


    • HTML, CSS, JavaScript
    • PHP, Ruby, Ruby on Rails, Perl, Python, ASP
    • Java, C, C++, C#, Objective-C
    • ActionScript, CoffeeScript, Haskell, Scala, Shell scripts

    not as useful for tracking non-text files

    • images, movies, music, fonts
    • word processing files, spreadsheets, PDFs
  2. 编码问题,如果在多平台使用请千万使用 UTF-8 编码

    使用 Windows 的童鞋要特别注意: 千万不要使用 Windows 自带的记事本编辑任何⽂文本⽂文件。原因是 Microsoft 开发记事本的团 队使⽤用了⼀一 个非常弱智的⾏行为来保存 UTF-8 编码的⽂文件,他们⾃自作聪明地在每个⽂文件开头添 加了 0xefbbbf(⼗十六进制)的字符,你会遇到很多不可思议的问题,比 如,网页第一⾏行可 能会显⽰示⼀一个“?”,明明正确的程序⼀一编译就报语法错误,等等,都是由记事本的弱智⾏行 为带来的。建议你下载 Notepad++ 代替记事本,不但功能强⼤大,而且免费!记得把 Notepad++ 的默认编码设置为 UTF-8 without BOM 即可


  • Linux

sudo apt-get install git or sudo yum install git

  • mac

brew install git

  • windows

Git basic

在开始使用 Git 之前有些配置

git config --global "John Doe"  # 配置提交用户名
git config --global  # 配置提交邮箱

git init
git status
git add filename
# 暂存区
git commit -m “"
git log

commit message best practices

  • short single-line summary ( less then 50 characters 或者 小于 25 个汉字)
  • optionally followed by a blank line and a more complete description
  • keep each line to less than 72 characters
  • write commit messages in present tense, not past tense
    • “fix bug” or “fixes bug”, not “fixed bug”


git branch <branchname>
git checkout <branchname>
git checkout -b <branchname>

git push origin <branchname>

git push origin --delete <branchname>


git remote add origin
git push -u origin master
git remote show origin


git tag     # list all tags
git tag v0.9
git tag -a v1.0 -m “my version 1.0"
git show tag name #show tag details
git push origin tag name
git push origin --tags

git GUI




git config --global status
git config --global checkout
git config --global commit
git config --global branch
git config --global alias.unstage 'reset HEAD --'
git config --global alias.last 'log -1 HEAD'

GitLab server


2015-10-12 git











2015-09-27 影评 , 韩国

Bash 学习笔记之基本使用

Bash 的前身 shell 是 Unix 系统下的命令行解释器,主要用于用户和系统交互。 Unix 系统上有很多 Shell,首个 Shell,Bourne Shell,1978 年推出,后来又演变出 C Shell,Bash 等不同版本的 Shell。

Bash 全称为 Bourne-Again Shell,是一个为 GNU 项目编写的的 Unix Shell。Bash 脚本功能强大,尤其是在处理循环或者批量任务时。Bash 是大多数 Linux 平台默认的 Shell,所以学好 Bash 是基础。

首选来看一下 Bash 的版本,输入下面命令


命令行编辑 Emacs mode vs Vi Mode

可以使用 set -o | egrep -w "(vi|emacs)" 命令查看,当前命令行编辑模式。

$ set -o vi
$ set -o|egrep -w "(vi|emacs)"
emacs           off
vi              on

All the above assume that bash is running in the default Emacs setting, if you prefer this can be switched to Vi shortcuts instead.

Set Vi Mode in bash:

$ set -o vi

Set Emacs Mode in bash:

$ set -o emacs

using set -o to check all the bash options.

Emacs 编辑模式

完整 Emacs 编辑模式快捷键,文档 link

Bash Keyboard Shortcuts 在绝大多数情况下一下快捷键可以直接使用

移动光标 Moving the cursor


Command Explain
Ctrl + a 移动到命令最前 Go to the beginning of the line (Home)
Ctrl + e 移动到行尾 Go to the End of the line (End)
Ctrl + p 上一个命令 Previous command (Up arrow)
Ctrl + n 下一个命令 Next command (Down arrow)
Alt + b 不删除命令的情况下,向前移动一个单词 Back (left) one word
Alt + f 向后一个单词 Forward (right) one word
Ctrl + f Forward one character
Ctrl + b Backward one character
Ctrl + xx 在行首和当前光标的位置来回切换 Toggle between the start of line and current cursor position

编辑 Editing


Command Explain
Ctrl + L Clear the Screen, similar to the clear command
Alt + Del Delete the Word before the cursor.
Alt + d Delete the Word after the cursor.
Ctrl + d Delete character under the cursor
Ctrl + h Delete character before the cursor (Backspace)
Ctrl + w Cut the Word before the cursor to the clipboard. 一般用来快速删除前一个单词,也可以用 Alt + Backspace
Ctrl + k Cut the Line after the cursor to the clipboard.
Ctrl + u Cut/delete the Line before the cursor to the clipboard. 一般用来快速清除当前输入命令
Alt + t Swap current word with previous
Ctrl + t Swap the last two characters before the cursor (typo).
Esc + t Swap the last two words before the cursor.
Ctrl + y Paste the last thing to be cut (yank)
Alt + u UPPER capitalize every character from the cursor to the end of the current word.
Alt + l Lower the case of every character from the cursor to the end of the current word.
Alt + c Capitalize the character under the cursor and move to the end of the word.
Alt + r Cancel the changes and put back the line as it was in the history (revert).
Ctrl + _ Undo
TAB Tab completion for file/directory names

For example, to move to a directory ‘sample1’; Type cd sam ; then press TAB and ENTER. type just enough characters to uniquely identify the directory you wish to open.

历史 History

Command Explain
Ctrl + r Recall the last command including the specified character(s)
searches the command history as you type.
Equivalent to : vim ~/.bash_history.
Ctrl + p Previous command in history (i.e. walk back through the command history)
Ctrl + n Next command in history (i.e. walk forward through the command history)
Ctrl + s Go back to the next most recent command.
(beware to not execute it from a terminal because this will also launch its XOFF).
Ctrl + o Execute the command found via Ctrl+r or Ctrl+s
Ctrl + g Escape from history searching mode
!! Repeat last command
!abc Run last command starting with abc
!abc:p Print last command starting with abc
!$ Last argument of previous command
ALT + . Last argument of previous command
!* All arguments of previous command
^abc­^­def Run previous command, replacing abc with def

进程控制 Process control

Command Explain
Ctrl + C Interrupt/Kill whatever you are running (SIGINT)
Ctrl + L Clear the screen
Ctrl + s Stop output to the screen (for long running verbose commands)
  Then use PgUp/PgDn for navigation
Ctrl + q Allow output to the screen (if previously stopped using command above)
Ctrl + D 退出当前 Shell Send an EOF marker, unless disabled by an option, this will close the current shell (EXIT)
Ctrl + Z Send the signal SIGTSTP to the current task, which suspends it.
To return to it later enter fg ‘process name’ (foreground).

最常使用的应该还是 Ctrl-a, Ctrl-e, Ctrl-f, Ctrl-b, Ctrl-l, Ctrl-h, Ctrl-w, Ctrl-k, Ctrl-u, Ctrl-y, Ctrl-r.

命令 说明
Ctrl-B 后移一个字符
Ctrl-F 向前移动一个字符
DEL 向后删除一个字符
Ctrl-D 向前删除一个字符
Ctrl-A 移到行首
Ctrl-E 移到行尾
Ctrl-K 向前删除到行尾
Ctrl-P 移到前一行
Ctrl-N 移到后一行
Ctrl-R 向后搜索
Ctrl-J 等同于 RETURN
Ctrl-L 清除屏幕,将当前行放到屏幕最上面
Ctrl-M 等同于 RETURN
Ctrl-O 等同于 RETURN 随后在显示历史命令中下一行
Ctrl-T 颠倒光标左右两个字符,将光标向前移一个
Ctrl-U 从光标位置开始删除行 ,向后删除到行首
Ctrl-V 引用插入

Vi 编辑模式

通过设置 set -o vi 进入 Vi 编辑模式,正常环境为输入模式,对命令进行修改则按 Esc。完整命令参考.

命令包括 h, l, w, b 等等 Vi 中使用的命令,可参考另外一篇 Vim 学习笔记

  • 通过按键 Esc , Ctrl+l(L lower case) ,clear screen。
  • Ctrl-w
  • Ctrl-u
  • Ctrl-k
  • Ctrl-y
  • Ctrl-r



最重要的 Bash 文件是 .bash_profile ,它在每次用户登陆系统时被读取 /etc/profile 。Bash 允许有 .bash_profile 两个同义文件, C Shell 的 .bash_login 以及 Bourne Shell 和 Korn Shell 的 .profile 。登录时三者中只有一个被读取,如果用户根目录下 .bash_profile 不存在,则 bash 依次查找 .bash_login , .profile.

.bash_profile 只被登录 shell 读取并执行,如果通过命令键入 Bash 启动一个新 Shell, 它就会读取 bashrc 中的命令。

.bash_logout 在每次 shell 退出时被读取并执行。

可以使用 source ~/.bashrc 来使配置文件立即生效。

修改 .bashrc 文件可以精确到对当前用户有效。修改 /etc/profile 对全局用户生效。



alias name=command

指定 name 是 command 的别名。在“=”两边没有空格,严格语法。



别名可以为命令创建方便的名字,它们实际上并不改变 shell 的行为。选项则不然。基本命令:

set -o optionname	- 号 开启
set +o optionname	+ 号 关闭

检查 bash 所有可选项,使用 set -o 打印所有列表。

shopt 选项

选项 含义
-p 显示可选设置及其当前取值
-s 设置
-u 失效
-o 允许选项名取值通过 set 命令 -o 选项定义


allexport           off
braceexpand         on
emacs               off
errexit             off
errtrace            off
functrace           off
hashall             on
histexpand          on
history             on
ignoreeof           off
interactive-comments     on
keyword             off
monitor             on
noclobber           on
noexec              off
noglob              off
nolog               off
notify              off
nounset             off
onecmd              off
physical            off
pipefail            off
posix               off
privileged          off
verbose             off
vi                  on
xtrace              off
选项 解释
emacs emacs 编辑模式
vi vi 编辑模式
ignoreeof 不允许单独使用 Ctrl-D 退出
noclobber 不允许输出重定向(>)覆盖已存在的文件
noglob 不允许扩展文件名通配符如*和?
nounset 试图使用未定义变量时给出错误


Shell 变量也是一个拥有取值的名字,bash 有一些内置的变量,shell 编程也可以自定义变量。按照惯例,内置变量名均为大写,当然也有两个例外。



引用变量,使用符号 $ , 单引号内部的变量会直接使用而不需要转义,而双引号内部变量需要转义

echo $varname

bash 有很多内置变量分布在各个配置文件中。


PATH 变量,帮助 shell 找到输入的命令。输入 echo $PATH 得到类似:

变量 含义
HOME 主目录
SECONDS 调用 shell 的秒数
BASH 正在运行的 shell 实例路径名
BASH_VERSION shell 版本号
BASH_VERSINFO shell 版本信息数组
PWD 当前目录
OLDPWD 最后一个 cd 命令前的目录

2015-09-26 linux , bash , vim




  • 使用 alembic 迁移数据库结构 Alembic 是一个处理数据库更改的工具,它利用 SQLAlchemy 来实现形成迁移。 因为 SQLAlchemy 只会在我们使用时根据 metadata create_all 方法来创建缺少的表 ,它不会根据我们对代码的修改而更新数据库表中的列。它也不会自动帮助我们删除表。 Alembic 提供了一种更新 / 删除表,更改列名和添加新约束的方法。因为 Alembic 使用 SQLAlchemy 执行迁移,它们可用于各种后端数据库。
  • 每天学习一个命令:iotop 查看 Linux 下每个进程 IO 占用 iotop 是一个用来监控磁盘 I/O 的类似 top 的工具,Linux 下 IO 统计工具,比如 iostat, nmon 等只能统计到每个设备的读写情况,如果想要知道哪一个进程占用比较高的 IO 就要使用 iotop。 iotop 使用 Python 语言编写,要求 Python >= 2.5,Linux Kernel >= 2.6.20.
  • 修正关于 HTTP Header 的错误认识 HTTP 请求的 Header 是不区分大小写的!,一直以为 HTTP 请求的请求头是有区分大小的,知道今天调试发现 Spring 将 header 全部处理成小写,然后有人提了 Bug 58464 然后看到 Stackoverflow 上面有人回答。
  • 解决 failed to create bus connection no such file or directory 错误 今天在修改 hostname 使用 sudo hostnamectl set-hostname ds 命令时遇到问题:
  • Vim 的颜色主题 Retro groove color scheme for Vim