psutil是python的一个用于获取cpu信息的模块,非常好使,以下附上官方的一些example:
CPU-> Examples>>> import psutil>>>
psutil.cpu_times()scputimes(user=3961.46, nice=169.729, syst...
分类:
其他好文 时间:
2014-06-09 19:36:32
阅读次数:
418
原题地址:https://oj.leetcode.com/problems/simplify-path/题意:Given
an absolute path for a file (Unix-style), simplify it.For example,path="/home/",
=>"/home...
分类:
编程语言 时间:
2014-06-09 19:13:54
阅读次数:
181
Map-reduce是一种优雅的数据处理方式,本文通过三个例子介绍如何用python在linux的管道进行map-reduce编程,本文写的所有map-reduce程序都可以原封不动的放在Hadoop下运行,很容易在大数据集上扩展。
分类:
其他好文 时间:
2014-06-09 19:11:44
阅读次数:
253
1.User/Group/Others文件权限概念:ls含义list,重点在于显示文件的文件名以及其相关属性。第一列:文件类型与权限
文件类型:d目录 -文件 l链接文件 其后九个字符:1.文件所有者权限 2.同用户组权限 3.其他非本用户组权限 r读 w写
x可执行第二列:有多少文件名连接到...
分类:
系统相关 时间:
2014-06-09 19:03:23
阅读次数:
315
原题地址:https://oj.leetcode.com/problems/scramble-string/题意:Given
a strings1, we may represent it as a binary tree by partitioning it to two
non-empty su...
分类:
编程语言 时间:
2014-06-09 19:02:59
阅读次数:
197
1. python -m cProfile myprogram.py2. 使用import
profile模块import profiledef profileTest(): ...if __name__ == "__main__":
profile.run("profileTest()")3......
分类:
编程语言 时间:
2014-06-09 18:59:10
阅读次数:
219
文件是在WIndows 下创建的,Windows
的文件名中文编码默认为GBK,而Linux中默认文件名编码为UTF8,由于编码不一致所以导致了文件名乱码的问题,解决这个问题需要对文件名进行转码。sudo
apt-get install convmvconvmv 使用方法:convmv -f 源编码...
分类:
系统相关 时间:
2014-06-09 18:54:53
阅读次数:
273
ed编辑器打开ed编辑器ed:新建一个文件ed
filename:编辑一个已经存在的文件ed编辑器指令激活ed命令后进入的是ed编辑器的命令行状态,下面是几条常用指令a - 在文件的末尾添加新内容i -
在文件的最后一行之前插入新内容o - 把文件输入的最后一行(无论是原来存在的还是插入的)替换成新...
分类:
系统相关 时间:
2014-06-09 18:47:09
阅读次数:
605
原题地址:https://oj.leetcode.com/problems/search-in-rotated-sorted-array/题意:Suppose
a sorted array is rotated at some pivot unknown to you beforehand.(i.e...
分类:
编程语言 时间:
2014-06-09 18:43:14
阅读次数:
273
#include #include #include #include #include
#include #define BUFFER_SIZE 1024int main(int argc, char *argv[]){ int fd; char
buffer[BUFFER_SIZE]...
分类:
系统相关 时间:
2014-06-09 16:29:07
阅读次数:
428