Visual Studio Code 以 root 用户调试

修改 launch.json

添加 pipeTransport,修改 debuggerPath 为你的 vsdbg 路径

"pipeTransport": {
                "pipeCwd": "${workspaceFolder}",
                "pipeProgram": "sudo",
                "pipeArgs": [ "-i" ],
                "debuggerPath": "/Users/yukino/vsdbg/vsdbg",
                "quoteArgs": false
}

下载安装 vsdbg

curl -sSL https://aka.ms/getvsdbgsh | proxychains4 bash /dev/stdin -v latest -l ~/vsdbg

注意这里有个坑!!!

MacOS 的默认应该是 vsdbg-osx-x64.zip ,直接执行上面的命令会变成下载 https://vsdebugger.azureedge.net/vsdbg-16-8-11005-1/vsdbg-osx-x64.tar.gz 然后下不下来,只能手动修改为 vsdbg-osx-x64.zip 然后手动下载解压,最后别忘了设置权限 chmod 755 ~/vsdbg

记一次 Ubuntu 使用 SkiaSharp 库出现的错误

环境

AWS LightSail
Ubuntu 20.04 LTS (GNU/Linux 5.4.0-1018-aws x86_64)
.net core 3.1

问题

使用 SkiaSharp.NativeAssets.Linux 库时出现错误

Unable to load shared library 'libSkiaSharp' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibSkiaSharp: cannot open shared object file: No such file or directory

解决方法

使用 ldd libSkiaSharp.so 查看缺少的链接库

linux-vdso.so.1 (0x00007ffc42ff5000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f470fa0f000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f470fa09000)
libfontconfig.so.1 =>  not found
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f470f873000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f470f681000)
/lib64/ld-linux-x86-64.so.2 (0x00007f471035f000)
libfreetype.so.6 => /lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007f470f5c2000)
libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007f470f592000)
libuuid.so.1 => /lib/x86_64-linux-gnu/libuuid.so.1 (0x00007f470f589000)
libpng16.so.16 => /lib/x86_64-linux-gnu/libpng16.so.16 (0x00007f470f551000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f470f535000)

可以看到第4行有一个 libfontconfig.so.1 => not found
通过 Google 很容易查到 libfontconfig.so.1libfontconfig1
使用 apt-get install libfontconfig1 安装相关的链接库即可

Emby 动画添加字幕脚本

最近看动画从 PT 站下了生肉,需要手动添加字幕,挨个添加显然太麻烦,写了个 python 脚本.

原理是 Emby 会自动扫描目录下和动画文件同名的字幕文件并加载.

import os

example_file_name = '[Snow-Raws] 新妹魔王の契約者 第<number>話 (BD 1920x1080 HEVC-YUV420P10 FLAC).mkv'
example_ass_name = '[Moozzi2] Shinmai Maou no Testament - <number> (BD 1920x1080 x.264 Flac).ass'
count = 1

while True:
    if count < 10:
        count_str = '0' + str(count)
    else:
        count_str = str(count)
    file_name = example_file_name.replace('<number>', count_str)
    ass_name = example_ass_name.replace('<number>', count_str)
    if os.path.isfile(file_name) & os.path.isfile(ass_name):
        os.rename(ass_name, os.path.splitext(file_name)[0] + os.path.splitext(ass_name)[1])
        print('替换 %s' % (ass_name))
        count += 1
    else:
        break

解压字幕到动画文件夹下, example_file_nameexample_ass_name 替换为动画和字幕名称,并用 <number> 替换剧集数,在动画文件夹下保存为 AssToAnime.py 然后 python3 AssToAnime.py 运行即可,回去看 Emby 就会有字幕出现了。

附上我常用的字幕网站:射手网