操作 | 延迟(纳秒) | 延迟(微秒) | 延迟(毫秒) | 参考 |
---|---|---|---|---|
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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
from sshtunnel import SSHTunnelForwarder | |
import pymongo | |
MONGO_HOST = "IP_ADDRESS" | |
MONGO_USER = "USERNAME" | |
MONGO_PASS = "PASSWORD" | |
MONGO_DB = "DATABASE_NAME" | |
MONGO_COLLECTION = "COLLECTION_NAME" | |
# define ssh tunnel |
This work is licensed under a Creative Commons Attribution 4.0 International License.
The solution is based on running DHCP service at your workstation (your notebook for example), and use it to attribute an IP address to your Raspberry Pi/Odroid. Then use ssh to connect to your Raspberry Pi/Odroid through this IP address.
Terminology | Explaination |
---|---|
Client | Your Single Board Computer, such as a Raspberry Pi or an Odroid |
Server | Your workstation with any linux based systems, like Ubuntu |
This file contains hidden or 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 |
OlderNewer