GPG forwarding over ssh on the fly
2020-12-27

I’ve been seeking for GPG solutions over server side VS client side for a while. It’s so hard to leverage multiple gpg session at the same especially over ssh.

Fortunately, I realized there is a built-in feature call GPG forwarding that allows you to authorize the server side request in the client side.

> GPG forwarding

The idea is to forward your client sidse GPG socket to your server side, so that every time you trigger a GPG authentication in server side, it can pop the GPG authentication GUI (pinentry program) in your local machine.

Overall experience with BSPWM and polybar
2020-04-03

> First time with tiling window manager

I have to say BSPWM is not that friendly for the first-time user. It comes with a blank screen without anything. While you could something there by forking something’s setup. But it might not working for you cuz it’s really easy to break some dependencies on your system.

I would recommend you to start with something like Awesome tiling window manager. It comes with more built-in features. But I think overall BSPWM is a good fit for me. Polybar is supported in BSPWM and the keybinding system is clean.

I forked Henrik Lissner’s dotfiles setup last year. So thanks for the amazing scripts that manage all the binaries and dependencies across multiple OS.

FZF all your projects in terminal
2019-02-25

How you navigate to your projects in terminal? cd? ranger? nnn? t a Well, these are not desinged for navigating projects and they really do their jobs but not so efficient.

Let me introduce the fzf_projects.

First, you need to install fzf. Simply go through the tutorial here.

Second, put the following code in your shell configuration file.

Note: project_roots is a list of directories that projects inside within depth 1 will be added as projects candidates. developer_root is a directory that project inside within depth 2 will be added.

Automatically scan your magit repos
2019-02-25

projectile is amazing. It helps people to quickly switch between projects. Unfortunatelly, it cannot automatically scan the projects on your machine and load them when you first time fire projectile.

Also, it doesn’t really remove those invalid project entires for me. For example, there is a git projcet under ~/Developer/dummy-git and I move this projcet to ~/Developer/new-git. Both entires will exists every time I trigger M-x counsel-projectile-switch-project (or helm-projectile). It makes me confused sometimes.

Here is the solution. For me, basically I every project I created is by git. So I utilzed the magit-list-repos-1 func in magit. For those of you use other source control tool or .projectile in your project, you might need to find the corresponding func or write your own.

git
Hack your Linux machine to use two network connections simultaneously
2019-01-10

A lot of people have this working scenario during their daily work. They are assigned with a linux machine. Generally, the guest/public network is better for them to browse the outside world, while they have to connect to the intranet inside the company for specific tasks, e.g. source control and data management. I’m one of them and I just come across a solution for this.

It’s basicly just hacking your IP kernel, adding rules for your intranet. Now let’s get started.

Your probably need to install the net-tools before getting started. In ubuntu, you can use sudo apt install net-tools.

Spell checking with Cspell in Emacs
2018-11-05
No Post Excerpt
A simple tweak to help you edit minified files in Emacs
2018-07-01

Emacs “stucks” at editing long line files. It does but that’s not Emacs’s fault. Emacs has excellent gap buffer for large file editing. It’s due to the mode you apply to the file. These modes might freeze your Emacs when editing large file or minified files.

> Check Minified files

So here is a simple trick, I just check the first 30 line of the opened file. If first line is over 1000 in width, then it just enable fundamental-mode which works perfectly for these files.

;; if the first line is too long, enable fundamental by default
(defun get-nth-line-length (n)
"Length of the Nth line."
(save-excursion
(goto-char (point-min))
(if (zerop (forward-line (1- n)))
(- (line-end-position)
(line-beginning-position)))))

(defun +my/check-minified-file ()
(and
(not (member (file-name-extension (buffer-file-name))
'("org" "md" "markdown" "txt" "rtf")))
(cl-loop for i from 1 to (min 30 (count-lines (point-min) (point-max)))
if (> (get-nth-line-length i) 1000)
return t
finally return nil)))

(add-to-list 'magic-mode-alist (cons #'+my/check-minified-file 'fundamental-mode))
Spacemacs/Space-Vim Config for Jetbrain IDEs
2018-06-11

> Another Spacemacs configuration for Jetbrain IDEs

Recently, I’m working on a React Native project. I have tried using Emacs to do the coding, but I cannot really pick up the whole new stuff without a fancy auto-completion or finding definitions since the syntax of React is so different and special. That’s why I pick up Webstorm as a workaround. And there, I find a way to build my Jetbrain IDEs just like Spacemacs.

Like I said in my previous post, space way is good for Vim users and only Vim can do this because it has other modes other than just insert mode. In this case, key bindings will never be a problem. We are using the sticky key sequences and prefix key for memorization.

Welcome to the heaven!!!

With 1% effort to build 99% working Hackintosh
2018-04-02
mac

This is my 2017 Hackintosh build. I was using GTX 970 before but I just switch to Vega 64 recently. And it works out of box!!! That’s the key to the whole build. With Vega GPU, you don’t have to worry about tricky bugs any more. We just need to set up a clean build.

> Parts list