ppcompile: An Emacs Package to Help Coding Locally

If you are a C/C++ programmer like me, you may experience jumping around different machines to write and compile your code, or you may write code on different machines for different projects, and scp/rsync/ftp the projects around. It works, but it's a bit tedious and takes too much burden on our brains. For example, say I have two projects that should be compiled on their compiling machines respectively. There are two obvious workflows for writing code for them "simultaneously": [Read More]
Emacs 

The Binary Search Idea for Narrowing Down Problem Space

Binary search algorithm is a search algorithm that finds the position of a target value within a sorted array. It cuts off the target array in half in a pass, so that it has a worst-case performance of O(log n). Visualization of the binary search algorithm where 7 is the target value(@wikipedia) We all know that it's an efficient searching algorithm, but the strategy behind it also applies for narrowing down other problem space, for example, finding out when a bug is first introduced in a series of git commits. [Read More]

Manage SSH Connections with ~/.ssh/config

I used to manage SSH connection with such GUI apps as MobaXterm, when I wrote code on Windows at work. As I changed my workflow to use a tiling window manager in a VirtualBox guest OS, I continued to improve my way of managing SSH connections, which I want to share here if you don't know yet. At first, I baked a helper Python script, which I named as qssh for "quick ssh", to help me assemble ssh arguments for me(such as username, Ip, port, etc. [Read More]

Why Can't Git Fetch Remote Branches Other Than Master?

Last week I came into a problem with Git, that I can't fetch the remote branch that I just pushed to. It was so weird because I can push it. It never happens before, and it happened when I was in a rush to rebase my code, as someone in my team pushed his code. After searching, it seemed that the configuration of fetch of that repo was different(this Stack Overflow thread for example) than before, it was specified that only master can be fetched. [Read More]
Git 

Start a New Terminal(urxvt) at Current Buffer's default-directory on Emacs

I have been really enjoying the more concentration workflow qtile, a tiling window manager, brings me, since I started using it a few months ago. I am more focus on the current task now as all the windows I care about are laid out on the same screen. As I get more used to qtile at every day's work, I noticed that I became more depend on short-life terminal sessions. [Read More]

Build Docker Images for Qtile

One of Docker's use cases is to set up identical development environments easily and quickly for a dev team. Recently, I had an opportunity to give it a try, and build Docker images for Qtile, as it didn't have one yet as I get involved. With the images, it's easy to set up the environment to easily run the tests, and build the documentation. The best way to have a basic idea of Docker is to think it like a chroot environment, as Chris Tankersley stated in his Docker for Developers. [Read More]
Docker 

How To Run Bleeding-edge Qtile Within a Virtualenv

For having been using GNOME for quite a long time, I was considering trying some tiling window managers to see what it's like a few weeks ago. Along the way, I found a nice window manager written in Python: Qtile, what interests me most is that it's a hackable window manager, which makes it flexible to extend or change its behaviors. Well, switching to use a tiling window manager is far simpler than I thought. [Read More]

How To Revert a Series of Git Commits?

Sometimes, I need to revert a series of commits that I've already pushed, doing a git hard reset (git reset --hard) is not an option, as someone may already have new commits based on mine. For example, assume that I've made a few commits like below: 65a2c62 * commit 10 25cad43 * commit 9 72ad583 * commit 8 ceebf9a * commit 7 acf8a11 * commit 6 28d526f * commit 5 63af1e2 * commit 4 982c71c * commit 3 0fb4c2d * commit 2 acf9da1 * commit 1 b5f9933 * commit 0 For whatever reason, I need to "drop" the changes made by commit 6 to commit 10, that is, go back to "commit 5" without deleting these commits. [Read More]
Git  Magit 

How to Rename Web Page Titles Easily

There are times that I need to open many web pages of some specific websites within a browser, and there are so many tabs that I can't efficiently access one of them, as their favicons are all the same. So I tried to find a way to rename their titles, preferably in a lightweight way, so that I can spot them quickly with my eyes. The first thought came into my mind was to find some browser extensions to do the job. [Read More]
Tools 

Generating org-mode Outlines for wikiHow Articles

Recently I found some great articles on wikiHow, then I want to keep notes of them in org-mode files. At first, I manually copied the ToC of articles, but soon I found it's tedious and takes a lot of time. Today I wrote a requests-based Python script to help me extract the ToCs (Table of Content) into org-mode outlines. It takes two arguments, the first one is the URL, the second one is the containing heading's level for the generated ToC in org-mode. [Read More]