MoreRSS

site iconiMaeGoo | 虹墨修改

95后前端开发者,居住郑州,擅长前端技术,分享个人学习记录。
请复制 RSS 到你的阅读器,或快速订阅到 :

Inoreader Feedly Follow Feedbin Local Reader

iMaeGoo | 虹墨的 RSS 预览

卸载百度网盘智能看图

2025-09-02 08:00:00

复制代码,粘贴到记事本,保存为 bat 文件,右键以管理员身份运行。

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
37
38
39
@echo off

echo 百度网盘智能看图卸载工具
echo 请以管理员身份运行此脚本!
echo.

echo 正在删除注册表项...
:: 删除HKEY_CLASSES_ROOT\BaiduNetdiskImageViewerAssociations
taskkill /f /im BaiduNetdisk.exe >nul 2>nul
reg delete "HKEY_CLASSES_ROOT\BaiduNetdiskImageViewerAssociations" /f >nul 2>nul

:: 删除HKEY_CURRENT_USER\Software\Baidu\BaiduNetdiskImageViewer
reg delete "HKEY_CURRENT_USER\Software\Baidu\BaiduNetdiskImageViewer" /f >nul 2>nul

:: 删除HKEY_CURRENT_USER\Software\RegisteredApplications\BaiduNetdiskImageViewer
reg delete "HKEY_CURRENT_USER\Software\RegisteredApplications" /v "BaiduNetdiskImageViewer" /f >nul 2>nul

echo.
echo 正在删除文件夹...
:: 安装位置不确定,但开始菜单中一定有快捷方式,通过快捷方式读取百度网盘的安装位置
for /f "usebackq delims=" %%I in (`
powershell -NoLogo -NoProfile -Command ^
"(New-Object -COM WScript.Shell).CreateShortcut('%APPDATA%\Microsoft\Windows\Start Menu\Programs\百度网盘\百度网盘.lnk').TargetPath"
`) do (
set "installDir=%%~dpI"
)
set "installDir=%installDir:~0,-1%"
echo 百度网盘安装位置:%installDir%

:: 查找并删除百度网盘根目录中的ImageViewer文件夹
for /d %%i in ("%installDir%", "C:\Program Files\Baidu\BaiduNetdisk") do (
if exist "%%i\module\ImageViewer" (
rd /s /q "%%i\module\ImageViewer"
)
)

echo.
echo 百度网盘智能看图卸载完成!
pause

CDN 方式引入 Monaco Editor

2025-09-01 17:30:00

在前端工程中可以用 @monaco-editor/loader 来引入 Monaco,但有时候我们的前端项目不依赖 Webpack、Vite 等打包工具,如何在普通网页中用纯 CDN 的方式引入 Monaco Editor?

代码

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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8" />
<title>Monaco Editor</title>
<style>
body {
margin: 0;
padding: 0;
}
#editor {
width: 100vw;
height: 100vh;
}
</style>
</head>
<body>
<div id="editor"></div>
<script src="https://registry.npmmirror.com/monaco-editor/0.52.2/files/min/vs/loader.js"></script>
<script>
require.config({
paths: {
vs: "https://registry.npmmirror.com/monaco-editor/0.52.2/files/min/vs",
},
});
window.MonacoEnvironment = {
getWorkerUrl: function (workerId, label) {
return `data:text/javascript;charset=utf-8,${encodeURIComponent(
'self.MonacoEnvironment={baseUrl:"https://registry.npmmirror.com/monaco-editor/0.52.2/files/min/"};' +
'importScripts("https://registry.npmmirror.com/monaco-editor/0.52.2/files/min/vs/base/worker/workerMain.js");'
)}`;
},
};
require(["vs/editor/editor.main"], function () {
const editorElement = document.getElementById("editor");
const editor = monaco.editor.create(editorElement, {
value:
"function main() {\n console.log('Hello, iMaeGoo!');\n}\n\nmain();\n",
language: "javascript",
});
window.addEventListener("resize", () =>
editor.layout({
width: editorElement.offsetWidth,
height: editorElement.offsetHeight,
})
);
});
</script>
</body>
</html>

