代码改变世界

阅读排行榜

subprocess使用

2014-02-21 17:28 by cmsd, 401 阅读, 收藏,
摘要: 1. Popen使用test =subprocess.Popen('ls /tmpa', shell=True, stdout = subprocess.PIPE, stderr=subprocess.PIPE)print test.stdout.read()print test.stderr.read()说明: shell=True代表unix下相当于args前面添加了"/bin/sh“”-c”,window下,相当于添加"cmd.exe/c", stdout、stderr输出到PIPE中否则会直接print出来,我们使用Popen就是为了获取这 阅读全文

nginx地址重写

2015-11-24 11:46 by cmsd, 397 阅读, 收藏,
摘要: 1. 域名重定向server_name wx.he.com weixin.ha.com; if ($http_host !~* "wx\.he\.com"){ rewrite ^/(.*)$ http://wx.he.com/$1 permanent; ... 阅读全文

Docker使用国内镜像

2017-06-15 22:11 by cmsd, 396 阅读, 收藏,
摘要: vim /lib/systemd/system/docker.service ExecStart=/usr/bin/dockerd -H fd:// --registry-mirror=https://3hn88wev.mirror.aliyuncs.com systemctl daemon-reload systemctl restart docker.service# 阿里云sed ... 阅读全文

bash变量操作

2014-12-24 14:24 by cmsd, 387 阅读, 收藏,
摘要: (1) ${value:-word} 当变量未定义或者值为空时,返回值为word的内容,否则返回变量的值. (2) ${value:=word} 与前者类似,只是若变量未定义或者值为空时,在返回word的值的同时将 word赋值给value (3) ${value:?message} 若变量以赋值的话,正常替换.否则将消息message送到标准错误输出(若 此替换出现在Shell程序中,那么该程序将终止运行) 阅读全文

查看进程的io

2013-12-21 11:39 by cmsd, 364 阅读, 收藏,
摘要: linux系统上可以使用(centos 2.6.18-144开始支持),dstat版本至少是:dstat-0.6.7-1.rf.noarch.rpm安装wget -chttp://linux.web.psi.ch/dist/scientific/5/gfa/all/dstat-0.6.7-1.rf.noarch.rpmrpm -Uvh dstat-0.6.7-1.rf.noarch.rpm使用# dstat -M topio -d -M topbio内核低版本的用这个Python脚本#!/usr/bin/python# Monitoring per-process disk I/O activ 阅读全文
上一页 1 ··· 15 16 17 18 19 20 21 22 23 ··· 26 下一页