上一页 1 2 3 4 5 6 7 8 9 ··· 12 下一页
摘要: shell is a program that takes keyword commdands and passes them tothe operating system to carry out.when you use GUI,KDE uses konsole and GNOME usesgnome-terminal. $ is called a shell prompt and it will appear whenever the shell is ready to accept input.# means you logged in as the root us... 阅读全文
posted @ 2012-04-16 22:51 lxgeek 阅读(155) 评论(0) 推荐(0) 编辑
摘要: typedef struct { int counter;} atomic_t;#ifdef CONFIG_64BITtypedef struct { long counter;} atomic64_t;#endiflinux 内核使用特殊的数据类型atomic_t来代替直接使用C语言的整型,是出自以下几个原因:(1)关于atomic_t的函数只接受atomic_t类型(2)使用atomic_t类型可以避免编译器的优化,原子操作对于使用正确的内存地址很重视。(3)可以避免CPU的体系结构的问题这里就有个问题,为什么使用结构体就可以避免原因(2),编译器没有优化之,g... 阅读全文
posted @ 2012-03-30 22:31 lxgeek 阅读(339) 评论(0) 推荐(0) 编辑
摘要: 用法: python test.py /home/lx/c/test#test how much lines in a directory.import os,sysdef cout( current_doc ): os.chdir( current_doc ) doc_list = os.listdir( current_doc ) for i in doc_list: if os.path.isfile( i ): os.system( 'wc -l ' +... 阅读全文
posted @ 2012-03-30 16:09 lxgeek 阅读(182) 评论(0) 推荐(0) 编辑
摘要: #include <locale.h>#include <stdlib.h>#include <stdio.h>intmain( void ){ printf( "%s\n", setlocale( LC_ALL, "" ) ); exit(0);} 阅读全文
posted @ 2012-03-11 20:41 lxgeek 阅读(201) 评论(0) 推荐(0) 编辑
摘要: in_cksum(addr, len)u_short *addr;int len;{ register int nleft = len; register u_short *w = addr; register u_short answer; register int sum = 0; /* * Our algorithm is simple, using a 32 bit accumulator (sum), * we add sequential 16 bit words to it,... 阅读全文
posted @ 2012-01-05 15:23 lxgeek 阅读(635) 评论(0) 推荐(0) 编辑
摘要: #author=lx#date=2011-12-27import osimport sysclass node: "store the information of a node in bnt" def __init__( self, nodename=None, cptnum=2, pnum=0, cnum=0, parename=None, childname=None ): self.node_name = nodename self.cpt_num = cptnum s... 阅读全文
posted @ 2011-12-27 19:47 lxgeek 阅读(619) 评论(0) 推荐(0) 编辑
摘要: #! /bin/bashLX=100for i in 1 2 3do c=$(echo "scale=2;$i/$LX"|bc) echo -n "0$c ";doneecho; 阅读全文
posted @ 2011-12-22 17:31 lxgeek 阅读(511) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h>#include <stdlib.h>typedef unsigned char *byte_pointer;void show_bytes( byte_pointer start, int len ){ int i; for ( i = 0; i < len; i++ ) { printf( "%.2x", start[i] ); } printf( "\n" );}void show_int( int x ){ show_bytes( (by... 阅读全文
posted @ 2011-12-21 17:01 lxgeek 阅读(548) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2011-12-15 19:18 lxgeek 阅读(212) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2011-12-15 16:44 lxgeek 阅读(1267) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 ··· 12 下一页