This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
#include <signal.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <pthread.h> | |
#include <errno.h> | |
static int stop; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
obj-m += printk_device.o | |
all: | |
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules | |
clean: | |
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <uapi/linux/ptrace.h> | |
#include <net/sock.h> | |
#include <bcc/proto.h> | |
#define IP_ICMP 1 | |
#define IP_TCP 6 | |
#define ETH_HLEN 14 | |
/*eBPF program. | |
Filter IP and TCP packets, having payload not empty |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef __COMMON_H | |
#define __COMMON_H | |
#define ERRNO_OFFSET 0x80 | |
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* strncat test | |
* build: gcc -o strncpy strncpy.c -lcrypto | |
* output: | |
* $ ./strncpy | |
* time: 1569841068 sha256(long): H8Zw/CnxF9d/kG10Ck7VfDMNqWADDGMsrD7Wx0wTshY= | |
* sha256(short): H8Zw/CnxF9d/ | |
* time: 1569841069 sha256(long): uyzMNURXeyOjyCZ1ANI6Lze6lwF1bKUPjU3rHBZyTNY= | |
* sha256(short): H8Zw/CnxF9d/uyzMNURXeyOj | |
* time: 1569841070 sha256(long): 1zdqJgOCuILZkti92I2YUuT/KGNuqmSPOioA8rjxEeg= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
link | |
- https://leetcode.com/problems/permutations/ | |
problem: | |
Given a collection of distinct integers, return all possible permutations. | |
Example: | |
Input: [1,2,3] | |
Output: | |
[ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 背包九讲之多重背包 一维数组 | |
* from: http://acm.hdu.edu.cn/showproblem.php?pid=2191 | |
* reference: https://blog.csdn.net/hellobabygogo3/article/details/7993547 | |
*/ | |
#include <bits/stdc++.h> | |
using namespace std; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 背包九讲之多重背包 二维数组 | |
* from: http://acm.hdu.edu.cn/showproblem.php?pid=2191 | |
* reference: https://blog.csdn.net/hellobabygogo3/article/details/7993547 | |
*/ | |
#include <bits/stdc++.h> | |
using namespace std; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 背包九讲之完全背包 恰好装满 滚动数组 | |
* from: http://acm.hdu.edu.cn/showproblem.php?pid=1114 | |
* reference: https://blog.csdn.net/liujc_/article/details/44003167 | |
*/ | |
#include <bits/stdc++.h> | |
#define PMAX 1000000001 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 背包九讲之完全背包 恰好装满 二维数组 | |
* from: http://acm.hdu.edu.cn/showproblem.php?pid=1114 | |
* reference: https://blog.csdn.net/liujc_/article/details/44003167 | |
*/ | |
#include <bits/stdc++.h> | |
#define NMAX 500 | |
#define PMAX 1000000001 |