Author Archives: Huang Shiyang

在 Linux 虚拟机上格式化和装载非启动磁盘

如果您将新的空白磁盘挂接到虚拟机,则必须先格式化并装载磁盘,然后才能使用磁盘。如果挂接的磁盘已包含数据,则必须先装载该磁盘,然后才能使用它。 准备工作 连接到虚拟机 在 Linux... Read More | Share it now!

redis.exceptions.connectionerror: max number of clients reached

https://www.dragonflydb.io/error-solutions/redis-exceptions-connectionerror-max-number-of-clients-reached This error is caused when the maximum number of clients that Redis can handle has been reached. By default, Redis allows a maximum of 10,000... Read More | Share it now!

golang contains

Starting with Go 1.18, you can use the slices package – specifically the generic Contains function: https://pkg.go.dev/golang.org/x/exp/slices#Contains. Note that since this is outside the stdlib as an experimental package,... Read More | Share it now!

Flatbuffers Install

https://stackoverflow.com/questions/55394537/how-to-install-flatc-and-flatbuffers-on-linux-ubuntu solution for flatc and flatbuffers for linux ubuntu : choice “folder for installation” cd “folder for installation” git... Read More | Share it now!

CURL with time printed

cURL supports formatted output for the details of the request (see the cURL manpage for details, under -w, –write-out <format>). For our purposes we’ll focus just on the timing details that are provided. Times below are... Read More | Share it now!

uWSGI缓存框架

https://uwsgi-docs-zh.readthedocs.io/zh_CN/latest/Caching.html uWSGI包含了一个非常快速、全内存访问、零IPC、SMP安全、不断优化、高度可调的、键值存储的简单的“缓存框架”。单个uWSGI实例可以使用不同的设置,出于不同的目的,创建无限个不同的“缓存”。 创建一个“缓存” 要创建一个缓存,你可以使用 --cache2 选项。它接收指定缓存选项的参数字典。要有一个有效的缓存,你需要指定它的名字,以及它可以包含的项的最大数目。 uwsgi... Read More | Share it now!

How to trigger a Kubernetes cronjob manually

What should you do when you’ve developed and installed a cron job for your Kubernetes application, and you need to test it? When writing classic cron jobs in Unix, it’s obvious how to test the job- just manually run the command specified in the... Read More | Share it now!

python终止线程

可以通过以下方式来终止线程: 通过抛出异常来终止进程 通过一个终止标志来终止进程 使用traces来终止进程 使用多线程模型来终止进程 通过将进程设置为deamon来终止进程 使用隐藏属性_stop() 通过抛出异常来终止进程 运行以上程序,一旦raise_exception()被调用,run()函数将被终止。这是因为程序抛出异常,将不在try…finally…函数块中运行,run()函数即被终止。 2.通过一个终止标志来终止进程 以上代码中,一旦全局变量stop_threads被置位,run()函数将终止,对应t1线程将因为t1.join()被终止。如果不使用全局变量,可以采用下面方式。 上面代码中传递的函数对象始终返回局部变量stop_threads的值。... Read More | Share it now!

python2 python3 hash() function

python2 的hash function是固定值 python3的hash function每次重启都不一样的值 用py27hash.hash 库来进行python2的hash。 ... Read More | Share it now!

htop

Most people familiar with Linux have used the top command line utility to see what process is taking the most CPU or memory. There’s a similar utility called htop that is much easier to use for normal tasks. The first great thing about htop... Read More | Share it now!