代码改变世界

阅读排行榜

Shell学习笔记_时间计算[转]

2012-08-13 11:02 by tetang1230, 350 阅读, 收藏,
摘要: 在工作中,经常会写一些脚本,而关于日期的计算更是经常会碰到的问题,在网上搜索并整理了下常用的日期计算脚本。############################################linux 时间计算函数############################################自19700101000000以来的秒数date "+%s"昨天的日期date -d '1 days ago' "+%Y%m%d%H%M%S"明天的日期date -d '1 days' "+%Y%m%d%H%M% 阅读全文

pthread_clean_push和pthread_clean_up的使用[转]

2012-07-24 20:52 by tetang1230, 341 阅读, 收藏,
摘要: 转载链接:http://blog.myspace.cn/e/407245412.htmvoid pthread_cleanup_push(void (*routine)(void*), void *arg);void pthread_cleanup_pop(int execute);//这里的int参数,0是不执行push的内容,非0是执行。原型很简单,功能跟atexit()差不多,只不过一个是线程一个是进程。用来设置在push/pop内线程退出时要做的事情。需要注意的问题有几点:1,push与pop一定是成对出现的,其实push中包含"{"而pop中包含"}&q 阅读全文

运维利器-puppet集中配置管理系统安装测试[转]

2012-08-13 10:56 by tetang1230, 329 阅读, 收藏,
摘要: 运维利器-puppet集中配置管理系统安装测试环境:192.168.128.128 puppet-server192.168.128.32 puppet-client 1,安装前准备工作puppet是ruby写的程序,依赖ruby环境,rpm -qa|grep ruby检查是否安装,若没安装,可挂载本地光盘或者在线yum安装:[root@localhost ~]# yum install -y ruby-libs ruby ruby-irb ruby-rdoc [root@localhost ~]# hostname puppet-se... 阅读全文

初次使用github问题集锦

2012-08-03 23:17 by tetang1230, 320 阅读, 收藏,
摘要: 注册https://github.com/createrepository.在linux下clone一个你刚刚建repository例如:git clonehttps://github.com/tetang1230/linux.git建立一个测试文件README,然后git push然后出现以下错误:Agent admitted failure to sign using the key. Permission denied (publickey)fatal: The remote end hung up unexpectedly查看github的官方文档#1. Check for SSH k 阅读全文

用位运算反转一个字节[转]

2012-09-26 11:39 by tetang1230, 282 阅读, 收藏,
摘要: 用位运算反转一个字节[转]还是不喜欢位运算啊。。。啊啊。。。刚在网上看到一个网友的位运算反转一个字节的帖子,贴过来学习积累啊...上代码:unsigned char reverse8( unsigned char c ){ c = ( c & 0x55 ) << 1 | ( c & 0xAA ) >> 1; c = ( c & 0x33 ) << 2 | ( c & 0xCC ) >> 2; c = ( c & 0x0F ) << 4 | ( c & 0xF0 ) >> 4; 阅读全文