Git可以将用户名,密码和仓库链接保存在硬盘中,而不用在每次push的时候都输入密码。
保存密码到硬盘一条命令就可以
$ git config credential.helper store
当git push的时候输入一次用户名和密码就会被记录
参考
$ man git | grep -C 5 password
$ man git-credential-store
这样保存的密码是明文的,保存在用户目录~的.git-credentials文件中
$ file ~/.git-credentials
$ cat ~/.git-credentials
引用
EXAMPLES
The point of this helper is to reduce the number of times you must type your username or password. For example:
$ git config credential.helper store $ git push http://example.com/repo.git
settings.py 中设置 LANGUAGE_CODE,以使Django支持需要的语言,如简体中文。
将
LANGUAGE_CODE = 'en-us'
修改为
LANGUAGE_CODE = 'zh-hans'
Django 支持中文,可以体现在后台admin页面被汉化,时间支持中文。例如
{{ pub_date|date:"Y-m-d, l" }}
显示的是例如"2016-05-25, 星期三",而不是"2016-05-25, Wedesday"这样的时间,省去了开发者自己汉化的步骤。
Django1.9以后language code 'zh-cn'就被丢弃了,使用'zh-hans'代替。
The use of the language code 'zh-cn' is deprecated. Please use the 'zh-hans' translation instead.
假设body有命名空间如下
<body xmlns="http://www.w3.org/1999/xhtml">
那么直接用response.xpath取body
response.selector.register_namespace('w', 'http://www.w3.org/1999/xhtml')
body = response.xpath('//w:body').extract()
上面的这个response.selector实际上是scrapy.selector.XmlXPathSelector,等同于
from scrapy.selector import XmlXPathSelector
x = XmlXPathSelector(response)
x.register_namespace('g', 'http://www.w3.org/1999/xhtml')
x.select('//g:body')
有一类弱联网的手游,他的战斗过程及奖励结果都在客户端,服务器端通过http协议返回一些排名信息等,通过捕获他的http请求和服务器返回数据,就可以在本地计算机架设一个简单的服务器,提供给自己的游戏使用。
例如,游戏大唐好徒弟的PVP模式是需要联网的,根据捕获的http请求做本地服务器。这里用的是Django。
游戏端POST数据给url: idt.17hf.cn/DaTangServer/htdServlet
$ django-admin startproject idt
$ cd idt
修改idt/settings.py,在其中添加idt到安装的应用,添加'*'到允许的hosts.
添加json模版文件
$ mkdir -p idt/templates/idt
在 idt/templates/idt 目录中添加templates
模版文件1.html
{"act32":{"yjList":[{"id":"54480","type":1,"btype":0,"bnum":45000,"bstr":"恭喜您获得今日PVP竞技场第19名!\n您获得了以下奖励:
假设待操作的文本文件如下,需要将如下多行文本的行首键入一个tab。
set nu
set tabstop=4
set shiftwidth=4
set softtabstop=4
set autoindent
set mouse=i
syntax on
先将光标移动到第一行。
在normal模式下,按q加一个字母开始录制。例如按下qr,将该宏注册为r。
按下I在行首插入,在编辑模式按下Tab键。按Esc键返回到normal模式。
按下j将光标移动到下一行。
按下q完成录制。
即宏的录制是以q加一个注册字母开始,录制操作过程,并在normal模式以q完成录制。
使用上面录制的宏r
normal模式下将光标移动到第二行,按下@r,使用了一次宏r。
多次操作按下数字加@r,例如将光标移动到第三行,对余下的5行操作宏r,按下5@r
@@是对上一次宏使用的重复使用。