摘要: #include <atomic> #include <functional> #include <iostream> #include <macro.h> #include <memory> #include <mutex> #include <string> class Noncopyable 阅读全文
posted @ 2022-01-26 11:11 JohnRed 阅读(32) 评论(0) 推荐(0) 编辑
摘要: ps_grep() { echo "$(ps|grep -v "grep"|grep "$1"|awk '{print $1}')" } 阅读全文
posted @ 2020-11-17 16:40 JohnRed 阅读(214) 评论(0) 推荐(0) 编辑
摘要: ###docker配置国内镜像源 修改/etc/docker/daemon.json(文件不存在,新建一个) { "registry-mirrors": ["https://alzgoonw.mirror.aliyuncs.com"] } ###docker服务 //重启服务 systemctl r 阅读全文
posted @ 2020-09-24 10:40 JohnRed 阅读(98) 评论(0) 推荐(0) 编辑
摘要: arr_host=("abc" "123" "tom") find_value="abc" ###方法1 res=$(echo "${arr_host[@]}" | grep -wq "${find_value}" && echo "yes" || echo "no") ###方法2 if [[ " 阅读全文
posted @ 2020-08-14 16:17 JohnRed 阅读(2365) 评论(0) 推荐(0) 编辑
摘要: ``` //writetofile.h #ifndef WRITE_TO_FILE_H #define WRITE_TO_FILE_H #ifndef WRITE_TO_FILE #define WRITE_TO_FILE #endif #ifdef WRITE_TO_FILE #ifdef __ANDROID__ #define WRITE_TO_PATH "/sdcard" #else #de 阅读全文
posted @ 2020-04-15 09:50 JohnRed 阅读(219) 评论(0) 推荐(0) 编辑
摘要: 左值表达式与右值表达式 阅读全文
posted @ 2019-11-15 16:55 JohnRed 阅读(134) 评论(0) 推荐(0) 编辑
摘要: ``` 进程是分配资源的最小单位,有独立空间地址,进程间独立相互不影响。 线程是系统调度的最小单位,没有独立空间地址,共享所属进程的空间地址,。 一个进程可以包含多个线程,同一进程的线程间同步或互斥,不同进程的线程间可以并发执行 创建进程时间消耗较大,创建线程时间消耗较小 ``` 阅读全文
posted @ 2019-10-31 10:36 JohnRed 阅读(113) 评论(0) 推荐(0) 编辑
摘要: ``` From: https://github.com/progschj/ThreadPool ``` ``` #ifndef THREAD_POOL_H #define THREAD_POOL_H #include #include #include #include #include #include #include #include #include class ThreadPool { 阅读全文
posted @ 2019-10-28 20:36 JohnRed 阅读(198) 评论(0) 推荐(0) 编辑
摘要: ``` //先序 void preOrder(TreeNode* root) { if(root == nullptr) return; stack s; auto p = root; while(p||!s.empty()) { while(p) { coutleft; } if(!s.empty()) { auto node = s.top(); s.pop(); p = node->righ 阅读全文
posted @ 2019-10-24 14:56 JohnRed 阅读(92) 评论(0) 推荐(0) 编辑
摘要: ![](https://img2018.cnblogs.com/blog/1430944/201910/1430944-20191024121855182-1353455632.png) 阅读全文
posted @ 2019-10-24 12:19 JohnRed 阅读(278) 评论(0) 推荐(0) 编辑