效果

在线工具 - 富文本转 Markdown

2025-09-01 12:30:00

只需在以下文本框中粘贴网页或 Word 文档的内容,即可转换为 Markdown 格式!

与网上现有工具相比,这个能支持表格转换!

粘贴网页内容 / Word 文档内容

转换后的 Markdown 内容

2025 年了,安卓平板上什么第三方九键输入法最好用?

2025-08-25 12:00:00

题外话,我换过好多平板,我理想中的平板是 11 寸,这个大小不至于太重,又不至于屏幕太小,要搭载顶级处理器,玩游戏不卡顿,最好支持解锁 BL。

第一台平板是 iPad Pro 2018 11 寸,这个平板陪伴了我整整 6 年,依然流畅如新,奈何现如今带不动绝区零等大型游戏了,卖掉了。

第二台平板是小米平板 7,太卡!本来澎湃就吃硬件,还用了个 7+ Gen 3,掉帧死机家常便饭,还无法通过小米的解锁考试,卖掉了。

第三台是一加平板 2 Pro,顶级配置,一个 fastboot 命令就能轻松解锁,然而第一次用 13 寸,好重啊,躺着更是没法玩,使用频率都降低了,卖掉了。

第四台也就是现在用的,联想拯救者 Y700,虽然 8 寸是小了点,但毕竟很轻,很容易就接受了。

联想平板系统就像毛坯房,预装的输入法功能实在太少,决定装一个第三方的输入法,于是考虑如下选择:

  • Gboard(谷歌)
  • 百度输入法
  • 搜狗输入法
  • 讯飞输入法
  • 微信输入法

首先我是一位九键用户,九键在横屏模式下好不好用是我选择一个输入法的重要标准,我认为理想的九键布局,是我正在使用的 VIVO 输入法的布局,这种布局能够在横屏(或者展开形态的折叠屏)状态时,轻松单手打字。

其次是支持剪切板、个性短语,方便快速输入地址、手机号等信息,这基本上已经是各家标配功能了。

Gboard

谷歌出品的输入法在风格上完全遵守自家的设计规范,英文键盘更加贴近实体键盘的键位,很容易上手,然而九键在横屏下不支持分屏,横屏打字就比较难受了。

百度输入法

百度输入法的九键布局是我最喜欢的,自定义程度也很高,能合能分,但在联想平板上有一个 bug,清理后台会导致百度输入法失去默认输入法地位,每次清后台都要去重新设置回百度输入法,折腾几次就不想用了。

百度输入法小米版

小米版中文和原版相同,英文是和 Gboard 一样的实体键盘布局,但在联想平板上有一个 bug,每次弹出键盘都要弹出用户须知:

不管是同意还是拒绝,下次还会弹出,权限管理中授予了所有权限也不行,酷安里也看到有相同的反馈,但没有找到解决方案,遂放弃研究。

搜狗输入法

搜狗输入法的九键布局有两个奇怪的地方:

  1. 数字键 1 会显示为「分词」,去设置中关闭分词功能可以变回来,但没有分词就不能方便地打出「西安」、「酷安」这类词了;
  2. 符号中有一个歪歪扭扭的 .COM,还不能改,强迫症实在看不下去了。

讯飞输入法

讯飞九键中间可以手写,这个设计让人眼前一亮,但它占了很大的空间,无法调整,我用手写的频率是很少的,没必要为了这个牺牲九键的空间。

微信输入法

微信输入法相比百度和搜狗,界面更加简洁干净无广告,和其他输入法数字键+九键的布局不同,微信一边是选词区,一边是九键,这种布局一开始不太适应,但用两分钟就会发现,选词的使用频率是高于数字键盘的,更大的选词区确实方便不少。微信输入法还直接支持外接键盘打字,外接键盘不用来回切换输入法了:

一个星期体验下来也没有什么明显的 bug。要说缺点,就是导入词库有点难搞,我 PC 上的主力输入法是 Rime 小狼毫,要是微信能直接导入 txt 词库就方便了。

