Skip to main content

Posts

2024


__import__ in Python

·2 mins
It’s known that Python’s import statement is implemented by __import__ function. In general, if we want to import a module dynamically, we can use import_module function, which is a wrapper around __import__. The most important difference between these two functions is that import_module() returns the specified package or module (e.

2023


iPod Video Review

·4 mins
I bought a iPod Video 5.5th Gen 80G recently. It’s only 200 Yuan (about $30) and I’m satisfied with it. Rockbox #The original firmware supports few audio format, it even can’t play FLAC. I install rockbox on it, which support FLAC and other format and I can transfer music without using iTunes or Finder.

Improve Git speed in WSL

·2 mins
The disk performance in WSL2 is poor, it takes a long time to run git status in a host’s repo. Moreover, if you set a fancy shell prompt, it will take a long time to show the prompt. This article will introduce how to speed up Git in WSL2.

Python 3.11 changes

·4 mins
In [Packaging] Support Python 3.11 by bebound · Pull Request #26923 · Azure/azure-cli (github.com) , I bumped azure-cli to use Python 3.11. We’ve bump the dependency in other PRs, I thought it should be a small PR, but in the end, a lot of changes are made.

Line Ending in Git

·3 mins
When working on a project with multiple developers, the line ending can be troublesome. This article will explain how to configure line ending in Git. Basic configuration #The line ending on Windows is CRLF, on Linux is LF. To prevent the line ending issue, we can set core.

How to copy files temporarily in Dockerfile

·2 mins
It’s very common to copy a local file into the container when build docker image. In general, we use COPY command. But it creates a new layer and increase the final image size. If this is a temporal file and we don’t want users waste their storage space, how can we remove it?

2022


Memory Leak in Python multiprocessing.Pool

·4 mins
There is a historical memory leak problem in our Django app and I fixed it recently. As time goes by, the memory usage of app keeps growing and so does the CPU usage. After some research, I figure out the cause.

Emacs Chinese-related Settings

·1 min
Auto Switch Input Method in Evil #This setting makes it possible to switch input method based on the context of cursor when entering insert mode. sis #I’m using sis package with this configuration. You may need to install macism if you’re not using railwaycat/emacsmacport.

QNAP TS-453Dmini Review

·3 mins
My first NAS is Synology DS120j, which is ARM based entry level product. It’s okay to use it for downloading and backup, but not power enough for running docker and virtual machine. So I bought this NAS last month, and I’m satisfied with it.

Internet Account Keeps Coming Back after deletion on MacOS

·1 min
Today I tried to delete an inactive Internet account on system preference. It was deleted successfully but come back again after 20 seconds. This drives me nuts. I tried these methods, but none of them works. Boot in safe mode, delete account.