View opti.py
| import onnx | |
| from onnx import optimizer | |
| # 优化模型 | |
| onnxfile = 'onnx_output' | |
| onnx_model = onnx.load(f'{onnxfile}.onnx') | |
| passes = ["extract_constant_to_initializer", "eliminate_unused_initializer"] | |
| optimized_model = optimizer.optimize(onnx_model, passes) | |
| onnx.save(optimized_model, f'{onnxfile}-opti.onnx') |
View convert_model.bat
| @ECHO OFF & CD/D "%~dp0" | |
| ::save as CRLF/ANSI format | |
| ::usage: drag ONNX model to .bat to start processing | |
| :start | |
| IF "%~1"=="" GOTO :END | |
| :proc | |
| python -m onnxsim "%~nx1" "%~nx1.sim.onnx" |
View gfwlist2unbound.py
| # -*- coding:utf-8 -*- | |
| """ | |
| Convert https://raw.githubusercontent.com/petronny/gfwlist2pac/master/gfwlist.pac for unbound. | |
| """ | |
| import re | |
| with open("gfwlist.conf", 'w') as wp: | |
| for line in open("gfwlist.pac"): |
View regnet.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View BH1750_CTL.ino
| #include <Wire.h> | |
| #include <BH1750.h> | |
| BH1750 lightMeter; | |
| void setup(){ | |
| Serial.begin(9600); | |
| // Initialize the I2C bus (BH1750 library doesn't do this automatically) | |
| // On esp8266 devices you can select SCL and SDA pins using Wire.begin(D4, D3); | |
| Wire.begin(); |
View utorrent_autoban.py
| import re | |
| import os | |
| import json | |
| import time | |
| import base64 | |
| import requests | |
| ipfilter_path = r'D:\Program Files (x86)\uTorrent\ipfilter.dat' # ipfilter.dat 路径 | |
| remote_url = 'http://127.0.0.1:23333/gui/' # uTorrent 使用的 WebUI 地址 | |
| username = b'admin' # WebUI 使用的用户名 |
View EhTagTranslatorWrapper.py
| ''' | |
| E绅士翻译注射器💉Wiki 解析实现 | |
| 直接用 EhTagBuilder 就能拿到 JSON 格式的数据库 | |
| 本脚本是为方便集成做的简易版解析实现 | |
| 参考了 EhTagTranslator 的实现过程 | |
| ''' | |
| import re | |
| import json | |
| import requests |
View pixiv-file-rename.py
| #!/usr/bin/env python | |
| #coding:utf-8 | |
| # Author: Sg4Dylan --<sg4dylan#gmail.com> | |
| # Created: 12/31/2018 | |
| # ========================================== | |
| # Pixiv 图片重命名 | |
| # ========================================== | |
| # 使用方法: 把待处理的「文件夹」拖放到脚本上 |
View batch_img_convert.py
| #!/usr/bin/env python | |
| #coding:utf-8 | |
| # Author: Sg4Dylan --<sg4dylan#gmail.com> | |
| # Created: 9/28/2018 | |
| # ========================================== | |
| # Any>WEBP Any>JPEG 图片原地批量转换 | |
| # ========================================== | |
| # 使用方法: 把待转换的文件夹拖放到脚本上 | |
| import os |
View nox_time_calibrator.py
| import subprocess | |
| import time | |
| from datetime import datetime as dt | |
| import logging | |
| logging.basicConfig(level=logging.DEBUG, | |
| format='[%(asctime)s][%(levelname)s][%(funcName)-2s]-> %(message)s', | |
| datefmt='%m-%d %H:%M:%S') | |
| subprocess.call("nox_adb connect 127.0.0.1:52001",shell=False) |
NewerOlder