自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

少言才不会咸's Tech-blog

好记性不如烂博客

  • 博客(243)
  • 收藏
  • 关注

原创 nginx配置dav上传+展示页面

【代码】nginx配置dav上传+展示页面。

2023-10-10 15:54:11 193

原创 nginx配置auth鉴权页面

【代码】nginx配置auth鉴权页面。

2023-10-10 15:53:17 271

原创 NetworkManager管理网络

NetworkManager管理网络。

2023-05-23 15:19:15 268

原创 wireshark下分析TCP Stream Graph(tcptrace)

【代码】wireshark下分析TCP Stream Graph。

2023-02-24 11:39:14 664

原创 vscode cpp launch.json with cmake-debug

【代码】vscode cpp launch.json with cmake-debug。

2023-01-13 10:46:59 141

原创 termux 安装ubuntu

【代码】termux 安装ubuntu。

2022-09-16 16:25:53 914

转载 ev++ 头文件

ev++封装

2022-09-13 15:50:55 233

原创 c++模板获取函数签名

c++模板获取函数签名。

2022-07-24 18:16:32 461

原创 systemd vncserver

PC:~$ cat /lib/systemd/system/[email protected] [Unit]Description=Start TightVNC server at startupAfter=syslog.target network.target [Service]Type=forkingUser=willkuGroup=willkuWorkingDirectory=/home/willku PIDFile=/home/willku/.vnc/%H:%i.pidE

2022-04-18 20:36:09 242

原创 perf性能火焰图生成

#!/bin/bash#sudo sh -c 'echo kernel.perf_event_paranoid=1 >> /etc/sysctl.d/99-perf.conf'#sudo sh -c 'echo kernel.kptr_restrict=0 >> /etc/sysctl.d/99-perf.conf'#sudo sh -c 'sysctl --system'DU=${1:-900}echo $DUTIME=`date +%s`DIR=perf_$T

2022-04-01 14:42:01 324

原创 tshark命令相关

sudo tshark -i ap1 -O 'http' -n -Y 'http.host == "sdkxgxyajs.data.kuiniuca"' -Tfields -e http.request.full_uri -e http.file_datasudo tshark -i ap1 -O 'http' -n -Y 'http.host == "sdkxgxyajs.data.kuiniuca"'

2022-03-03 11:59:36 265

原创 使用脚本上传coredump文件至远端服务器

⚡ 11:30:21  opt  cat /proc/sys/kernel/core_pattern|/opt/uploader.sh %E %t ⚡ 11:30:44  opt  cat uploader.sh#!/bin/bash# crash_reporter.sh %E %tCRASH_FILE_NAME=${1##*!}CRASH_TIME=`echo $2|date "+%Y%m%d%H%M%S"`#FILE_NAME=/opt/a.txt#echo $CRAS.

2022-03-02 11:34:04 112

原创 迭代bash脚本参数

#!/bin/bash# method 0: for i in $## method 1args=$#for (( i=1; i<=$args; i++ ))do echo "$i - ${!i}"done# method 2for argdo case "$arg" in -*=*) value=`echo "$arg" | sed -e 's/[-_a-zA-Z0-9]*=//'` ;; *) value="" ;;

2021-11-14 18:45:50 879

转载 __attribute__ ((weakref))

