Jul 22

转自:http://hctan.blog.163.com/blog/static/14033200611258057438/

#!/usr/bin/python

import os

command = "wget http://news.163.com"
print os.system(command); 
Dec 28

转自:http://blog.csdn.net/lab2013/article/details/6876967

1.下载安装 Python
python-2.7.2.msi
http://www.python.org/download/
如下载 Python 2.7.2,安装目录为 C:Python27

2.添加环境变量
path = C:Python27

3.下载 setuptools
注意对应 Python 的版本,完成后运行 exe 即可完成安装

setuptools-0.6c11.win32-py2.7.exe
http://pypi.python.org/pypi/pip

4.下载 pip
pip-1.0.2.tar.gz
http://pypi.python.org/pypi/pip

5.安装 pip
5.1 解压 pip-1.0.2.tar.gz
5.2 运行CMD,进入命令行
5.3 用CD命令进入 pip 解压目录
5.4 输入 “python setup.py install”
5.5 添加环境变量 path = C:Python27Scripts

6.安装distribute, nose, virtualenv
进入命令行,输入 “pip install package”,package为安装包名称。
程序会自动下载相应的安装包,并进行安装,这步跟 Linux 一样。

Feb 07

GAE上的博客经常受到垃圾评论的骚扰,可以将留言的IP添加到GAE的DoS里面,具体步骤很简单,新建一个dos.yaml文件,代码如下:

blacklist:
- subnet: 1.2.3.4
  description: a single IP address
- subnet: 1.2.3.4/24
  description: an IPv4 subnet
- subnet: abcd::123:4567
  description: an IPv6 address
- subnet: abcd::123:4567/48
  description: an IPv6 subnet

GAE官方的解释如下:

A dos.yaml file in the root directory of your application (alongside app.yaml) configures DoS Protection Service blacklists for your application. The following is an example dos.yaml file:

The syntax of dos.yaml is the YAML format. For more information about this syntax, see the YAML website.

A dos.yaml file consists of a number of blacklist entries. A blacklist entry has a subnet, and can optionally specify a description. The description will be visible in the Admin Console. The subnet is any valid IPv4 or IPv6 subnet in CIDR notation.