- 添加IMAP账户,如图所示

- 添加账户之后Airmail表示收不到任何邮件
- 打开这个网址http://config.mail.163.com/settings/imap/[email protected],将uid后面改成自己的邮箱
- 按照页面提示,解除对第三方客户端对屏蔽
我为什么还在用这么辣鸡的网易邮箱


我为什么还在用这么辣鸡的网易邮箱

在开发mpv的插件时,需要发起http请求,但是mpv并没有提供HTTP的api。
因此我们可以用VBScript或者PowerShell来发起请求。
运行cscript /nologo httpget.vbs “http://example.com”
|
1 2 3 4 5 6 7 8 9 10 11 12 |
args = WScript.Arguments.Count if args <> 1 then wscript.Quit end if URL = WScript.Arguments.Item(0) Set xmlhttp = CreateObject("Microsoft.XmlHttp") xmlhttp.open "GET", URL, false xmlhttp.setRequestHeader "User-Agent", "cscript/1.0" xmlhttp.send WScript.Echo xmlhttp.responseText |
或者:
|
1 |
powershell (Invoke-WebRequest -UserAgent Ps/1.0 -URI "http://example.com").content |
这两种方法均可以将响应输出到stdout。Windows会将输出的内容都重新编码为系统默认代码页,比如简体中文系统中会被编码为CP936。但是我们有时只想获得原始的内容,而不是便于显示在屏幕上的内容(比如下载文件或者不便于进行编码转换的时候)。
所以我们可以将响应输出到文件:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
args = WScript.Arguments.Count if args <> 1 then wscript.Quit end if URL = WScript.Arguments.Item(0) Set xmlhttp = CreateObject("Microsoft.XmlHttp") xmlhttp.open "GET", URL, false xmlhttp.setRequestHeader "User-Agent", "cscript/1.0" xmlhttp.send Set oStream = CreateObject("ADODB.Stream") With oStream .Type = 1 'adTypeBinary .Open .Write xmlhttp.responseBody 'to save binary data .SaveToFile "out.txt", 2 'adSaveCreateOverWrite End With Set oStream = Nothing Set ret = Nothing |
或者:
|
1 |
powershell Invoke-WebRequest -UserAgent Ps/1.0 -URI "http://example.com" -Outfile out.txt |
然后我们读取out.txt就可以获得响应内容了。
有时候用ngx.shared的时候想看一下到底存进去的值是什么,或者想列一下满足条件的键,或者想批量操作,所以这个项目就是用来解决这个问题的。
除了支持ngx.shared提供的操作以外,学习Redis增加了PING(测试连通性),KEYS(列出符合条件的键)和EVAL(在服务器上执行Lua脚本)。
已上传到opm,可以通过
opm install fffonion/lua-resty-shdict-server
一键安装。
由于目前stream和http子系统是两个独立的Lua VM,因此不能通过全局变量来共享数据。另外两个子系统的shdict是分别定义的,因此也不能互撸。所以如果想用这个模块来在redis-cli里撸http子系统下定义的shdict,需要这个补丁。
示例配置:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
http { lua_shared_dict dog 10m; } stream { lua_shared_dict dog 10m; server { listen 6380; require "resty.core.shdict" require "resty.shdict.redis-commands" local srv = require("resty.shdict.server") local s = srv:new("a-very-strong-password", "dog") s:serve() } |
然后
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
$ redis-cli -h 127.0.0.1 -p 6380 127.0.0.1:6380> set doge wow (error) ERR authentication required 127.0.0.1:6380> auth a-very-strong-password OK 127.0.0.1:6380> set doge wow OK 127.0.0.1:6380> get doge wow 127.0.0.1:6380> keys dog* 1) "doge" 127.0.0.1:6380> eval "return shdict.call('del', unpack(shdict.call('keys', ARGV[1])))" 0 dog* OK 127.0.0.1:18002> keys * (empty list or set) |
最近碰到这么个问题,有这么个函数,用来将HTML转义字符变回原来的字符:
|
1 2 3 4 5 6 7 8 9 10 11 12 |
def htmlescape(s): if sys.version_info[0] == 3: # python 3.x unichr = chr def replc(match): dict={'amp':'&','nbsp':' ','quot':'"','lt':'<','gt':'>','copy':'©','reg':'®'} if len(match.groups()) >= 2: if match.group(1) == '#': return unichr(int(match.group(2))) else: return dict.get(match.group(2), '?') htmlre = re.compile("&(#?)(\d{1,5}|\w{1,8}|[a-z]+);") return htmlre.sub(replc, s) |
其中unichr用来将一个整数转换成Unicode字符,仅在Python2中存在。Python3中,chr可以同时处理ASCII字符和Unicode字符。所以我们在Python3环境中将unichr映射到chr上。
运行这段代码会在第8行报错:NameError: free variable ‘unichr’ referenced before assignment in enclosing scope。而且只有Python2会报错,Python3不会。
首先从问题上看,报错的原因是在闭包replc里unichr没有定义。
但是Python2明明是有unichr这个内置函数的,为啥就变成未定义呢?
![]()
在cidr.me中使用这个模块时,返回了类似这样的输出:
Canada, Quebec, Montr�al
![]()
发现有人提过PATCH。于是去喵了一眼源码,发现有一个文档里没有提到的隐藏参数。
可以使用
|
1 |
geoip_city /path/to/geoip_city.dat utf8; |
这样来启用utf8。默认是iso-8859-1,或者叫latin-1。
MySQL默认也是latin-1。大概因为是单字节的,所以大家都爱默认用它;可是除了肉眼可见的字符,别的控制符除了会在终端里用以外并没有什么卵用。
还有libzip里默认用的是CP437,是DOS版的单字节编码。因为大概只有中文版的windows自带的压缩功能会生成GB18030编码的zip文件,所以还魔改过一个中国特色的libzip。
This patches include work from nzinfo (add mmseg support) and my patch for Hiragana and Katagana support (see this blog post). The changes can be viewed here.
For Sphinx 2.11.1:Github dl.yooooo.us
For Sphinx 2.3.2:Github dl.yooooo.us