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
int main(void) | |
{ | |
return 0; | |
} |
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
//打印编译构建的日期和时间,类似:Dec 3 2012 09:59:57 | |
#define PRINT_BUILD_TIME { \ | |
printf("\tBuild time:\t%s %s\n", \ | |
__DATE__, __TIME__); \ | |
} |
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
n*n矩阵逆时针题目 | |
给定一个小于10的正数,从(0,0)点开始逆时针输出这个矩阵; | |
如: | |
1 | |
01 | |
5 //输入5,输出下面的矩阵 | |
01 16 15 14 13 | |
02 17 24 23 12 | |
03 18 25 22 11 |
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
printf("%*.s",len,str); |
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
#define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) | |
#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); })) | |
#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) | |
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) | |
int a[10]; | |
int *n =a; | |
ARRAY_SIZE(a); | |
ARRAY_SIZE(n); // compile error :) |
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
#define swap(a, b) \ | |
do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while (0) | |
/// 临时变量名字, | |
/// from http://stackoverflow.com/questions/3982348/implement-generic-swap-macro-in-c | |
#define swap(x, y) \ | |
do { typeof(x) temp##x##y = x; x = y; y = temp##x##y; } while (0) |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
// clog.h | |
#define DC_LOG_FD stderr ///<日志输出文件描述符,简单的输出到标准错误输出 | |
#define CL_RED "\033[31m" | |
#define GREEN "\033[32m" | |
#define YELLOW "\033[33m" | |
#define BLUE "\033[34m" | |
#define PURPLE "\033[35m" | |
#define CL_ATTR_REV "\033[7m" | |
#define CL_ATTR_UNDERLINE "\033[4m" | |
#define _COLOR "\033[0m" |
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
/* filename kargs.c | |
* 来自: | |
* http://www.darkcoding.net/software/keyword-arguments-in-c/ | |
* http://en.wikipedia.org/wiki/Named_parameter | |
*/ | |
#include <stdio.h> | |
/* 使用宏定义将关键字参数转换成为一个(匿名)结构体 */ | |
/* 可以指定初始值:使用形如.x=101 */ | |
#define draw_circle(...) draw_circle_func( \ |
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
# --numeric-owner:指定解压出来的文件所有者为root,因为目标为root(0)用于 | |
tar --exclude="$(DIST_PAGKE)" --exclude=".svn" --exclude=".git" \ | |
--exclude="etc" \ | |
--exclude="data/config" \ | |
--exclude="*.log" \ | |
--exclude="scss" \ | |
--exclude=".project" --exclude=".gitignore" --exclude=".cproject" \ | |
-hczf $(DIST_PAGKE) -C $(DIST_DIR) . \ | |
--numeric-owner --owner=0 --group=0 |
OlderNewer