Mar 13, 2024
· 7 minute read
·
linuxRamble
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 … Nov 13, 2023
· 19 minute read
·
codingPreface
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!
Read on … Oct 29, 2023
· 6 minute read
·
linuxI’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. To my suprise, the installation process is way simpler than I expected.
Read on … Aug 27, 2023
· 5 minute read
·
softwareThe 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. (not ANSI.SYS) |
CSI n F | CPL – Cursor Previous Line | Moves cursor to beginning of the line n (default 1) lines up. (not ANSI.SYS) |
CSI n G | CHA – Cursor Horizontal Absolute | Moves the cursor to column n (default 1). (not ANSI.SYS) |
CSI n ; m H | CUP – Cursor Position | Moves the cursor to row n, column m. The values are 1-based, and default to 1 (top left corner) if omitted. A sequence such as CSI ;5H is a synonym for CSI 1;5H as well as CSI 17;H is the same as CSI 17H and CSI 17;1H |
CSI n J | ED – Erase in Display | Clears part of the screen. If n is 0 (or missing), clear from cursor to end of screen. If n is 1, clear from cursor to beginning of the screen. If n is 2, clear entire screen (and moves cursor to upper left on DOS ANSI.SYS). If n is 3, clear entire screen and delete all lines saved in the scrollback buffer (this feature was added for xterm and is supported by other terminal applications). |
CSI n K | EL – Erase in Line | Erases part of the line. If n is 0 (or missing), clear from cursor to the end of the line. If n is 1, clear from cursor to beginning of the line. If n is 2, clear entire line. Cursor position does not change. |
CSI n S | SU – Scroll Up | Scroll whole page up by n (default 1) lines. New lines are added at the bottom. (not ANSI.SYS) |
CSI n T | SD – Scroll Down | Scroll whole page down by n (default 1) lines. New lines are added at the top. (not ANSI.SYS) |
CSI n ; m f | HVP – Horizontal Vertical Position | Same as CUP |
CSI n m | SGR – Select Graphic Rendition | Sets the appearance of the following characters, see SGR parameters below. |
CSI 5i | AUX Port On | Enable aux serial port usually for local serial printer |
CSI 4i | AUX Port Off | Disable aux serial port usually for local serial printer |
CSI 6n | DSR – Device Status Report | Reports the cursor position (CPR) to the application as (as though typed at the keyboard) ESC[n;mR, where n is the row and m is the column.) |
CSI s | SCP – Save Cursor Position | Saves the cursor position/state. |
CSI u | RCP – Restore Cursor Position | Restores the cursor position/state. |
Some popular private sequences
Code | Effect |
---|
CSI ? 25 h | DECTCEM Shows the cursor, from the VT320. |
CSI ? 25 l | DECTCEM Hides the cursor. |
CSI ? 1049 h | Enable alternative screen buffer |
CSI ? 1049 l | Disable alternative screen buffer |
CSI ? 2004 h | Turn on bracketed paste mode. Text pasted into the terminal will be surrounded by ESC [200~ and ESC [201~, and characters in it should not be treated as commands (for example in Vim).[20] From Unix terminal emulators. |
CSI ? 2004 l | Turn off bracketed paste mode. |
SGR parameters
Code | Effect | Note |
---|
0 | Reset / Normal | all attributes off |
1 | Bold or increased intensity | |
2 | Faint (decreased intensity) | |
3 | Italic | Not widely supported. Sometimes treated as inverse. |
4 | Underline | |
5 | Slow Blink | less than 150 per minute |
6 | Rapid Blink | MS-DOS ANSI.SYS; 150+ per minute; not widely supported |
7 | reverse video | swap foreground and background colors |
8 | Conceal | Not widely supported. |
9 | Crossed-out | Characters legible, but marked for deletion. |
10 | Primary(default) font | |
11–19 | Alternative font | Select alternative font {\displaystyle n-10} {\displaystyle n-10} |
20 | Fraktur | Rarely supported |
21 | Doubly underline or Bold off | Double-underline per ECMA-48.[22] See discussion |
22 | Normal color or intensity | Neither bold nor faint |
23 | Not italic, not Fraktur | |
24 | Underline off | Not singly or doubly underlined |
25 | Blink off | |
27 | Inverse off | |
28 | Reveal | conceal off |
29 | Not crossed out | |
30–37 | Set foreground color | See color table below |
38 | Set foreground color | Next arguments are 5;n or 2;r;g;b, see below |
39 | Default foreground color | implementation defined (according to standard) |
40–47 | Set background color | See color table below |
48 | Set background color | Next arguments are 5;n or 2;r;g;b, see below |
49 | Default background color | implementation defined (according to standard) |
51 | Framed | |
52 | Encircled | |
53 | Overlined | |
54 | Not framed or encircled | |
55 | Not overlined | |
60 | ideogram underline or right side line | Rarely supported |
61 | ideogram double underline or double line on the right side | Rarely supported |
62 | ideogram overline or left side line | Rarely supported |
63 | ideogram double overline or double line on the left side | Rarely supported |
64 | ideogram stress marking | Rarely supported |
65 | ideogram attributes off | reset the effects of all of 60–64 |
90–97 | Set bright foreground color | aixterm (not in standard) |
100–107 | Set bright background color | aixterm (not in standard) |
Color code
Color | Foreground | Background |
---|
Black | \u001b[30m | \u001b[40m |
Red | \u001b[31m | \u001b[41m |
Green | \u001b[32m | \u001b[42m |
Yellow | \u001b[33m | \u001b[43m |
Blue | \u001b[34m | \u001b[44m |
Magenta | \u001b[35m | \u001b[45m |
Cyan | \u001b[36m | \u001b[46m |
White | \u001b[37m | \u001b[47m |
Bright Black | \u001b[30;1m | \u001b[40;1m |
Bright Red | \u001b[31;1m | \u001b[41;1m |
Bright Green | \u001b[32;1m | \u001b[42;1m |
Bright Yellow | \u001b[33;1m | \u001b[43;1m |
Bright Blue | \u001b[34;1m | \u001b[44;1m |
Bright Magenta | \u001b[35;1m | \u001b[45;1m |
Bright Cyan | \u001b[36;1m | \u001b[46;1m |
Bright White | \u001b[37;1m | \u001b[47;1m |
Reset | \u001b[0m | \u001b[0m |
Read on … Aug 27, 2023
· 1 minute read
·
linuxBoot 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 type code
EF00
) with a FAT32 filesystem. This partition can be as small as 50 MiB but it is better to set at least 256 MiB (550 MiB recommended). - Data partition (use a filesystem supported by GRUB). This partition can take up the rest of the space of the drive.
GRUB Installation
Mount EFI and data partitions.
First install GRUB for UEFI:
Read on … Mar 16, 2023
· 3 minute read
·
emacsThis 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))
Read on …
Feb 18, 2023
· 4 minute read
·
coding
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 …
Nov 15, 2022
· 2 minute read
·
emacs
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.
Read on …
Nov 14, 2022
· 2 minute read
·
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 …
Nov 8, 2022
· 7 minute read
·
linux
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 …