Blogs

KMP Algorithm

KMP Algorithm In computer science, the Knuth-Morris-Pratt (KMP) string search algorithm is used to find the occurrence of a word W within a string S. The algorithm takes advantage of the fact that when a mismatch occurs, the word itself contains enough information to determine the next possible starting position for a match. This characteristic allows the algorithm to avoid rechecking previously matched characters.

Read more →

August 18, 2024

How to use ox-hugo

ox-hugo is a emacs plugin for hugo which can help us to use org in hugo. It will convert .org file to .md file.

Read more →

August 11, 2024

Zig Msgpack

MessagePack is an efficient binary serialization format. It lets you exchange data among multiple languages like JSON. But it’s faster and smaller. Small integers are encoded into a single byte, and typical short strings require only one extra byte in addition to the strings themselves.

Read more →

February 29, 2024

Call zig through FFI in Luajit

Recently, I have masterd the use of zig, and I accidentally saw an article about luajit’s FFI. FFI can call C function in lua, that inspired me, why not use zig? zig can compile dynamic library which not depend on libc, there will be no compatibility issues. So, I think this is available, let me try it!

Read more →

December 20, 2023

Handle Interrupt on x86-64 kernel with zig

On x86_64, if we want to handle interrupts, we need to define IDT(Interrupt Descriptor Table), it has 256 elements. And we also need to set IDTR(Interrupt Descriptor Table Register). In this article, we won’t discuss setting up IDT, that would be too long.

Read more →

November 12, 2023

Interrupt Function

Here’s what happens when you use the INT instruction to push on the stack: The CPU will query the interrupt vector table. Then push some context information onto the stack,like this:

Read more →

October 3, 2023

Debug QEMU with GDB

Recently I was writing a 32-bit kernel with zig, it is so useful, and when I develop it, I meet some situations where I need to use debugger. But now, zig doesn’t have official debugger. I tried bochs and qemu separately, Finally decided to use qemu. Qemu can debug with GDB remotely.

Read more →

April 30, 2023

Linux in Windows

Recently, I switch to windows, because nvidia’s support for linux is too poor, maybe usual using is ok, but when you shut down and check the system log, you will find many problems, such as slow shutdown, errors in the boot log. So, I’m back in the windows camp. After a short experience, I found that the linux container of windwos is relatively mature now, I install archlinux on wsl2, it works very well!

Read more →

April 4, 2023

Assembly in Zig

Recently, I want to write a kenel with zig, naturally we need to use assembly. When computer boot, we need to deploy with assembly so we can enter protected mode.

Read more →

April 1, 2023

Implement Disjoint-set Data Structure In Zig

In computer science, a disjoint-set data structure, also called a union–find data structure or merge–find set, is a data structure that stores a collection of disjoint (non-overlapping) sets. Equivalently, it stores a partition of a set into disjoint subsets. It provides operations for adding new sets, merging sets (replacing them by their union), and finding a representative member of a set. The last operation makes it possible to find out efficiently if any two elements are in the same or different sets.

Read more →

March 18, 2023

Implement tree and forest in zig

Recently, I review your knowledge about trees and forests, and now I try implement them in zig ! The full code can be found here !

Read more →

March 16, 2023

Implement KMP algorithm in zig

KMP called Knuth–Morris–Pratt string-searching algorithm, which is the first linear-time algorithm for string matching.

Read more →

March 11, 2023

Emacs Config

Recently, I learned emacs and elisp, this article records the problems I encountered during using.

Read more →

March 2, 2023

Try migrating to wayfire 2

I have already migrate to wayfire, but I also have some other minor issues when using.

Read more →

February 24, 2023

Try migrating to wayfire 1

Recently, I want to migrate to windows manager, and I attempt to leran wayfire. In the past, I have heard and tried wayfire, but I didn’t migrate to it because I need a GUI file manager. Now, I want to change my habit to adapt tui file manager for focusing on work. Another reason is that DE takes up too much memory and has some small bugs from time to time. So, I chose wayfire, a cascading window manager, not tiling, I prefer cascading to tiling.

Read more →

February 22, 2023

How to console in zig?

Zig is a general-purpose programming language and toolchain for maintaining robust, optimal and reusable software.

Read more →

February 19, 2023

Recommend plugins for gnome v43

GNOME is a completely free-form desktop environment. Target operating system is Linux, but mostly BSD based and also supports GNOME. GNOME is a group of contributors and contributors. This is the only one that has been developed, and based on this, it is an item that has been developed and has no problems.

Read more →

February 9, 2023

Configure Wordpress and Redis in Docker

The station has been transferred, and the original 4g small device has been transferred to the current 32g single-use top surface. php+redis+mysql), a caddy under external service. All in all,Containerized incense is complete! 😀

Read more →

February 9, 2023

Protect your vps!

Everyone connected to the internet is a target for hackers. The Most Incredible Cyber Attack Statistics of 2021 Find out the number of cyber attacks happening every day around the world.

Read more →

February 9, 2023