no comments yet
20 Dec 2017

python获取下载资源的真实地址

获取下载资源的直链地址:

import httplib
conn = httplib.HTTPConnection("www.sample.com")
conn.request("HEAD", "/download/down.jsp?DownID=8")
res = conn.getresponse()
print res.getheaders()
no comments yet
20 Dec 2017

Linux命令只删除文件夹下面所有的文件,保留文件夹本身

比如要删除文件夹test下的所有文件,但需要保留该文件夹,那么我们可以这样做:

#此处需要写该文件夹完整的绝对路径
rm -rf /test/*

参数说明:
-r, -R, --recursive 递归删除目录及其内容。
-f, --force 强制删除。忽略不存在的文件,不提示确认。

no comments yet
17 Dec 2017

Apache 中文目录浏览乱码解决办法

Centos下yum安装Apache后,默认配置浏览中文目录时会出现乱码,
在配置文件中添加:

IndexOptions Charset=GB2312

就能解决Apache autoindex模块中文乱码问题了。

no comments yet
24 Jun 2015

error: command 'gcc' failed with exit status 1 的解决办法

今天安装FastDFS的python api测试的时候提示这个错误,在此记录一下。
出现error: command 'gcc' failed with exit status 1的解决办法:

yum install gcc python-devel

出现以下error:

_mysql.c:2444: error: ‘_mysql_ConnectionObject’ has no member named ‘open’ error: command 'gcc' failed with exit status 1

yum -y install mysql-devel libxml2 libxml2-dev libxslt* zlib gcc openssl