经过以上对比,最后我选择了微信输入法。

鸿蒙 PC 编译运行 Electron 应用

2025-08-25 08:00:00

华为推出的 MateBook Pro 首次搭载了鸿蒙 PC 操作系统,使其能够直接运行鸿蒙手机应用和鸿蒙平板应用,但仅仅这样只能称得上是『大号平板』。

Electron 框架是优秀的跨平台客户端框架,通过改造,鸿蒙 PC 上也能运行 Electron 应用,具体如何操作呢?

编译 Electron

可以自己编译,也可以用华为预编译好的版本。

自己编译

参考文档:https://gitcode.com/openharmony-sig/electron

编译环境必须使用 Ubuntu 22.04,可以用虚拟机。

编译耗时很长,我用 8 核虚拟机 跑了大概 8 个小时左右,如无特殊需求建议用华为预编译好的版本。

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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# 安装工具git-lfs, ccache。注:该步骤仅在首次拉取代码时需要执行
sudo apt install -y git-lfs ccache curl python3 python-is-python3 python3-pip
python --version
pip --version

# 下载码云repo工具(可以参考码云帮助中心:https://gitee.com/help/articles/4316)
mkdir -p ~/bin
curl https://gitee.com/oschina/repo/raw/fork_flow/repo-py3 > ~/bin/repo
chmod a+x ~/bin/repo
echo 'export PATH=~/bin/:$PATH' >> ~/.bashrc
source ~/.bashrc
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple requests

# 通过NodeSource仓库安装node和npm
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt install -y nodejs
node -v
npm -v

# 使用https拉取chromium-electron代码
git clone -b master https://gitcode.com/openharmony-sig/electron.git

# 执行命令`git lfs pull`,确保仓库中的大文件已经下载完成
cd electron
git lfs pull

# 拉取chromium-electron对应的ohos chromium代码
git config --global user.name "iMaeGoo"
git config --global user.email "[email protected]"
repo init -u https://gitcode.com/openharmony-tpc/manifest.git -b pc_chromium_132 -m pc_chromium_132_20251106.xml --no-repo-verify
repo sync -c # 可以执行多次,以确保代码全部拉取成功
repo forall -c 'git lfs pull' # 可执行多次,以确保大文件全部拉取成功

# 应用chromium-electron的patch到ohos chromium
pushd src
find -name "*.git*" -exec rm -rf "{}" \;
popd
chmod +x override_files.sh
./override_files.sh

# 运行 Electron实际目录/src/build/install-build-deps.sh脚本,安装编译所需的软件包。注:该步骤仅在首次拉取代码时需要执行
sudo ./src/build/install-build-deps.sh --no-chromeos-fonts

# 运行脚本electron_build.sh
./electron_build.sh

# 可以通过如下脚本拷贝所需资源(注:请参考修改为自己的source_path)
source_path=./Electron实际目录/src/out/musl_64
destination_path=./electron
if [ -d ${destination_path} ];then
rm -rf ${destination_path}
fi
mkdir ${destination_path}
cp ${source_path}/libelectron.so ${destination_path}
cp ${source_path}/libffmpeg.so ${destination_path}
cp ${source_path}/libadapter.so ${destination_path}
cp ${source_path}/electron ${destination_path}
cp ${source_path}/icudtl.dat ${destination_path}
cp ${source_path}/v8_context_snapshot.bin ${destination_path}
cp ${source_path}/chrome_100_percent.pak ${destination_path}
cp ${source_path}/chrome_200_percent.pak ${destination_path}
cp ${source_path}/resources.pak ${destination_path}
mkdir ${destination_path}/locales
cp ${source_path}/locales/zh-CN.pak ${destination_path}/locales
cp ${source_path}/locales/en-US.pak ${destination_path}/locales

使用预编译版本

没有调用 addon 和 ArkTS 的需求时可以直接使用以下二进制 release 包进行开发。

  1. 获取最新日期的二进制 release 包,华为账号登录仓库,下载默认 Electron 34 的 release 包。

  2. 解压

