1. 换源
换linux的apt等命令源为国内清华
换python的源
python3.9命令安装在3.9下,python命令安装在2下
换github的源
是要操作主机的hosts文件,实现ip重定向,解决DNS污染(即ip和域名要正确匹配)
CDN加速换HACS的下载源
HACS下载github文件的原理
通过调用github提供的API接口获取下载内容,然后下载到对应的文件夹
CDN
将项目放入CDN中托管,CDN可以加速下载托管项目的速度
代码很有特点,是把访问的url字符串replace了
由于版本更新问题,_DEBUG没有了,变为了self.log.debug
找到 / hacs / base.py 修改download函数
# 显示原始下载地址
print(url)
# 源文件
if "https://raw.githubusercontent.com" in url:
arr = url.replace("https://raw.githubusercontent.com/", "").split("/")
arr[1] = arr[1] + "@" + arr[2]
arr[2] = ""
_list = ["https://cdn.jsdelivr.net/gh"]
for item in arr:
if item != "":
_list.append(item)
url = "/".join(_list)
self.log.debug("下载链接:%s", url)
# 发布文件
if "https://github.com/" in url and "/releases/download/" in url:
url = url.replace('https://github.com/', 'https://hub.fastgit.org/')
# 修改后的下载地址
print(url)
2. 子系统WSL
Visual Studio Code远程连接子系统,读 / 写文件结构和文件
子系统更改文件的权限不够问题
经常会提示权限不够,解决方法:通过Visual Studio Code进入文件结构,shift加鼠标右键打开命令行,sudo nano更改
子系统缺点:无蓝牙
3. IoT常识 及 插件实现思路
设备通用识别前缀
蓝牙设备前缀 LYWSD03、ATC
蓝牙token:
小米通过token判断用户身份时效性,它是报文中的一个参数,如果过期时间过长,发给别人也能顺利登录
蓝牙配对密钥
用于设备间配对时使用
查名下设备、包括IP、token等的插件
输入账号密码选择服务器所在地,应该就是代替用户登陆了自己的账户去查询
将云端接入转为本地接入插件
通过将不支持本地的miio协议转为支持的miot协议实现本地化
HA不能多开的原因: 只有一个8123端口
解压下载的开源项目的.jar包
java -jar xxx.jar
github知识
master表示当前正在开发的版本
git下载问题 不要用https:用git:
pip卸载和更新对应版本
大概意思是unicorn版本安装错了,可以卸载老版本,安装要求的版本:
sudo pip3 uninstall unicorn
sudo pip3 install unicorn==2.0.3rc3
提示缺少库
查linux缺少库的方法dpkg -S libgthread-2.0.so.0
安装 sudo apt-get install
安装一些东西经常要用到路径 where is
pwd
或
whereis xxx.sh
连接不上us.archive.ubuntu.com
sudo vi 文件名
https://blog.csdn.net/he_wolf/article/details/37793201
实现分离
import re
string =“0x640x350x380x340x610x360x380x640x340x650x320x310x330x640x380x380x770x350x310x310x760x340x380x650x360x310x670x380x640x360x650x38”
#写出正则表达式 任意2个字符
pattern = re.compile(‘.{4}’)
#findall是找到所有的字符,再在字符中添加空格,当然你想添加其他东西当然也可以
print(’ '.join(pattern.findall(string)))
大量解密数据
text = get_bytes(0x00004004, 0x85F3)
ret = []
for i in range(len(text)):
ret.append(chr(ord(text[i]) ^ 0x67))
print ‘’.join(ret)
找数据
#debug002段开始地址
begin = 0xC000000000
end = 0xC000200000
x = end-begin
for i in range(1,x-1):
addr = begin+i
if(Byte(addr-1) == 0x39 and Byte(addr) == 0x61 and Byte(addr+1) == 0x62 and Byte(addr+2) == 0x63 and Byte(addr+3) == 0x64 and Byte(addr+4) == 0x65 and Byte(addr+5) == 0x66):
print(hex(addr))
获取本机能malloc多大
https://blog.csdn.net/yaotengjian/article/details/79774002
设置python3为默认python
cd /usr/bin
rm -rf python
ln -s /usr/bin/python3 python
python安装等有关问题
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple PyQt5
exe闪退的情况拖进cmd执行
重新生成exe的时候删掉dist,pyinstaller spec
Lib里的site-packages里有常用的包
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pyinstaller
https://bbs.testerhome.com/articles/19886