每日求一录~20170628

Linux工具快速教程

The Raft Consensus Algorithm

Go 语言在谷歌:以软件工程为目的的语言设计

Fast, configurable HTTP/2 web server with automatic HTTPS (main repo: https://github.com/mholt/caddy)

go vet与go tool vet

Yacc

golang 工具集

Lexer for Go http://cs.stanford.edu/~blynn/nex/

Go 语言包管理

gopherjs bindings

知乎Live全文搜索小程序

知乎Live微信小程序 & asyncio爬虫

HTTP client with an intuitive UI, JSON support, syntax highlighting, wget-like downloads, plugins, and more.

jq is a lightweight and flexible command-line JSON processor.

Semaphore
爬虫一次性的产生过多的请求账号/IP很快就会被封掉,可以考虑使用Semaphore控制同时的并发量,与我们熟悉的threading模块中的Semaphore(信号量)用法类似。

import aiohttp
import asyncio

NUMBERS = range(12)
URL = 'http://httpbin.org/get?a={}'
sema = asyncio.Semaphore(3)


async def fetch_async(a):
    async with aiohttp.request('GET', URL.format(a)) as r:
        data = await r.json()
    return data['args']['a']


async def print_result(a):
    with (await sema):
        r = await fetch_async(a)
        print('fetch({}) = {}'.format(a, r))


loop = asyncio.get_event_loop()
f = asyncio.wait([print_result(num) for num in NUMBERS])
loop.run_until_complete(f)
可以到后台看到并发受到了信号量的限制,同一时刻一般只处理三个请求。

Python并发编程之协程/异步IO

使用Python进行并发编程-asyncio篇(二)
使用Python进行并发编程-asyncio篇(三)
500 Lines or Less

Kubernetes Handbook

这是一个Google DNS代理 不同之处在于CDN友好,根据你的IP返回最优的解析结果

posted @ 2017-06-28 10:42  白云辉  阅读(208)  评论(0编辑  收藏  举报