undefined behavior

tb;dr - too boring; don’t read

Recent All Posts Categories Tags About Search

Setup Windows To Go in a Virtual Disk

Ramble It looks like I had a lot stories about this Windows boot setup. I figure this post would be the last one I write about it since this is the most commonly used case I have so far. So I got a Steam Deck last year. It’s pretty handy to use it as a mini PC in case I don’t have one in hands. However, there are still things exclusive on Windows but I don’t want to mess up with the internal SSD to dual-boot just for this temporary need.  Read on …

Perl Quick Reference

Preface Perl is a powerful tool to handle text processing. However, the learning curve might be steep due to some unusual syntax. I find myself even need to revisit the doc sometimes if I don’t use it often, so this post I’ll write down some commonly used patterns when it comes to text processing. That said this post is updated from time to time so remember to come back! When used as a command line tool, perl is powerful enough to replace traditional text processing tools like sed, awk, grep, tr etc.  Read on …

Moving from Arch Linux to NixOS

I’ve been learning Nix for a while and using the Nix package manager on my work desktop that runs Ubuntu. However, I did not use the NixOS on my personal laptop because I thought I might put a lot effort after work to set it up, which I didn’t really want to. Until recent, the Arch dependencies broke again and I felt it kinda suck to fix those issues so I decided to give Nix a try.  Read on …

ANSI Escape Code Collection

The information in this collection is from Internet, which is collected for my personal convenience. CSI sequences Code Name Effect CSI n A CUU – Cursor Up Moves the cursor n (default 1) cells in the given direction. If the cursor is already at the edge of the screen, this has no effect. CSI n B CUD – Cursor Down CSI n C CUF – Cursor Forward CSI n D CUB – Cursor Back CSI n E CNL – Cursor Next Line Moves cursor to beginning of the line n (default 1) lines down.  Read on …

[Archive] Multiboot USB

Boot from any ISO file Hybrid UEFI GPT + BIOS MBR/GPT boot Preparation Create 3 partitions on a removable USB stick. A BIOS boot partition (gdisk type code EF02, or GUID 21686148-6449-6E6F-744E-656564454649) with no filesystem. This partition can be put in any place on the disk but it is recommended to put it at the begginning from sector 34 to 2047. At minimal 1 MiB. An EFI System partition (gdisk  Read on …

Different Ways to Write a Major Mode

This post mainly helps myself remember how to quickly write a major mode. My memory is getting worse. So sad. :( Use define-derived-mode Doc: https://www.gnu.org/software/emacs/manual/html_node/elisp/Derived-Modes.html This perhaps the most common way to write a major mode. Most of the times I derive from fundamental-mode, or nil if the parent mode is not needed (a brand new mode). ;; With a parent mode (define-derived-mode foo-mode fundamental-mode "Foo" (do something)) ;; Or nothing (define-derived-mode foo-mode nil "Foo" (do something)) Here is the common pattern that I use.  Read on …

LSP Setup for Java

Update on <2023-06-07 Wed> Found a much easier way to configure this and tried again with the update-to-date lsp-java and it worked magically. Can’t recall why I had configuration issues before. Simply it would be: Make sure JDK 17 is installed (According to the requirement of lsp-java). Create a lib folder and put .jar files into it (or symlinks). See this issue. Run lsp-restart-workspace. Voila! Now LSP works as you would expect :).  Read on …

File-based Blog Management with ox-hugo

Background I previously wrote a post about managing blog posts with ox-hugo in org mode. I used to follow the recommendation to keep posts under org subtrees. As posts grew, I found that the opening speed is quite slow even I didn’t have many pictures inserted. Although managing the entire site within one file does have some convenience, the slowness is something I can’t bear. Also I feel it a  Read on …

Use lisp-data Files in Emacs

I found that there were few posts mentioning about using lisp-data files. However, it seems to be used widely in various packages. Emacs manumal has a very detailed description of how to read and write lisp objects. In this post I’ll mainly demonstrate one specific use case. Read from file The biggest challenge is to parse file content to Lisp lists. After a quick search with describe-function, read function is able to perfectly handle it in this case.  Read on …

Arch Linux on Laptop

I recently got my new laptop and I found that some additional tweaks need to be made for laptops. Thus, this post is to have a record in case I forget when I have to reinstall the system. Some basic setup Unlike desktop, laptops have to be secure so encrytion is a must. Details of how-to can be found on Arch wiki. I’m not going to go through that here. However, I’ll note down some considerations and things that need to pay attention to.  Read on …