/*weakrefweakref ("target")The weakref attribute marks a declaration as a weak reference. Without arguments, it should be accompanied by an alias attribute naming the target symbol. Optionally, the target may be given as an argument to weakref itself. I

2021-11-10 16:58:31 385

原创 通过elrepo升级centos7内核

# 升级系统yum update -y # 安装 ELReporpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.orgrpm -Uvh https://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm # 安装新内核yum remove -y kernel-headers kernel-tools kernel-tools-libsyum --enablerepo=

2021-09-01 11:24:48 419

原创 dart中转换list为map

void main() { var a = ['红色', '蓝色', '紫色'] .asMap() .map((index, element) => MapEntry(index, "$element $index")) .values .toList(); var b = ['红色', '蓝色', '紫色'].map((element) => "$element").toList(); print(a); print(b);

2021-06-29 17:27:55 1070

原创 利用模版将多enum转为BitSet

#include <bitset>#include <string>#include <type_traits>#define SetBit(x) (0x1u << x)enum Test : uint32_t { kNum0 = SetBit(0), kNum1 = SetBit(1), kNum2 = SetBit(2), kNum3 = SetBit(3), kNum4 = SetBit(4),};struct Ma

2021-03-10 23:58:54 164

原创 通过模板实现可迭代cursor类

#include <mutex>#include <queue>#include <memory>#include <string>#include <iostream>#include <memory>#include <condition_variable>#include <stdio.h>#include <array>#include <vector>#inc

2021-03-05 00:29:41 173 1

原创 类型擦除示例

#include <mutex>#include <queue>#include <memory>#include <string>#include <iostream>#include <memory>#include <condition_variable>#define DBG_LOG(format, ...) \ printf("[%d:%s:%d]" format ", this:%p\n"

2021-02-24 23:23:41 94

转载 限制对象在堆上创建

struct Example{ class token{ private: token(){} friend Example; }; static std::shared_ptr<Example> create(){ return std::make_shared<Example>(token{}); } Example(token) : Example() { }priva.

2021-01-07 14:07:13 95

翻译 hierarchical mutex

class hierarchical_mutex{ std::mutex internal_mutex; unsigned long const hierarchy_value; unsigned long previous_hierarchy_value; static thread_local unsigned long this_thread_hierarchy_value; // 1 void check_for_hierarchy_violation()

2020-12-21 15:50:56 180

转载 std::forward demo

#include <iostream>using namespace std;// 接收左值的函数 f()template<typename T>void f(T &){ cout << "f(T &)" << endl;}// 接收右值的函数f()template<typename T>void f(T &&){ cout << "f(T &&)" &l

2020-12-19 16:41:14 95 1

转载 实现c++ 不可继承类:FinallyClass

#include <iostream>template<typename T>class MakeFinally {private: MakeFinally() {}//只有MakeFinally的友类才可以构造MakeFinally ~MakeFinally() {} friend T;};class MyClass : public virtual MakeFinally<MyClass> {public: void

2020-11-02 21:30:01 156 1

转载 达夫设备,循环展开

#include "stdio.h"#include "string.h"void Strncpy(char *to, const char *from, size_t count) { size_t n = (count + 7) / 8; switch (count % 8) { case 0: do { *to++ = *from++; case 7: .

2020-10-29 20:49:38 131

原创 【Google面试题】有四个线程1、2、3、4同步写入数据…C++11实现

#include <thread>#include <vector>namespace me { class semaphore { public: semaphore(int value = 1) : wakeups{value} {} void wait() { std::unique_lock<std::mutex> lock{mutex}; condition.

2020-10-14 11:47:02 368

原创 实现两个线程交替计算合数 or 素数

题目:实现两个线程交替计算1-10000内的合数 or 素数// method 1#include <thread>#include <cmath>#include <atomic>#define Max 10000typedef std::function<uint32_t()> BeginHook;typedef std::function<void(uint32_t, bool)> EndHook;std::ato.

2020-10-14 10:18:46 145

转载 模版检查类中是否有某个成员函数

//例子1template<typename T>struct has_no_destroy{ template <typename C> static char test(decltype(&C::no_destroy)); template <typename C> static int32_t test(...); const static bool value = sizeof(test<T>(0)) == 1;}; /

2020-08-04 21:01:12 371

原创 zsh theme

# vim:ft=zsh ts=2 sw=2 sts=2## agnoster's Theme - https://gist.github.com/3712874# A Powerline-inspired theme for ZSH## # README## In order for this theme to render correctly, you will need a# [Powerline-patched font](https://github.com/Lokaltog/po

2020-06-13 19:15:55 911

原创 openresty lua_shared_dict get/set demo

lua_shared_dict dict 10m;server { listen 80; #server_name lemme.coderr.cn; access_log logs/80.access.log main; #ssl_certificate /etc/letsencrypt/live/lederr.cn/fullchain.pem;...

2020-04-17 11:57:35 360

原创 std::enable_if example

#include <iostream>#include <type_traits>// 1. the return type (bool) is only valid if T is an integral type:template <class T>typename std::enable_if<std::is_integral<T&g...

2020-04-13 18:13:13 185

原创 dnsmasq

一、配置:1. apt-get install dnsmasq2. vim /etc/dnsmasq.conf 用于修改配置文件内容:a.(很重要!)listen-address改为本机IP地址以及127.0.0.1这样的信息,如listen-address=10.10.74.4, 127.0.0.1b. addn-hosts改为设置hosts的文件,网心中为 addn-hosts=/e...

2020-04-10 11:48:36 1089 2

转载 nginx ssl证书

#!/bin/sh# create self-signed server certificate: read -p "Enter your domain [www.example.com]: " DOMAIN echo "Create server key..." openssl genrsa -des3 -out $DOMAIN.key 4096 echo ...

2020-04-07 21:45:40 171

原创 git repo

Git global setupgit config --global user.name "xinjiawei"git config --global user.email "[email protected]"Create a new repositorygit clone http://gitlab.willku.org/xinjiawei/bytesdk.gitcd...

2020-04-02 21:01:02 172

转载 Linux C实现纯用户态抢占式多线程

原文: [https://www.toutiao.com/a6808804287469060612/?tt_from=mobile_qq&utm_campaign=client_share&timestamp=1585487900&app=news_article_social&utm_source=mobile_qq&utm_medium=toutiao_...

2020-03-29 23:32:31 496

原创 raspiberry上报心跳

local redis=require "resty.redis";--local cjson = require "cjson";local red=redis:new();red:set_timeout(1000);--redis连接local ok,err=red:connect("127.0.0.1", 6379);if not ok then ngx.log("fa...

2020-03-21 20:43:56 206

原创 构造缓存区溢出

#include <iostream>#include <chrono>#include <thread>#include <cstdio>void Fun() { for (;;) { std::this_thread::sleep_for(std::chrono::milliseconds(300)); std::co...

2020-03-15 20:16:33 181

原创 sha1sum

#include "openssl/sha.h"#include "openssl/crypto.h"#include <iostream>#include <sstream>#include <fstream>using namespace std;void sha1sum(const char *body, const int len, co...

2020-01-03 19:42:42 276

原创 递归实现basename命令

#include <iostream>#include <arpa/inet.h>#include <string.h>using namespace std;void xy_log1(const char *path, bool &is_ok){ if (path == nullptr) return; i...

2019-12-19 23:23:31 170

原创 日志打印文件名

template<int N>inline const char * CompileTimeGetFileName(const char(&arr)[N]){ //int size_ = N - 1; const char * filename = arr; const char* slash = strrchr(arr, '/'); if ...

2019-12-13 18:17:29 230

原创 vscode配置调试c++

tasks.json{ "tasks": [ { "type": "shell", "label": "clang build active file", "command": "/usr/bin/clang", "args": [ "-g", "-std=c++11", "${file}...

2019-10-22 14:02:31 390

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除