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!
Author Archives: Huang Shiyang
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!
Fakeapp
参考文章 https://jingyan.baidu.com/article/414eccf68706766b431f0af4.html 首先确认自己的机器能不能带的动fakeapp,显卡的显存要达到4GB,因为al换脸软件对GPU要求很高,显存低于4GB的话可能会带不起来软件的。内存要求至少要8GB,如果你的机器内存少于8GB,建议再加个内存条。 然后我们开始下载软件和相关的插件,首先下载fakeapp,在网上搜索就能下载,但是不是这一个软件就可以al换脸的,不然直接打开软件会提示你需要安装插件不能使用。然后我们搜索下载安装cuda9.0。 下载地址:https://developer.nvidia.com/cuda-90-download-archive 然后在网上下载core文件然后解压缩在fakeapp的目录里面,还需要下载vc++算法程序,一般来说系统自己会带有的。然后打开命令指示符,输入pip... Read More | Share it now!
k6
Installation Linux Debian/Ubuntu ⚠️ If you are behind a firewall or proxy There have been reports of users being unable to download the key from Ubuntu’s keyserver using apt-key command due to firewalls or proxies blocking... Read More | Share it now!