国内从 Docker Hub 拉取镜像有时会遇到困难,此时可以配置镜像加速器。Docker 官方和国内很多云服务商都提供了国内加速器服务。
Ubuntu 16.04+、Debian 8+、CentOS 7+
创建或修改 /etc/docker/daemon.json
:
( find . -type d -name ".git" && find . -name ".gitignore" && find . -name ".gitmodules" ) | xargs rm -rf |
import asyncio | |
from asyncio.queues import Queue | |
TERMINATOR = object() | |
class TaskPool(object): | |
def __init__(self, loop, num_workers): | |
self.loop = loop | |
self.tasks = Queue(loop=self.loop) |
from timeit import timeit | |
import asyncio | |
import requests | |
from threading import Thread | |
import aiohttp | |
client = aiohttp.ClientSession() | |
爬虫爬了好久,总共从豆瓣爬下来了 16894465 本书,有评分的有 279377 本。
简单统计如下:
package main | |
import ( | |
"fmt" | |
"sync" | |
) | |
func main() { | |
var wg sync.WaitGroup | |
done := make(chan struct{}) | |
wq := make(chan interface{}) | |
workerCount := 2 |
// This is an example program that iterates over all | |
// items in a mongodb collection in a memory safe way | |
package main | |
import ( | |
"labix.org/v2/mgo" | |
"labix.org/v2/mgo/bson" | |
"fmt" | |
) |
# Use this command to install the required dependency packages: | |
sudo apt-get install build-essential libncurses5-dev openssl libssl-dev fop xsltproc unixodbc-dev | |
wget http://erlang.org/download/otp_src_R15B01.tar.gz | |
tar zxvf otp_src_R15B01.tar.gz | |
cd otp_src_R15B01 | |
./configure && make && sudo make install |
public static boolean isMiUi() { | |
return !TextUtils.isEmpty(getSystemProperty("ro.miui.ui.version.name")); | |
} | |
public static String getSystemProperty(String propName) { | |
String line; | |
BufferedReader input = null; | |
try { | |
java.lang.Process p = Runtime.getRuntime().exec("getprop " + propName); | |
input = new BufferedReader(new InputStreamReader(p.getInputStream()), 1024); |