操作 | 延迟(纳秒) | 延迟(微秒) | 延迟(毫秒) | 参考 |
---|---|---|---|---|
CPU L1 级缓存访问 | 0.5 ns | |||
分支预测错误* | 5 ns | |||
CPU L2 级缓存访问 | 7 ns | 14x L1 cache | ||
互斥体Mutex 加锁/解锁 | 25 ns | |||
内存访问 | 100 ns | 20x L2 cache, 200x L1 cache | ||
用Zippy压缩1K字节 | 3,000 ns | 3 us | ||
在1 Gbps速率的网络上发送1K字节 over | 10,000 ns | 10 us | ||
从SSD读取4K长度的随机数据 | 150,000 ns | 150 us | ~1GB/sec SSD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pymongo | |
connection = pymongo.MongoClient('localhost', 27017) | |
db = connection['db_name'] | |
collection = db['collection_name'] | |
# now we can do CRUD operations with this collection pointer | |
collection.find({}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# install Scrapy | |
sudo apt-get install libffi-dev | |
sudo apt-get install libxml2-dev | |
sudo apt-get install libxslt1-dev | |
sudo apt-get install python-dev | |
sudo pip install scrapy | |
# install MongoDB | |
sudo apt-get update | |
sudo apt-get install mongodb-server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# download an entire directory from a web site | |
# -r Turn on recursive retrieving. The default maximum depth is 5. | |
# --no-parent Do not ever ascend to the parent directory when retrieving recursively. | |
wget -r --no-parent http://formations.telecom-bretagne.eu/syst/TPDIST/Additional-Reading/ | |
# use wget with username and password | |
wget -r --no-parent --user user_name --password my_pwd http://formations.telecom-bretagne.eu/syst/TPDIST/Additional-Reading/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pip install opencv-python |
- get the size of a multi-dimensional cv::Mat
std::cout << "cvMat.dims = " << cvMat.dims << "cvMat.size = [";
for(int i = 0; i < cvMat.dims; ++i) {
if(i) std::cout << " X ";
std::cout << cvMat.size[i];
}
std::cout << "] cvMat.channels = " << cvMat.channels() << std::endl;
OlderNewer