sys.path in Python
Here is the process how sys.path
is set in Python, with some parts omitted.
Python Command Line Arguments #
By default, as initialized upon program startup, a potentially unsafe path is prepended to sys.path
:
Here is the process how sys.path
is set in Python, with some parts omitted.
By default, as initialized upon program startup, a potentially unsafe path is prepended to sys.path
:
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.g. pkg.mod), while import() returns the top-level package or module (e.g. pkg). – https://docs.python.org/3/library/importlib.html#importlib.import_module
I bought a iPod Video 5.5th Gen 80G recently. It’s only 200 Yuan (about $30) and I’m satisfied with it.
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. It also support theme and plugin, which makes it more powerful.
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.
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.
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.
The line ending on Windows is CRLF
, on Linux is LF
. To prevent the line ending issue, we can set core.autocrlf
to true
on Windows to let git convert CRLF
to LF
when commit, and convert LF
to CRLF
when checkout. It is automatically configured if you install git on Windows.
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? Here are some approaches.
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. Some views does not close multiprocessing.Pool
after using it. The problem disappears when I use Pool
with with
statement.
This setting makes it possible to switch input method based on the context of cursor when entering insert mode.
I’m using sis
package with this configuration. You may need to install macism
if you’re not using railwaycat/emacsmacport
. More settings can be found in emacs-smart-input-source.
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. Here are the advantages and disadvantages.