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
# https://gist.github.com/midoriiro/320c6990ab8e66343a7b | |
from PyQt5 import QtBluetooth | |
from PyQt5.QtBluetooth import QBluetoothLocalDevice | |
local_device = QBluetoothLocalDevice() | |
# 查看本机蓝牙 mac | |
all = local_device.allDevices() | |
first = all[0] | |
address = first.address().toString() # 88:E9:FE:5B:99:04 |
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 PyQt5 | |
from PyQt5 import QtCore | |
from PyQt5 import QtBluetooth | |
class DeviceFinder(QtCore.QObject): | |
def __init__(self): | |
super().__init__() | |
self.m_devices = [] |
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 aiohttp | |
import asyncio | |
from requests_html import HTML | |
import tablib | |
import time | |
timestamp = int(time.time()) | |
# model | |
headers = ('url', 'area', 'telephone','address') # 字段 | |
data = [] |
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
from cryptography.fernet import Fernet | |
key = Fernet.generate_key() # 生成之后 保存好 | |
cipher_suite = Fernet(key) | |
cipher_text = cipher_suite.encrypt(b"A really secret message. Not for prying eyes.") | |
plain_text = cipher_suite.decrypt(cipher_text) |
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 pandas as pd | |
import aiohttp | |
import asyncio | |
import time | |
df = pd.read_csv('qiniu_url.csv') | |
async def job(session, url): | |
response = await session.options(url) |
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
# https://blog.csdn.net/qq_34367804/article/details/75046718 | |
# 在线程启动时调用 | |
import asyncio | |
loop = asyncio.new_event_loop() | |
asyncio.set_event_loop(loop) |
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
from jsonrpc import JSONRPCResponseManager, dispatcher | |
dispatcher["echo"] = lambda s: s | |
dispatcher["add"] = lambda a, b: a + b | |
import json | |
request_data = { | |
"method": "echo", | |
"params": ["echome!"], | |
"jsonrpc": "2.0", |
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
# python3.6 ubtrobot alpha1p | |
from serial.tools.list_ports import comports as list_serial_ports | |
ports = list_serial_ports() | |
for i in ports: | |
print(i[0]) | |
print(i[1]) | |
print(i[2]) | |
# 00010039_PID 是确定的吗 |
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 asyncio | |
from pyppeteer import launch | |
async def main(): | |
browser = await launch() | |
page = await browser.newPage() | |
await page.goto('http://www.baidu.com') | |
# await asyncio.sleep(10) # 等待加载图片 | |
await page.screenshot({'path': '/tmp/example.png'}) | |
await browser.close() |
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
备份镜像 | |
查看sd卡的路径 | |
df -h | |
备份镜像到磁盘 | |
sudo dd if=/dev/树莓派设备地址 | gzip>/home/你的用户名/文件名.gz | |
例子 | |
sudo dd if=/dev/disk2 | gzip > /Users/hidaris/rpi_opencv3_41_hass.gz | |