How to assert if Python enum contains specific string key or value

403 Uncategorized Leave a Comment
To assert if Python enum contains specific string key or value, we need helper function. class BaseEnum(Enum): @classmethod def has_name(cls, name): return name in cls._member_names_ @classmethod def has_value(cls, value): return value in cls._value2member_map_ class StatusEnum(str, BaseEnum): PUBLISHED = 1 PEN…

Copy and paste not working in VMWare Fusion

4.9k Uncategorized Leave a Comment
Confirm vmware tools had installed, if your vm is ubuntu, use: # ubuntu desktop $ apt install open-vm-tools-desktop open-vm-tools # ubuntu server: $ apt install open-vm-tools Turn on copy and paste Shut down the Virtual Machine, from the Menu select Virtual Machine -> Isolation -> Check Enable Copy and P…

ffmpeg common commands

401 Uncategorized Leave a Comment
Download video with .m3u8 link Download full video ffmpeg -i "https://this-is-your-url-of.m3u8" -c copy -bsf:a aac_adtstoasc "output.mp4" Download specific time range: ffmpeg -ss 04:05:25 -to 04:15:00 -i "https://this-is-your-url-of.m3u8" -c copy -bsf:a aac_adtstoasc "output-c…

How to quickly install and start Kafka

358 Uncategorized Leave a Comment
Install and start Kafka is quite simple even on you local computer. Maybe you are thinking it must need lots of dependencies, but the fact is, it only needs Java. No database, no complicate configuration are needed, so you also no need to install Docker to run it. How to install and start Kafka Following are so…

MySQL REGEXP_REPLACE() function

546 Uncategorized Leave a Comment
Notice: Corrently, REGEXP_REPLACE() do not support \s. Here is an example of using MySQL 8+ regexp_replace(): > select regexp_replace('<div>Hello <b>world</b></div>', '<b>.*?</b>', 'MySQL', 1, 0, 'in') as result; +---------------------…
« Previous Page   Next Page »