随笔分类 - Code
摘要:Code-Python-ConvertUTF-8ToUTF-8WithBom UTF-8 With Bom 与 UTF-8 格式相比,文件开头多3个字节\xef\xbb\xbf 转换方案 在文件首,写入二进制b\xef\xbb\xbf 使用utf-8-sig,重新保存文件 Demo: def is_
阅读全文
摘要:Code-C++-ThreadPool-BS::thread_pool-单例 https://github.com/bshoshany/thread-pool.git https://gitcode.com/gh_mirrors/th/thread-pool BS::thread_pool GitH
阅读全文
摘要:Code-C++-regex C++ 正则表达式 regex #include <regex> std::regex; std::smatch; regex_replace();
阅读全文
摘要:Code-Logger-替换标准输出和标准错误,并通过宏使能输出 需求:替换标准输出和标准错误,并通过宏使能输出 class Logger #ifndef ENABLE_LOGS #define ENABLE_LOGS 1 // 设置为1表示启用日志输出,0则禁用 #endif #include <
阅读全文
摘要:Code-OpenMP openmp home OpenMP 入门指南 - 离心的文章 - 知乎 以下转自OpenMP 入门指南 - 离心的文章 - 知乎 OpenMP 入门指南 OpenMP是由OpenMP Architecture Review Board牵头提出的,并已被广泛接受,用于共享内存
阅读全文
摘要:Code-C++-字符串分割 转自【C++中string如何实现字符串分割函数split()——4种方法 - CSDN App】http://t.csdnimg.cn/8iWb7 stringstream getline() string find() substr() c char strtok(
阅读全文
摘要:Code-C++-chrono to tm (format time) std::chrono::system_clock::time_point now = std::chrono::system_clock::now(); std::time_t now_time_t = std::chrono
阅读全文
摘要:Code-C++-Snowflake #include <iostream> #include <chrono> #include <stdexcept> class Snowflake { private: // 雪花算法的各个参数 static constexpr int64_t workerI
阅读全文
摘要:# Code-OpenSource-JSON for Modern C++ v3.10.5 github.com/nlohmann/json https://json.nlohmann.me/home/exceptions/#version-history https://json.nlohmann
阅读全文
摘要:#Code-C++-Linux-统计一个文件夹占据空间大小 https://my.oschina.net/Tsybius2014/blog/330628 从以上链接中拷贝的代码 #include <stdio.h> #include <sys/stat.h> #include <sys/types.
阅读全文
摘要:#Code-C++-Linux-利用condition_variable封装event C++11使用condition_variable加上mutex封装event类,实现等同于windows的事件功能。 从网上百度到的以下代码实现,具体网址搞丢了。 #include <iostream> #in
阅读全文
摘要:#Code-C++-Linux-获取时间time()/localtime()/gettimeofday() #include <iostream> //#include <time.h> #include <sys/time.h> //for gettimeofday() #include <str
阅读全文
摘要:#Code-C++-fstream-输出到文件 利用fstream文件流输出 利用stat查看文件大小 设定文件最大值宏定义 #include <fstream> #include <string> #include <sys/stat.h> #include <iostream> #define
阅读全文
摘要:Code-C++ Invoke Python https://www.cnblogs.com/yongchao/p/17299892.html 使用 C 或 C++ 扩展 Python 扩展和嵌入 Python 解释器 Python 3.10.11 Python/C API 参考手册 Python
阅读全文
摘要:正则表达式-菜鸟教程 转自正则表达式,菜鸟教程 正则表达式(Regular Expression)是一种文本模式,包括普通字符(例如,a 到 z 之间的字母)和特殊字符(称为"元字符")。 正则表达式使用单个字符串来描述、匹配一系列匹配某个句法规则的字符串。 简单示例 ^[0-9]+abc$ ^ 为
阅读全文
摘要:正则表达式-30分钟入门教程 参考 正则表达式30min入门教程,菜鸟教程 在线测试工具: 菜鸟工具 RegexBuddy,付费 常用的元字符 代码 说明 ^ 匹配字符串的开始 $ 匹配字符串的结束 . 匹配除换行符以外的任意字符 \w 匹配字母或数字或下划线或汉字 \s 匹配任意的空白符 \d 匹
阅读全文
摘要:正则表达式-常用正则表达式 常用正则表达式 一、校验数字的表达式 数字:^[0-9]*$ n位的数字:^\d{n}$ 至少n位的数字:^\d{n,}$ m-n位的数字:^\d{m,n}$ 零和非零开头的数字:^(0|[1-9][0-9]*)$ 非零开头的最多带两位小数的数字:^([1-9][0-9]
阅读全文
摘要:#C++-Code-Time Transfer-Windows FILETIME(1601) To 1970 UTC November 28, 2020 4:56 PM 最近遇到需要进行时间转换的实现。 以下是从mongoose.c中截取的,与之后在网上找到的思路是一致的。 Function dou
阅读全文
摘要:#Code-C++-Get local IP September 30, 2020 1:17 PM ##使用Windows Socket API 库:wsock32.lib 头文件: winsock.h wsipx.h wsnwlink.h stdio.h 涉及函数: gethostname get
阅读全文
摘要:#Code-OPC DA- OPC Client Code Demo 摘自 A very simple OPC Client: the code https://lhcb-online.web.cern.ch/ecs/opcevaluation/opcclienttutorial/SimpleCli
阅读全文

浙公网安备 33010602011771号