Skip to content

Instantly share code, notes, and snippets.

SgDylan Sg4Dylan

Block or report user
View GitHub Profile
  • Sort: Recently created
@Sg4Dylan
Sg4Dylan / opti.py
Created 14 days ago
ESRGAN 导出为 ONNX 使用
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')
@Sg4Dylan
Sg4Dylan / convert_model.bat
Created 14 days ago
优化 PyTorch 输出 ONNX 模型并转换为 NCNN 模型
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"
@Sg4Dylan
Sg4Dylan / gfwlist2unbound.py
Created 14 days ago
将 gfwlist 转换为 Unbound 的 forward-zone 格式
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"):
@Sg4Dylan
Sg4Dylan / regnet.ipynb
Created 15 days ago
RegNet 模型使用/导出ONNX - Colab 版本
View regnet.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Sg4Dylan
Sg4Dylan / BH1750_CTL.ino
Created 11 months ago
显示器亮度自动调节套装
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();
@Sg4Dylan
Sg4Dylan / utorrent_autoban.py
Last active 16 days ago
uTorrent 自动屏蔽迅雷
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 使用的用户名
@Sg4Dylan
Sg4Dylan / EhTagTranslatorWrapper.py
Created 17 months ago
E绅士翻译注射器syringeWiki 解析实现
View EhTagTranslatorWrapper.py
'''
E绅士翻译注射器💉Wiki 解析实现
直接用 EhTagBuilder 就能拿到 JSON 格式的数据库
本脚本是为方便集成做的简易版解析实现
参考了 EhTagTranslator 的实现过程
'''
import re
import json
import requests
@Sg4Dylan
Sg4Dylan / pixiv-file-rename.py
Last active 2 months ago
给 Pixiv 下载的图片重命名
View pixiv-file-rename.py
#!/usr/bin/env python
#coding:utf-8
# Author: Sg4Dylan --<sg4dylan#gmail.com>
# Created: 12/31/2018
# ==========================================
# Pixiv 图片重命名
# ==========================================
# 使用方法: 把待处理的「文件夹」拖放到脚本上
@Sg4Dylan
Sg4Dylan / batch_img_convert.py
Created 2 years ago
图片原地批量转换
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
@Sg4Dylan
Sg4Dylan / nox_time_calibrator.py
Created 3 years ago
Nox Android 模拟器校时脚本,放置在安装目录下的 bin 目录双击使用,每分钟同步一次模拟器与主机的时间
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)
You can’t perform that action at this time.