zhuizhuhaomeng Blog

「记录下来,一切都会更容易理解」

prometheus 监控 nginx 请求

nginx/OpenResty 吐出数据 nginx 直接输出 prometheus 的格式可比再通过 nginx-prometheus-exporter 中转一次好多了。 nginx/OpenResty 吐出 Prometheus 格式的数据使用 https://github.com/knyar/nginx-lua-prometheus 这个库。但是也可以使用 https://gith...

ssh 登录失败问题分析

sshd 的配置非常的多,好多功能都搞不清楚,遇到失败的情况下真的好痛苦。 /root 目录权限错误 通过查看 /var/log/secure 看到目录权限错误。 1 2 3 4 5 6 $ cat /var/log/secure |tail Jun 2 12:07:23 iZj6c37ji07eeoyfn7cdvkZ sshd[30905]: Authentication refu...

Record the program with RR and Debug with the python extension

Using RR to Precisely Locate Linked List Corruption When debugging complex programs, linked list corruption is a common and tricky problem. When you discover that a linked list has been corrupted,...

pass string macro via cflags in shell

宏定义是 C 语言的一个特色,也是一个陷阱。 宏定义替换中的变量运算需要加上括号以防止优先级结合错误的问题想必大家都知道了。 今天遇到的是宏定义是字符串,需要在 shell 中传递该字符串给 Makefile 的问题。 比如存在如下的宏定义,我们想通过命令行传递宏定义来修改该宏定义的值,那么该如何传递呢? gcc 命令行传递宏定义 #ifndef DEFAULT_BASE #defi...

修复自己的罗技鼠标

感觉以前很普通的键盘都打起来手感都很好,现在的键盘没有 300 块都感觉太不舒服了。 买了个罗技的键盘鼠标套装,没有用多久,一个按键的背光就坏了。 反正就一个,影响不大,也就将就着这用。 不过不知道是什么原因,我的鼠标总是坏得快,单击变双击是常有的事,一般不会超过半年。 这次我申请退回去修理,结果返厂的时候说检测不到问题,要给我直接退回来。 这也不怪他们,这种问题确实就像是薛定谔的猫,你要...

Linux 路由

最近搞了一个通过 wiregurad 对 openvpn 进行加速分流的功能,这里做一个总结。 系统使用的是 RockyLinux-9 的操作系统。 安装软件 1 yum install -y openvpn wireguard-tools 配置 openvpn 该文件应该放在 /etc/openvpn/client/vpn2.conf,注意文件名以 conf 结尾。 配置文件的...

How to build envoy

download source code 1 2 3 git clone git@github.com:envoyproxy/envoy.git cd envoy git checkout v1.32.3 check bazel version 1 2 $ cat .bazelversion 6.5.0 download bazel version Find bazel in ...

Why YYJSON has high performance

Table of Contents Introduction Loop Unroll Branch Prediction Inline C Routines Efficient Number Converter Efficient Memory Manager Table Lookup Zero copy Inline assemble indicati...

Print function name when entering a function using GDB

Reading code is a very important skill for software developers. Knowing the calling sequence of a function is essential for understanding. GDB rbreak command is a powerful tool for code analysis. ...

Cross compile

https://github.com/stunnel/static-curl/blob/main/curl-static-cross.sh