This file contains hidden or 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
#!/bin/bash | |
# some useful commands to collect system infomation. | |
# Reference: | |
# http://www.tecmint.com/commands-to-collect-system-and-hardware-information-in-linux/ | |
# http://www.binarytides.com/linux-commands-hardware-info/ | |
# Check kernel,OS,CPU | |
uname -a |
This file contains hidden or 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
/* | |
* Demo of getting page via lib curl | |
* Build: gcc curl-get.c -o curl-get -lcurl | |
* Run: ./curl-get | |
*/ | |
#include <curl/curl.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> |
This file contains hidden or 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
/* | |
* Demo of posting data to webpage via lib curl. | |
* Build: gcc curl-post.c -o curl-post -lcurl | |
* Run: ./curl-post | |
*/ | |
#include <curl/curl.h> | |
#include <stdio.h> | |
int main(void) { |
This file contains hidden or 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 <unistd.h> | |
#include <stdlib.h> | |
#include <errno.h> | |
#include <string.h> | |
#include <sys/types.h> | |
#include <sys/stat.h> | |
#include <sys/socket.h> | |
#include <sys/un.h> | |
#include <netinet/in.h> |
This file contains hidden or 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
/* | |
* Demo of libpq. | |
* Build: g++ libpq-demo.cc -o libpq-demo -lpq | |
* Run: ./libpq-demo | |
*/ | |
#include <arpa/inet.h> | |
#include <iostream> | |
#include <libpq-fe.h> | |
#include <sstream> |
This file contains hidden or 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
/* | |
* List directory recursively on Linux system. | |
* Build: gcc list-dir.c -o list-dir.out | |
* Run: ./list-dir.out | |
*/ | |
#include <dirent.h> | |
#include <stdio.h> | |
#include <sys/types.h> |
This file contains hidden or 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
/* | |
* Demo of print bytes in binary. | |
* Build: gcc print-bits.c -o print-bits | |
* Run: ./print-bits | |
*/ | |
#include<stdio.h> | |
#include<stdlib.h> | |
void printBits(void const * const ptr, size_t size) { |
This file contains hidden or 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
// server.c | |
/* | |
* Demo of socket server. | |
* Build: gcc server.c -o server | |
* Run: ./server | |
*/ | |
#include <arpa/inet.h> | |
#include <netinet/in.h> | |
#include <stdio.h> |
This file contains hidden or 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
/* | |
* Demo of parsing program options with Argp | |
* Build: gcc test-argp.c -o test-argp | |
* Run: ./test-argp | |
*/ | |
#include <argp.h> | |
#include <stdlib.h> | |
/* Program documentation. */ |
This file contains hidden or 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
/* | |
* Demo of creating zombie process. | |
* Build: gcc test-zombie.c -o test-zombie | |
* Run: ./test-zombie | |
*/ | |
#include <stdio.h> | |
#include <unistd.h> | |
#include <errno.h> | |
#include <stdlib.h> |
OlderNewer