加载中...
不想等待可以点我关掉

折腾

小米路由器

开启SSH

使用acecilia/OpenWRTInvasion,注意路由器要处于非中继情况下并连接外网

允许外网访问

/etc/config/firewall中添加

1
2
3
4
5
6
7
8
9
10
config redirect 'wan10081rdr1'
option proto 'tcp'
option src_dport '10081'
option dest_ip '192.168.31.1'
option dest_port '80'
option src 'wan'
option name 'WEB10081'
option target 'DNAT'
option ftype '1'
option dest 'lan'

将自身80端口映射到10081端口上

来自急需小米AX1800路由器设置端口转发远程登陆WEB管理页-恩山无线论坛 (right.com.cn)

刷breed

  1. 开启SSH

  2. 查看路由器分区表

    R4A
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    root@XiaoQiang:~# cat /proc/mtd
    dev: size erasesize name
    mtd0: 01000000 00010000 "ALL"
    mtd1: 00030000 00010000 "Bootloader"
    mtd2: 00010000 00010000 "NULL"
    mtd3: 00010000 00010000 "Bdata"
    mtd4: 00010000 00010000 "Factory"
    mtd5: 00010000 00010000 "crash"
    mtd6: 00010000 00010000 "cfg_bak"
    mtd7: 00100000 00010000 "overlay"
    mtd8: 00d00000 00010000 "OS1"
    mtd9: 00b30000 00010000 "rootfs"
    mtd10: 00170000 00010000 "disk"
    mtd11: 00010000 00010000 "Config"
  3. 备份分区,留意factory跟BootLoader对应的mtd分区,需要备份的是factory和BootLoader

1
2
3
4
5
6
7
8
root@XiaoQiang:~# dd if=/dev/mtd4 of=/tmp/eeprom.bin
128+0 records in
128+0 records out
65536 bytes (64.0KB) copied, 0.032859 seconds, 1.9MB/s
root@XiaoQiang:~# dd if=/dev/mtd1 of=/tmp/Bootloader.bin
384+0 records in
384+0 records out
196608 bytes (192.0KB) copied, 0.095421 seconds, 2.0MB/s
  1. 下载到本地
image-20240713164411960
image-20240713164411960
image-20240713164520809
image-20240713164520809
  1. 下载breed
1
cd /tmp && wget  http://121.5.163.108/download/breed-mt7621-pbr-m1.bin && mv breed-mt7621-pbr-m1.bin breed.bin
  1. 刷入
1
mtd write breed.bin Bootloader
  1. 重启按住复位键一段时间后访问192.168.1.1,备份编程器固件,多备份几次

nginx反代使用内容替换无法替换js内容

1
sub_filter_types *;

sub_filter_types指令:sub_filter_types * 用于指定需要被替换的MIME类型,默认为“text/html”,如果制定为*,那么所有的都处理;

来自nginx替换响应内容 - kenwar - 博客园 (cnblogs.com)

mysql

将MySQL8.0生成的sql文件,导入MySQL5.7版本时Unknown collation: 'utf8mb4_0900_ai_ci'

使用Navicat进行数据传输,并在选项中设置不包含字符集

Unknown collation: ‘utf8mb4_0900_ai_ci‘ 的解决方案-CSDN博客

Blog

批量替换图片链接为Stellar格式

正则表达式:!\[(.*?)\]\((https:\/\/onep\.hzchu\.top[^\?\)]+)(\?fmt=avif)?\)

替换内容:{% image $2$3 download:$2 $1 %}

注意:gallery内部只能填写 md 格式的图片

MCSM

节点无法找到主机java环境

1
2
3
4
nano /etc/systemd/system/mcsm-daemon.service
修改Environment字段,添加主机java路径(eg:/opt/jdk/bin)
systemctl daemon-reload
systemctl restart mcsm-daemon

Git

报错:error: You have not concluded your merge (MERGE_HEAD exists).

$

无权限写入组织仓库(GitHub)

  1. 完成组织权限设置

    Snipaste_2024-07-13_08-25-06
    Snipaste_2024-07-13_08-25-06
  2. 新建一个New fine-grained personal access tokenResource owner选择组织,权限处给予contents的读写权限

  3. 如果组织权限设置中开启了批准,则需回去在Pending requests里面启用

  4. 在本地仓库中运行

    $

Upgit

添加lskypro2上传扩展

\extensions\lskypro2.jsonc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
{
"meta": {
"id": "lskypro2",
"name": "LskyPro2 Uploader",
"type": "simple-http-uploader",
"version": "2.0.1",
"repository": ""
},
"http": {
"request": {
"url": "$(ext_config.host)/api/v1/upload",
"method": "POST",
"headers": {
"Content-Type": "multipart/form-data",
"Authorization": "$(ext_config.token)",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.80 Safari/537.36"
},
"body": {
"file": {
"type": "file",
"value": "$(task.local_path)"
},
"strategy_id": {
"type": "string",
"value": "$(ext_config.strategy_id)"
}
}
}
},
"upload": {
"rawUrl": {
"from": "json_response",
"path": "data.links.url"
}
}
}
UPGIT 配置
1
2
3
4
5
6
7
8
9
10
11
12
13
# =============================================================================
# UPGIT 配置
# =============================================================================

# 默认上传器
default_uploader = "lskypro2"

...

[uploaders.lskypro2]
host = "https://pic.hzchu.top"
token = "Bearer 1|0JWtJ222222222222222222222222222222222MM"
strategy_id = "3"

Flask

设置的定时任务会重复执行两次函数

原因:在调试模式下(debug),Flask的重新加载器将加载应用程序两次。因此flask总共有两个进程,重新加载器监视文件系统的更改并在不同的进程中启动真实应用程序。
解决办法:禁用重新加载器。在启动flask程序的run语句中,将添加use_reloader=False参数即可禁用重新加载器
关闭调试模式。同样地,在启动flask程序的run语句中,将debug=True改为debug=False即可关闭debug模式,在部署后真实的运行场景中都会关闭调试模式。

1
2
3
4
5
6
7
if __name__ == "__main__":
启动flask程序
# 直接启动,use_reloader=False禁用重新加载器
app.run(host="127.0.0.1", port=5000, debug=True, use_reloader=False) # 只能本机访问
# app.run(host="0.0.0.0", port=5000, debug=True, use_reloader=False) # 外网可以访问
# 以命令行方式启动
# manager.run()

原文链接:https://blog.csdn.net/qq_47527477/article/details/122904551

PY

hashlib

安装报错:

1
2
3
ERROR: Ignored the following yanked versions: 20081119
ERROR: Could not find a version that satisfies the requirement hashlib (from versions: none)
ERROR: No matching distribution found for hashlib

根本不用装

Artalk

  1. 无法保存emoji
1
2
3
ALTER DATABASE your_database_name CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
ALTER TABLE atk_comments CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE atk_comments MODIFY COLUMN content TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;