- 博客(14)
- 资源 (6)
- 收藏
- 关注
转载 2020-11-25
转自:https://www.cnblogs.com/lipengxiang2009/p/7446388.htmlLinux内核参数之rp_filter一、rp_filter参数介绍rp_filter参数用于控制系统是否开启对数据包源地址的校验。首先看一下Linux内核文档documentation/networking/ip-sysctl.txt中的描述:rp_filter - INTEGER0 - No source validation.1 - Strict mo...
2020-11-25 13:47:24
191
1
原创 brotli 例子
Brotli is a generic-purpose lossless compression algorithm that compresses data using a combination of a modern variant of the LZ77 algorithm, Huffman coding and 2nd order context modeling, with a compression ratio comparable to the best currently availabl
2020-06-27 21:20:14
1194
原创 LZMA 例子
LZMA,(Lempel-Ziv-Markov chain-Algorithm的缩写),是一个Deflate和LZ77算法改良和优化后的压缩算法。官网连接:https://www.7-zip.org/,7zip中有用到,也有sdk提供。例子:#include ...#include "LzmaLib.h"using namespace std;int main(int argc, char** argv){ if (argc < 1) { .
2020-06-27 21:06:30
582
原创 linux 异步 connect
#include <assert.h>#include <iostream>#include <sys/types.h>#include <sys/socket.h>#include <arpa/inet.h>#include <fcntl.h>#include <sys/shm.h>#include <stdlib.h>#include <sys/select.h>#inclu..
2020-05-27 11:22:22
474
原创 c++ 赋值构造 explicit
对象在申明时调用等号赋值,实际使用的是拷贝构造public: CTmp(int n) :m_Num(n){ cout << "CTmp(int n) " << m_Num << endl; } CTmp(CTmp& a){ if(this != &a){ m_N...
2020-05-07 18:42:48
281
原创 redis 锁的一种实现
基于SET命令set设置value和设置过期时间是一个原子操作,通过set命令抢占一个key来实现SET key value [EX seconds] [PX milliseconds] [NX|XX]set xxx.lock 7654 PX 2000 NX如果成功则算获取到锁,返回nil则需重试解锁则通过DEL key实现解锁需注意事务性, 保证删除的就是自己设置的key...
2020-05-06 17:11:09
200
原创 c++ 默认构造 delete
一个class如果没有申明构造函数,编译器会按需自动生成构造函数。默认的构造函数有:构造函数,拷贝构造函数 ,拷贝赋值运算符 (c++11后:)移动构造函数,移动赋值运算符如果有些构造函数我们不想让他运行,老的办法可通过申明它为private来规避运行;在C++11后,加上delete标识符就可以class CBase{public: CBase() = de...
2020-05-06 16:45:28
647
原创 c++ 虚表
代码走起:class CBase{ int nBase{ 0 }; virtual void func(){ cout << "nBase" << nBase << endl; };};class CA : public CBase { int nA; //void func(){ cout << "...
2020-05-06 15:18:06
244
原创 c++ 虚继承
class CBase{ int nBase{ 0 };};class CA : public CBase { int nA; };class CB : public CBase { int nB; };class CD : public CA, public CB{ int nD; };int main(){ cout << "size of CBa...
2020-05-06 11:38:48
171
原创 windbg dump messagebox
问题:进程卡住,导出dump后分析初步分析,锁未释放,导致其他业务线程卡死,进而全部卡住进一步分析锁拥有者查看对应线程堆栈可发现该线程已经走异常流程,windows应该弹框提示异常了,只是没有确认终止所以进程没有退出从抛出异常过程的堆栈中找到对应 真正异常的栈上下文参考 https://www.jianshu.com/p/652a6677300c参考 https://blog...
2020-04-29 16:33:59
194
原创 pmap
NAME pmap - report memory map of a processSYNOPSIS pmap [options] pid [...]DESCRIPTION The pmap command reports the memory map of a process or processes.OPTIONS -x, -...
2020-04-29 16:22:34
190
原创 std::list sort
std ::sort不适用于list,list内部有sortclass CItem{public: CItem(int id):nId(id){} int nId = { 0 }; };int main(){ std::list<CItem> cfgList; for (int i = 10; i >=0; i--){ ...
2020-04-29 16:07:57
465
原创 c++ 11 emplace
emplace, 安放C++11 大部分stl容器新提供的一个新的插入方式,根据容器的特性,可能有emplaceemplace_backemplace_front区别于已有的insert push等,emplace可避免不必要的中间临时对象产生,提升性能。参考std::set的emplace说明:template <class... Args> pai...
2020-04-29 15:08:52
262
原创 c++ 容器 swap
swap交换函数:Exchange values of two objects.c++11中说明如下:This function is no longer defined in header<algorithm>, but in<utility>.The behavior of these function templates is equivalent ...
2020-04-29 11:44:57
194
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人