Skip to content

Instantly share code, notes, and snippets.

View wwj718's full-sized avatar

wwj718

View GitHub Profile
# 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
@wwj718
wwj718 / BluetoothLowEnergy.py
Created September 29, 2018 06:38 — forked from StefanD986/BluetoothLowEnergy.py
QBluetooth Discovery Methods in pyqt
import PyQt5
from PyQt5 import QtCore
from PyQt5 import QtBluetooth
class DeviceFinder(QtCore.QObject):
def __init__(self):
super().__init__()
self.m_devices = []
import aiohttp
import asyncio
from requests_html import HTML
import tablib
import time
timestamp = int(time.time())
# model
headers = ('url', 'area', 'telephone','address') # 字段
data = []
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)
@wwj718
wwj718 / migrate_video_to_qiniu.py
Created September 13, 2018 13:21
migrate_video_to_qiniu.py
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)
@wwj718
wwj718 / asyncio-test.py
Created September 7, 2018 06:30
There is no current event loop in thread ‘Thread-1’.
# https://blog.csdn.net/qq_34367804/article/details/75046718
# 在线程启动时调用
import asyncio
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
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",
# 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 是确定的吗
@wwj718
wwj718 / pyppeteer_pytest.py
Last active August 22, 2018 09:26
用于scratch同步镜像数据
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()
备份镜像
查看sd卡的路径
df -h
备份镜像到磁盘
sudo dd if=/dev/树莓派设备地址 | gzip>/home/你的用户名/文件名.gz
例子
sudo dd if=/dev/disk2 | gzip > /Users/hidaris/rpi_opencv3_41_hass.gz