- 博客(9)
- 收藏
- 关注
原创 直接插入排序
#include <stdio.h>void arrayShow(int array[], int size){ int i = 0; for (i = 0; i < size; i++) { printf("%d ", array[i]); } printf("\n");}void directInsertSort(int array[], int size){ int i = 0, j = 0; int tmp = 0; for (i = 1; i &l
2021-05-26 12:53:27
69
原创 strtok_r函数的使用
代码如下:#include <stdio.h>#include <string.h>#define SIZE_16 16int main(int argc, const char *argv[]){ char *buf = NULL; char *savePtr = NULL; char data[SIZE_16] = "1,2,3,4"; buf = strtok_r(data,",", &savePtr); while (buf != NULL)
2021-05-22 12:01:45
768
原创 freeradius交叉编译,测试radclient
freeradius 历史源码url: https://ftp.cc.uoc.gr/mirrors/ftp.freeradius.org/old/下载解压freeradius-server-2.2.0.tar.gz(不依赖talloc库,交叉编译方便)内核版本:linux-2.6.36.x交叉编译工具链:buildroot-gcc463/usr/bin/mipsel-linux-编译完成之后(服务器配置略。。。)...
2021-04-15 09:25:45
355
原创 ktest-tool 打印字节码转int
ktest-tool 打印字节码转int为了便于观察,所以将字节码数组转换成 int数组添加的函数如下 def bytesToInt(b, byteorder='little'): return int.from_bytes(b, byteorder=byteorder,signed=True) def bytesArrayToIntArray(b): n = [] for i in range(0,
2021-03-13 13:02:43
176
原创 通过文件锁实现脚本互斥
文件锁实现脚本互斥写一个C程序,通过C来运行脚本,也可以用来运行c#include <stdio.h>#include <unistd.h>#include <fcntl.h>#include <sys/types.h>#include <sys/stat.h>#include <stdlib.h>#include <string.h>#include <signal.h>#define r
2021-03-13 12:11:50
105
原创 输出进程虚拟内存和物理内存相关信息
输出进程虚拟内存和物理内存相关信息#! /bin/shfileTempPath="/tmp/checkmem.tmp"check_proc(){ echo " check proc info" echo "" > $fileTempPath ps -A | grep -v grep | grep -v PID | awk '{print $1}' > $fileTempPath
2020-07-22 11:51:08
84
原创 shell 脚本互斥
shell脚本互斥保证两个脚本同时在后台运行,仍然可以进行互斥,源码如下:#! /bin/bashscript_name=`basename $0 | cut -d '.' -f1`file_pid="/var/run/${script_name}.pid"# check process according to pid file, if the pid file exists and is not emptyif [ -s $file_pid ];then ps -ef | grep -
2020-07-08 17:48:36
380
原创 mac地址
mac地址问题:通过ifconfig eth2 hw ether 11:11:11:11:11:11报错Cannot assign requested address,错误码EADDRNOTAVAIL原因:mac地址第一个字节,最后一个bit,1:表示组播,0:表示单播,网卡的mac地址一定是单播地址,因此会报错...
2020-05-17 10:14:27
376
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人