一些之前写的和加速镜像链接
脚本
python
替换字符
def replace_special_characters_in_file(file_path):
# 读取文件内容(指定编码方式为utf-8)
with open(file_path, 'r', encoding='utf-8') as file:
content = file.read()
# 替换特殊字符
replaced_content = content.replace('@', '{% psw ').replace('#', '%}')
# 将前边的`@`替换成`{% psw `和`#`替换成`%}`
# 将替换后的内容写回到原始文件中
with open(file_path, 'w', encoding='utf-8') as file:
file.write(replaced_content)
# 示例用法
md_file_path = 'E:/blog/md文档/安工/操作系统/复习资料.md' # 指定Markdown文件路径
replace_special_characters_in_file(md_file_path)
替换链接
def replace_link_prefix_in_folder(folder_path, old_prefix, new_prefix):
# 遍历指定文件夹中的所有文件
for root, dirs, files in os.walk(folder_path):
for file_name in files:
if file_name.endswith('.md'): # 仅处理 Markdown 文件
file_path = os.path.join(root, file_name)
# 读取文件内容(指定编码方式为utf-8)
with open(file_path, 'r', encoding='utf-8') as file:
content = file.read()
# 替换链接前缀
replaced_content = content.replace(old_prefix, new_prefix)
# 将替换后的内容写回到原始文件中
with open(file_path, 'w', encoding='utf-8') as file:
file.write(replaced_content)
# 示例用法
folder_path = 'E:\\blog\\hexo\\hexo-SourceRepo\\source\\_posts' # 指定文件夹路径
old_prefix = 'https://tc.aboyzy.top'
new_prefix = 'https://npm.elemecdn.com/aboyzy_blogstatic/'
replace_link_prefix_in_folder(folder_path, old_prefix, new_prefix)
加速链接
- Chinajsdelivr
https://jsd.cdn.zzko.cn/gh/aboyzy/pic_tuchuang@main
- jsdelivr
https://gcore.jsdelivr.net/gh/aboyzy/
- github下载加速
方式:https://cdn.jsdmirror.com/gh/user/repo@version/file.js
其他加速可查看 https://dodoo.co/prepare/mirror 或者 https://mirrors.cernet.edu.cn/
Docker 加速
近期Docker许多镜像都无法使用,在网上找了别人说还可以用的 记录一下方便替换 不保真
只需编辑/etc/docker/daemon.json这个文件即可(记得用sudo),替换为以下内容:
{
"registry-mirrors": [
"https://docker.1panel.live",
"https://hub.rat.dev"
]
}
重启 sudo systemctl restart docker
查看配置 sudo docker info
在最后存在即成功
Comments NOTHING