- 博客(9)
- 资源 (2)
- 收藏
- 关注
转载 Linux网络 - 数据包的接收过程 UDP为例
本文将介绍在Linux系统中,数据包是如何一步一步从网卡传到进程手中的。本文只讨论以太网的物理网卡,不涉及虚拟设备,并且以一个UDP包的接收过程作为示例.
2022-03-14 10:04:13
815
原创 大数据乘法(c++)
#include <iostream>#include <cstring>using namespace std;void calc(char *pA, char *pB, char *pC){ int lenA = strlen(pA); int lenB = strlen(pB); int pstart = lenA+lenB-1; int carry = 0;//进位 for(int i=lenA-1;i>=0;i--.
2021-12-24 11:33:30
1051
原创 lua 键值对加解码 encode decode
json.encode将表格数据编码为 JSON 字符串。格式:jsonString = json.encode(表格对象)用法示例:local str = json.encode({a=1,b="ss",c={c1=1,c2=2},d={10,11},100})echo(str) -- {"a":1,"b":"ss","c":{"c1":1,"c2":2},"d":[10,11],"1":100}local str = json.encode({1,2,"3",{10,11}}).
2021-12-14 11:22:02
879
原创 shell脚本在函数中引入参数
str=$2 #字符串变量count=2str(){ if (( $count >= 4 )) then str="$str,$i" #将参数用,连接 fi count=$[$count+1]}for i in "$@"; do strdone
2021-12-08 09:46:57
665
原创 shell脚本查找指定字符串
name1="#${location_name}loc_start" #name1为你想要查找的字符串a=$(cat -n ${nginx_path}/nginx.conf|grep "$name1"|cut -f1) #a为查找到的行号
2021-12-02 15:02:55
7491
原创 sed替换命令
sed命令替换目录假设将test.conf中的server和host进行匹配,并且进行替换为目录使用格式:sed -i -e "s:匹配参数=.*:匹配参数=替换后的内容:g" 对应的文件路径1、假设test.sh脚本#!/bin/bashTEST_CONF=/home/steve/test.confsed -i -e "s:server=.*:server=/opt/zabbix:g" ${TEST_CONF}sed -i -e "s:host=.*:host=/etc/passwd:
2021-11-25 14:30:59
2396
原创 lua 在response中创建cooike
localck=require"resty.cookie"localcookie,err=ck:new()ifnotcookiethenngx.log(ngx.ERR,err)returnendlocalok,err=cookie:set({key="mytoken",value="qwe123",path="/",httponly=true,expires=n...
2021-11-19 16:18:24
524
utf8 转为 gbk 编码
2022-02-23
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人