How to Deploy a Secure Transparent Gateway

Background After moving house, there are many more devices at home that need internet access. However, I don’t want to configure a proxy on each device, so I thought of using a transparent gateway. Transparent Gateway After some research, I found that the easiest way is to use the premium version of Clash, although I didn’t know when Clash released a premium version. I mainly referred to this article. It’s much simpler than setting up iptables. ...

October 12, 2022 · 3 min · 499 words · Jack Yu

How to Set Up a Minecraft Bedrock Server Using Multipass

Background Recently, both of my kids have become interested in Minecraft, and some of their peers are also playing it. We previously bought the Switch version, but its online capabilities are quite poor, and the device performance is subpar, resulting in a less-than-ideal experience. Thus, I began considering the idea of setting up our own server. Of course, you can play in multiplayer with friends, but the game ends as soon as the host goes offline, which is not as good as having a server that is always online. ...

May 2, 2022 · 5 min · 894 words · Jack Yu

How to Create GitHub Verified Commits on a MacBook M1

Background One day, I impulsively turned on GitHub’s Vigilant mode. As a result, all my commits started looking like this. To figure out how to make them Verified, I found the following method. Method I actually referred to this link. However, it wasn’t quite enough, as there might be authentication-related issues on MacBooks that lead to commit errors. So, I found this solution. In summary, to verify, you need to enter a password. The issue on a Mac is the prompt for entering the password, which needs to be replaced with pinentry-mac, which most people install via homebrew. ...

February 12, 2022 · 1 min · 204 words · Jack Yu

How to Play Minecraft (Bedrock Edition) Cross-Platform

Background During the Chinese New Year holiday, I spent some time at home playing on the Switch with my child, and I ended up purchasing Minecraft (Bedrock Edition). In order to play together, I also bought the Windows version. Additionally, I wanted to test if the GitHub Actions for this blog are still working properly. Preparation You need two Microsoft accounts, so I dug out my wife’s long-unused Hotmail account. ...

February 3, 2022 · 1 min · 140 words · Jack Yu

How to Compare Data Consistency between MySQL and PostgreSQL

Background Recently, I encountered a problem where a user wanted to synchronize data from PostgreSQL to TiDB (which uses the same protocol as MySQL) and wanted to know whether the data after synchronization is consistent. I hadn’t dealt with this kind of issue before, so I did a bit of research. Typically, to verify data consistency, you compute a checksum on both sides and compare them. TiDB (MySQL) Side For the verification of a specific table, the following SQL is used: ...

May 9, 2021 · 3 min · 461 words · Jack Yu

How to Configure a Chinese LaTeX Environment on Windows

Background Initially, I didn’t think this was something worth writing about, because CTex was previously working smoothly for everyone. However, it turns out that CTex hasn’t been updated since 2016. So, I wanted to find a replacement for Chinese LaTeX on Windows in 2021. Configuration Method Install MiKTeX (TexLive should work as well). MiKTeX can automatically download dependency packages and you can also proactively install the ctex package. Install the VSCode LaTeX extension. Configure the LaTeX extension. I found a powerful configuration on Zhihu, but it’s quite complex, so I simplified it a bit. A brief explanation: the core components here are the recipes and tools. Tools are the compilation toolchain, specifying which tools to use for compilation and the options to use, without regard to order. Recipes define how to combine the above tools to generate the final document, where the order does matter. I’ve put XeLaTex first here because it’s the most compatible for compiling Chinese. If you use pdflatex to compile Chinese documents, you’re likely to encounter issues. ...

March 31, 2021 · 3 min · 455 words · Jack Yu

How to Automatically Publish a Blog Using GitHub Actions

In this post, I used Travis to enable automatic blog publishing. However, I recently discovered that Travis does not run automatically anymore (though it works manually). I haven’t looked into it closely because GitHub Actions have been introduced, so I decided to move all dependencies to GitHub. Go Action Click on Actions on the repository page, and then New Workflow to see recommended actions. Since this blog uses Go code, it shows the Go Action. ...

December 16, 2020 · 2 min · 331 words · Jack Yu

How to Implement a Simple Load Using Sysbench

Sysbench is a tool commonly used in database testing. Since version 1.0, it has supported more powerful custom functions, allowing users to conveniently write some Lua scripts to simulate load. The purpose of writing this article is, firstly, because I wanted to explore Sysbench’s custom load usage. Secondly, because I tried the mysqlslap tool provided by MySQL’s official source, and found that it freezes easily during database performance testing, which could mislead users into thinking there is an issue with the database, causing trouble for many. Therefore, I want to help people avoid these pitfalls. ...

December 14, 2020 · 3 min · 499 words · Jack Yu

How to Read TiDB Source Code (Part 5)

When using TiDB, you may occasionally encounter some exceptions, such as the “Lost connection to MySQL server during query” error. This indicates that the connection between the client and the database has been disconnected (not due to user action). The reasons for disconnection can vary. This article attempts to analyze some common TiDB errors from the perspective of exception handling and code analysis. Additionally, some exceptions are not errors but performance issues due to slow execution. In the second half of this article, we will also introduce common tools for tracking performance. ...

September 8, 2020 · 5 min · 892 words · Jack Yu

How to Read TiDB Source Code (Part 4)

This article will introduce some key functions and the interpretation of logs in TiDB. Key Functions The definition of key functions varies from person to person, so the content of this section is subjective. execute The execute function is the necessary pathway for text protocol execution. It also nicely demonstrates the various processes of SQL handling. ParseSQL analyzes the SQL. The final implementation is in the parser, where SQL is parsed according to the rules introduced in the second article. Note that the parsed SQL may be a single statement or multiple statements. TiDB itself supports the multi-SQL feature, allowing multiple SQL statements to be executed at once. ...

July 31, 2020 · 9 min · 1867 words · Jack Yu