String Manipulation in Clojure

Python string APIs are powerful and concise, that is an important reason I use it to do a lot of scripting these days, join, split, strip, to name a few. Since I am learning Clojure recently, I am wondering, how is string manipulation like in Clojure and how to implement equivalent ones? I think it's an excellent opportunity to get familiar with Clojure. Before diving into the implementation, how to declare a multi-line string? [Read More]

Send Notifications from Emacs with i3wm and Dunst

I barely use notifications, but recently I think it's a valuable way to remind me things like helping me nurture habits, or to notify me of emergencies like a critically low laptop battery. So I try to integrate notifications to org-mode and Emacs today. The org-notify package from org-contrib (install it by (package-install 'org-contrib) ) could do this job easily before, so I first test it in the minibuffer with (org-notify "test"). [Read More]

A Random Password Generator in Babashka

I'm used to learning by practicing, so when I learned Clojure, I always kept an eye on chances to write code in it. Scripting is an excellent field to practice, but the experience is not so good. On the one hand, it's too hacky to wrap Clojure code in a shell script with the shell bang. On the other hand, the startup time of JVM is too long to hurt the user experience. [Read More]

An Online Python re.findall Service

As a programmer, I know that grep, sed and awk are powerful for processing text, but they sometimes aren't that straight-forward for specific tasks, as I need to think about how to filter the lines and the columns out. So I wonder if there is a handy way to do these tasks? After using it for a while, I think using regex directly can help, so I launched a re. [Read More]

Generate Call Graphs Using Doxygen in Emacs

Doxygen is a nice tool for generating documentations for well-annotated C/C++ projects, the one feature that I like most is generating call graphs and class diagrams, so that I can learn a project quickly by browsing the diagrams from a higher point of view. I take the following steps to generate call graphs for a project on terminals on Linux: cd /path/to/a/project/, and generate a template config file by doxygen -s -g doxygen. [Read More]
Emacs 

Is It Safe to Use Redis As a Data Store?

Traditionally we are used to storing data in an RDBMS like MySQL, and avoid using in-memory solutions such as Redis, to have a confidence of no data loss. Sometimes I find that we are so stubborn with MySQL that ending up with a complicated design, and I've even seen a solution that stores data in MySQL and then using Redis as a cache for it to improve read performance in the meanwhile. [Read More]
Redis  MySQL 

A Trick to Troubleshoot Emacs Subprocess Creating

There are many packages of Emacs that leverage subprocesses to do their jobs, Magit, eglot, elpy, to name a few. And there are times that a subprocess doesn't work as expected, for example, Magit is slow, and you're sure that it's ok when running git commands on shell. So how to spot these problems effectively and quickly? The problem is that we don't know what's going on exactly, so here I want to share a few Elisp advices to make the subprocess creating visible, and print the exact program and its arguments to the *Message* buffer. [Read More]

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]