搭建环境

安装 DevEco Studio,目前是 5.1.0,最新版即可

https://developer.huawei.com/consumer/cn/download/

配置环境变量,这样以后能方便地使用 hdc 等命令

假设安装路径是 D:\dev\DevEcoStudio,就在 PATH 中增加 D:\dev\DevEcoStudio\sdk\default\openharmony\toolchains

运行项目

打开 DevEco,打开前面编译/下载好的项目 ohos_hap

首次运行需要证书,按提示登录华为账号即可生成证书

跑起来的效果,按 Ctrl + Alt + I 可以打开调试

Electron 的入口点在 src/main/resources/resfile/resources/app/main.js,修改后重新运行即可看到效果

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
const { app, BrowserWindow, Tray, nativeImage } = require('electron');
const path = require('path');

let mainWindow, tray;

function createWindow() {
tray = new Tray(nativeImage.createFromPath(path.join(__dirname, 'electron_white.png')));
mainWindow = new BrowserWindow({
width: 800,
height: 600,
});
mainWindow.setWindowButtonVisibility(true);
mainWindow.loadURL('https://caiyunapp.com/map/');
}
app.whenReady().then(createWindow);

bat 脚本打印输出彩色文字

2025-08-06 08:00:00

要在 Windows 批处理脚本中打印彩色内容,通常的方式是 echo [32mHello World[0m,但这种方式需要输入特殊字符 ESC(ASCII 码为 27),我试过 Alt+027 的快捷键却怎么也打不出来这个字符,而且这种方式各个颜色的编码也很不好记,分享一种更简单的方法!

https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/write-host

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
powershell -Command "Write-Host 'This is Black' -ForegroundColor White -BackgroundColor Black"
powershell -Command "Write-Host 'This is DarkBlue' -ForegroundColor White -BackgroundColor DarkBlue"
powershell -Command "Write-Host 'This is DarkGreen' -ForegroundColor White -BackgroundColor DarkGreen"
powershell -Command "Write-Host 'This is DarkCyan' -ForegroundColor White -BackgroundColor DarkCyan"
powershell -Command "Write-Host 'This is DarkRed' -ForegroundColor White -BackgroundColor DarkRed"
powershell -Command "Write-Host 'This is DarkMagenta' -ForegroundColor White -BackgroundColor DarkMagenta"
powershell -Command "Write-Host 'This is DarkYellow' -ForegroundColor White -BackgroundColor DarkYellow"
powershell -Command "Write-Host 'This is Gray' -ForegroundColor Black -BackgroundColor Gray"
powershell -Command "Write-Host 'This is DarkGray' -ForegroundColor White -BackgroundColor DarkGray"
powershell -Command "Write-Host 'This is Blue' -ForegroundColor White -BackgroundColor Blue"
powershell -Command "Write-Host 'This is Green' -ForegroundColor White -BackgroundColor Green"
powershell -Command "Write-Host 'This is Cyan' -ForegroundColor Black -BackgroundColor Cyan"
powershell -Command "Write-Host 'This is Red' -ForegroundColor White -BackgroundColor Red"
powershell -Command "Write-Host 'This is Magenta' -ForegroundColor White -BackgroundColor Magenta"
powershell -Command "Write-Host 'This is Yellow' -ForegroundColor Black -BackgroundColor Yellow"
powershell -Command "Write-Host 'This is White' -ForegroundColor Black -BackgroundColor White"

其中单引号内是打印的文字内容,ForegroundColor 参数传文字颜色,BackgroundColor 参数传背景颜色,直接传颜色名字,非常方便。

如果在批处理中使用,可以定义一个函数,调用起来更简洁。

1
2
3
4
5
6
7
8
9
@echo off

call :print "Hello, world!" Yellow Red
call :print "Hello, iMaeGoo!" White Blue
exit /b 0

:print
powershell -Command "Write-Host '%1' -ForegroundColor %2 -BackgroundColor %3"
goto:eof

效果