Archive for the ‘编程’ Category.
Print directory tree on Windows and Linux using tree, sed, awk or Python
Windows: there is ‘tree.com‘ command showing the directory structure.
http://chxkyy.javaeye.com/blog/213864
Continue reading ‘Print directory tree on Windows and Linux using tree, sed, awk or Python’ »
Bash: exit codes for background jobs
Useful commands:
- wait <pid>: wait the background job with specified pid to be finished and return the exit code ( hint: stored in $? )
- jobs -p: list the pids of all the background jobs (hint: use for statement of bash to loop over each process)
- ( sleep 30s; /bin/false ) & : generate a background testing job with a error exit code
重定向 Bash “time” 命令的输出
bash下time是一个很有用的命令,它可以为一段脚本或一个程序的执行计时,这通常在粗略比较程序执行效率的时候很方便。但是你会发现,time命令输出的时间文字不能被简单地重定向,例如重定向至一个文本文件,只能显示在屏幕上,这对于非交互计时很不方便。例如:
O3D and missing atlbase.h
Followed the installation instruction given by O3D, I could not compile it still. The compiler complaint a missing “atlbase.h”. According to this link http://benjamin.smedbergs.us/blog/tag/atlbaseh/ , this header file is not available because I have just VS2008 Express version installed. And this file is not included in the Windows 2008 SDK. Apparently, Google guys assumed people should have VS professional version and SDK installed.:) But I’m not that rich yet. Looking for a solution!
Equivalent of “which” in Windows Command Shell Pankaj Kumars Weblog
如果想要知道一个程序或命令在Windows操作系统上的全路径,请使用下面这个脚本,它和Linux的which命令一样。
Continue reading ‘Equivalent of “which” in Windows Command Shell Pankaj Kumars Weblog’ »
lammps扩展命名冲突
曾经写过一些lammps的扩展,可是在最近的lammps更新中,有些类的命名和官方Molecule模块新加入的一些类有冲突。无奈这里不讲先来后到,谁让人家是官方发布的呢。看来以后要注意命名空间的使用了。不过说实话也感觉有些自由软件的作者有些“霸道”,他们的函数和类名称不加什么特殊的关键词,而是使用很常用的名字,明白着就是让别人让路嘛。只是笑谈,还是自己注意才对。
逆向切分由Python zip函数合并的列表
This is cool!
Suppose that you have a list with tuples as the member. Continue reading ‘逆向切分由Python zip函数合并的列表’ »
IPython的彩色显示
无论刚安装完IPython还是Engthought的套装,IPython默认的命令行上没有彩色显示。原因是IPython接受一些命令行参数,而默认安装后“colors”和“color-info”这两个magic函数并没有被调用。下面我们看怎样打开彩色显示:

