The Meaning of Commonly-used Options and Variables When Building Packages from Source

On Linux system, if we do not have root priviledge, we can not use package managers to install a package to its default location (usually under /usr). Besides, the packages installed by the package managers are often too old to have the latest features. Or, even if we have root priviledge, we do not want to mess up with the system-wide packages and just want to experiment with a package locally. On these ocassions, we may want to install the package to a custom location.

File Sharing between Android and Mac Wirelessly without Pain

If you connect your Android device to your Macbook, you will notice that your phone is not recognized. Unlike Windows, Apple’s Mac seems not so friendly to Android devices. Of course, you can install Android File Transfer provided by Google and connect your phone to Mac. But it is kind of cumbersome and does work so well. In this post, I will introduce several ways to transfer files between Android and Mac wirelessly.


去年建立博客的时候,选择了七牛云存储来存放博客的图片,最近收到了七牛的邮件,之前一直在用的域名只是一个测试域名,再过一阵就要回收了,到时必须使用自己的域名。大概看了一下,申请自己的域名还要涉及注册于备案,我仅仅是需要存储图片,这样太费周章,所以决定把博客的图片从七牛迁移出来。经过一番查找,最后觉得使用腾讯云的对象存储 COS,由于我的图片量很少,所以就算付费,每个月实际的支出也不会太大。本文介绍一下图片迁移过程。

Setting up True Color Support for Neovim and Tmux on Mac with iTerm2

In this post, I want to write about how to set up true color support in Tmux, Nvim and shell and make them work nicely together.

There are tons of disccusions on the internet regarding how to set up true color support to make Tmux, Nvim and terminal work together. Time flies and settings may change. There are also many people who do not really know the reason behind all the settings and give some ad-hoc settings. All these lead to chaos. It turns out setting up true color support is painfully difficult and wastes me several hours.

An Introduction to Lookaround Regular Expression in Neovim

Today I want to use some regular expression for searching and replacing in my files. But I found that NVim’s regular expression engine has its own flavor, which is different from the regex engine used by Sublime Text.1 I ended up learning some of the basics of Nvim-style regex. In this post, I want to emphasize on how to use lookaround2 in Nvim.

Building Latest Tmux from Source on CentOS 7 without Root Priviledge

Tmux is a great terminal multiplexer. The Tmux installed by yum is too old1 on my CentOS servers. So I decided to install the latest version of Tmux which supports true colors. Since I do not have root priviledge on the system, I have to build Tmux from source and install it to my custom directory. If that is also what you want to do, then go on reading.

Install and Configure Zsh on CentOS

Zsh is a powerful shell with better auto-completion and richer functions. There are also various plugins to enrich your experience of using shell. In this post, I will introduce the installation and simple configurations for zsh.

A Simple Guide on How to Use the Python Logging Module

In the past, I often use plain print() to display some statistics during the training process and validation process. But it is not convenient to save the statistics in a file for later inspection. Once the program is finished, we do not have an overview of the training process. I am aware that there are packages such as tensorboardX and visdom, which are specifically designed for inspecting the various statistics during running. Right now, I would rather keep the program plain simple and usable. So I decided to give Python logging pacakge a try.

Store Boolean Values for Parameters in Argparse


If you want to set parameter’s default value to True, use

parser.add_argument('--param', action='store_false')

Otherwise, use

parser.add_argument('--param', action='store_true')

when we use argparse to manager program parameters and add a parameter, we often use the action options to set the parameter’s value to a boolean value. But I have previously misunderstood this options and made a mistake. In this post, I will explain how does this option work and how to use it correctly.

把博客生成工具从 Hexo 迁移到 Hugo --- 配置与设置

这个博客于 2017 年 2 月开始搭建运行,最初使用的是 Hexo 搭建,配合精美的 NexT 主题,经过鼓捣,差不多算是做出了让自己满意的博客。不过每次 Hexo 安装要配置的东西太多了,总觉得不是很简洁,随着博客数量的增加,Hexo 在生成博客的速度上也慢了下来。怀着尝鲜的心态,我将 Hexo 博客迁移到了 Hugo。下面详细介绍一下迁移过程。

Fixing the nerdtree Window Problem with `bd` Command in Nvim

If you have a nerdtree file navigation window on the left of the current buffer and use :bd1, you will find that the nerdtree window will occupy the whole window. When you open another buffer, you have to manually resize the nerdtree window to a smaller size, which is super annoying.

How to prevent this behaviour?

Vim-like Settings for tmux

I am a Neovim (or Nvim in abbreviation) user. In Nvim, we use Ctrl-W as prefix for window-related operations. But in tmux, the default prefix is Ctrl-B. As a result, when I want to change panes in tmux, I often mistakenly press Ctrl-W, which is annoying. Why not change tmux prefix to be more vim-like?