Posts
All the articles I've posted.
快速遍历磁盘
Published: at 02:26 AM快速遍历磁盘,不用遍历每个目录,主要使用DeviceIoControl 函数 需要用管理员权限运行 参考链接(https//docs.microsoft.com/en-us/windows/win32/DevIO/calling-deviceiocontrol) 使用命令行工具也可以遍历出所有文件: 注意C盘需要管理员权限 dir c...
编程语录
Published: at 01:38 PM纠错前先思考。如果你一头扎进问题中,你可能只解决了当前出现问题的代码,但如果你先思考这个错误,这个 bug 是怎么引入的?你通常发现和纠正一个更高层次的问题,进而改进了系统设计,防止了更多 bug 的出现。 ...
golang设置桌面壁纸
Published: at 01:21 PMgolang语言编写,设置windows桌面壁纸,图片来自于必应网站(cn.bing.com) github源码地址:https//github.com/tujiaw/gowallpaper(https//github.com/tujiaw/gowallpaper) 有兴趣的Star一下吧 编译好的程序:https//pan.baidu.com/s/1l5OW9GeuUF0r5TFaBW...
QWidget QLabel没有响应keyEvent键盘事件
Published: at 06:42 AM在Qt中我们经常通过重写下面两种虚函数来实现按键事件 virtual void keyPressEvent(QKeyEvent event); bool eventFilter(QObject watched, QEvent event); 但是有时候会遇到无法触发的情况(特别是QWidget,QLabel),这个时候我们会考虑是不是被父窗口给截获了没有传...
Mac安装国内版homebrew
Published: at 03:48 PMHomeBrew是macOS和linux平台的包管理工具 由于大家都知道的原因,安装官方的homebrew下载速度很慢,所以这里找了个国内版本的试下,速度非常快。 安装方法 粘贴下面的脚本到终端命令行界面,直接回车安装,后面选择1就可以了 /bin/zsh -c "$(curl -fsSL https//gi...
malloc_trim和SetProcessWorkingSetSize两个神奇的内存相关函数
Published: at 09:26 AM它们两个其实没有什么关系,相似之处是调用这两个函数后内存会有明显的下降,但是原理完全不同。 malloctrim linux平台的函数,官方的解释是:从堆释放可用内存。 在程序中堆上new或者malloc的内存我们都会delete和free掉,由于linux的机制它们并没有立即将释放的内存...
vim常用技巧
Published: at 02:17 PMLinux生产环境上,最常用的一套“vim“技巧原创 -------------------------- 研发线上使用最多的编辑器,就是vi。无论是最快查看某个文件内容,还是快速编辑某个文件,vi都能帮上忙。 软件世界貌似有一些非常长寿的东西,vi算是一个。本篇文章聚焦的是研发线上最常用的一些...
netcat网络诊断
Published: at 02:09 PMNetcat 号称 TCP/IP 的瑞士军刀并非浪得虚名,以体积小(可执行 200KB)功能灵活而著称,在各大发行版中都默认安装,你可以用它来做很多网络相关的工作,熟练使用它可以不依靠其他工具做一些很有用的事情。 最初作者是叫做“霍比特人”的网友 Hobbit hobbit@avian.org 于 ...
编写 Bash Shell 脚本的最佳实践
Published: at 01:24 PM前言 -- 由于工作需要,最近重新开始拾掇shell脚本。虽然绝大部分命令自己平时也经常使用,但是在写成脚本的时候总觉得写的很难看。而且当我在看其他人写的脚本的时候,总觉得难以阅读。毕竟shell脚本这个东西不算是正经的编程语言,他更像是一个工具,用来杂糅不同的程序...
如何在Ubuntu 14.04上使用Corosync,Pacemaker和浮动IP构建高可用服务
Published: at 01:24 AM介绍 本教程将演示如何将Corosync和Pacemaker与浮动IP一起在DigitalOcean上创建高可用性(HA)服务器基础结构。 Corosync是一个开源程序,它向客户端服务器提供群集成员身份和消息传递功能,通常称为消息传递层。Pacemaker是一个开放源代码群集资源管理器(CRM),该系统可...