推荐一个正经的鼠标样式

Windows 自带的鼠标样式其实看着“中规中矩”,不说难看但是看习惯也就能用。macOS 的鼠标样式就很🉑。

之前搜索鼠标样式的时候去 GitHub 看了一下,果然还真有这么正经的鼠标样式 Apple Cursor

Open source macOS Cursors for Windows and Linux with HiDPI Support .

ful1e5/apple_cursor
68747470733a2f2f696d6775722e636f6d2f626d53306652542e706e67
68747470733a2f2f696d6775722e636f6d2f73306e71636a652e706e67

Windows 和 Linux 如何安装 README 里都有写清楚,我尝试安装并启用,效果非常不错,很“细腻”。

如果你感兴趣的话也可以下载并安装尝试一下。

改变 Windows 用户文件夹默认路径 C:/Users

Windows 默认的总用户文件夹总是会在系统盘下,如果你的系统盘为 C 盘,则为: C:\Users ,许多默认文件夹也都会放在这里:

  • 文档、桌面、下载、图片、视频等文件夹都默认在这里,这些文件夹倒是可以改变位置
  • AppData 文件夹默认在用户根目录下,存储了大部分软件的数据、配置,无法被改变位置
  • .config / .ssh / .config / scoop 等配置目录也在用户根目录下,无法改变位置
  • 许多软件的默认数据位置

系统盘符:\Users\用户名\AppData 里面一般有三个文件夹,分别是 Local / LocalLow / Roaming ,简单地来说,都是用来存放软件的配置文件和临时文件的,里面有很多以软件名称或软件公司命名的文件夹,还有用户帐户的配置文件。随着系统使用时间的增加和安装软件的增多, AppData 占用的空间会越来越大。

上面这些目录会导致系统盘占用很大,即使其中有部分可以手动指派其它路径,但是每次指定都很麻烦,重装系统时候备份也不方便(用户目录里有许多细碎的小文件,备份非常慢),还不如将用户目录迁出系统盘,所有软件都用默认路径,多省事。

另外,修改了用户路径后,当安装软件只为用户安装时,默认的安装路径也会到你的用户目录所在盘,大大节省了系统盘空间。

安装 Windows 的时候修改默认用户路径(推荐)

正常安装 Windows

当 Windows 连接到网络的时候有时 Sysprep 会失败,所以建议全程关闭网络连接安装系统。安装系统的方法不多做介绍。安装系统重启后停留在选择地区的配置界面。

进入 Audit Mode(审计模式)

在系统配置选择地区的界面,按下 Ctrl + Shift + F3 ,这时 Windows 会重启,进入 Audit Mode ,然后显示一个 System Preparation Tool(系统准备工具) ,点击取消,将它关闭。

新建 relocate.xml

现在你可以将电脑连接到网络了。

接下来我们要使用 System Preparation Tool (Sysprep) 工具来设置用户路径。这个工具会执行一个 xml 文件中的配置(也就是 relocate.xml)。我们现在只需要一个非常简单的 xml配置文件,只需包含以下内容:

  • Windows 的版本(32 或 64 位)
  • 用户文件夹的新路径(例如 D:/Users

新建 relocate.xml ,并使用记事本打开拷贝以下代码:

<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
	<settings pass="oobeSystem">
		<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
			<FolderLocations>
				<ProfilesDirectory>D:\Users</ProfilesDirectory>
			</FolderLocations>
		</component>
	</settings>
</unattend>
警告,在操作之前,请先读一下这个:
1. Windows 以字母来标识盘符,但是当安装了 Windows 重启之后,本来你想把用户目录安装到 d 盘,但这个盘符可能会发生改变,比如变成了 e 盘,这个时候就会失败,所以一定要确定好盘符。
2. xml 文件保存到磁盘根目录(不能是 C 盘),例如我把它保存到了 D:\relocate.xml
3. 部分计算机在 Audit Mode 下因为缺少驱动,键盘无法使用,可以借助其他计算机编写,并拷贝,也可以完全用鼠标操作完成,看个人能力。

运行 Sysprep

以管理员身份运行 cmd,首先确保已停止 WMP Network Sharing Service 服务:

net stop wmpnetworksvc

然后运行以下命令:

%windir%\system32\sysprep\sysprep.exe /oobe /reboot /unattend:d:\relocate.xml

上述命令告诉系统从 Windows\System32\Sysprep 运行 Sysprep,执行 D:/relocate.xml 中的指令,为 OOBE (the firlst boot of newly installed Windows) 重启准备系统,最后重启。

完成

完成上述操作后,自动重启进入系统,检查 User 目录已经移动到了 D 盘。

在已经安装好的 Windows 系统上迁移用户目录

警告:操作之前,一定要先创建一个系统映像,做好备份。
对一个 OEM 预先安装的 Windows 使用 Sysprep 是非常危险的。电脑厂商可能有他们自己的 unattended answer file,这样可能就会忽略掉你的 unattended file。在这个过程中可能会出各种错误,所以不建议操作。
如果中途出错了,你的备份文件可以帮助你恢复。
这个操作非常有可能导致你的电脑恢复出厂设置。
警告****1703 或者更高版本,请不要禁用已存在的用户!!!
在 Win10 1703 或更高版本上,千万不要禁用现有用户,因为禁用现有用户可能会让你无法登录 Windows,进而需要重装。

新建 relocate.xml

按照上面说过的步骤新建一个 relocate.xml 文件。

运行 Sysprep

按照上面说过的步骤运行 Sysprep

OOBE

虽然你已经安装了 Windows,但是在 Sysprep 运行之后 OOBE 仍然会运行,这意味着你的电脑会经历初始化程序。

这里有两点需要注意:

  • Windows 要求你输入产品密钥,但是不需要去输入,单击跳过就可以了;
  • 之前的账户还会存在,但是 OOBE 会要求新建一个用户,如果新建的这个用户和已存在的用户名字相同,那就会发生错误。只需要新建一个随意的账户,之后,再把它删掉就可以了;

引用

Windows 如何删除右键菜单中的 “Git Gui Here”和“Git Bash Here”

今天重新安装了 Git 后,发现右击鼠标右侧多出了两个选项“Git Gui Here”和“Git Bash Here”。虽然这样证明我的 Git 已经成功安装了,但还是影响使用感受,遂上网寻找了一下相关的解决方案。

手动修改注册表

  1. Win + R 调出“运行”窗口,在搜索框中输入“regedit”打开注册表编辑器;
  2. 在打开的注册表中通过以下路径进行查找: Computer\HKEY_CLASSES_ROOT\Directory\Background\shell 。在下方就可以看到 git_guigit_shell 这两项内容,将其删除即可。
  3. 关闭注册表之后,在桌面上右击鼠标就能看到 “Git Gui Here”和“Git Bash Here”选项就已经被删除了。

直接使用管理员 CMD(命令提示符)执行删除

如果上述方法比较繁琐,可以尝试使用具有管理员权限的 CMD(命令提示符) 执行以下两条语句:

reg delete "HKEY_CLASSES_ROOT\Directory\Background\shell\git_gui" /f
reg delete "HKEY_CLASSES_ROOT\Directory\Background\shell\git_shell" /f

Debian 软件仓库镜像

一般情况下,将 /etc/apt/sources.list 文件中 Debian 默认的源地址 http://deb.debian.org/ 替换为镜像地址即可。

Debian Buster 以上版本默认支持 HTTPS 源。如果遇到无法拉取 HTTPS 源的情况,请先使用 HTTP 源并安装:

sudo apt install apt-transport-https ca-certificates

Debian Bookworm 12 软件仓库镜像源

清华大学开源软件镜像站

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware

deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware

deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware

# deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware
# # deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware

deb https://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
# deb-src https://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware

阿里云镜像站

deb https://mirrors.aliyun.com/debian/ bookworm main non-free non-free-firmware contrib 
deb-src https://mirrors.aliyun.com/debian/ bookworm main non-free non-free-firmware contrib
deb https://mirrors.aliyun.com/debian-security/ bookworm-security main
deb-src https://mirrors.aliyun.com/debian-security/ bookworm-security main
deb https://mirrors.aliyun.com/debian/ bookworm-updates main non-free non-free-firmware contrib
deb-src https://mirrors.aliyun.com/debian/ bookworm-updates main non-free non-free-firmware contrib
deb https://mirrors.aliyun.com/debian/ bookworm-backports main non-free non-free-firmware contrib
deb-src https://mirrors.aliyun.com/debian/ bookworm-backports main non-free non-free-firmware contrib

腾讯云镜像站

deb https://mirrors.tencent.com/debian/ bookworm main non-free non-free-firmware contrib
deb-src https://mirrors.tencent.com/debian/ bookworm main non-free non-free-firmware contrib
deb https://mirrors.tencent.com/debian-security/ bookworm-security main
deb-src https://mirrors.tencent.com/debian-security/ bookworm-security main
deb https://mirrors.tencent.com/debian/ bookworm-updates main non-free non-free-firmware contrib
deb-src https://mirrors.tencent.com/debian/ bookworm-updates main non-free non-free-firmware contrib
deb https://mirrors.tencent.com/debian/ bookworm-backports main non-free non-free-firmware contrib
deb-src https://mirrors.tencent.com/debian/ bookworm-backports main non-free non-free-firmware contrib

网易镜像站

deb https://mirrors.163.com/debian/ bookworm main non-free non-free-firmware contrib
deb-src https://mirrors.163.com/debian/ bookworm main non-free non-free-firmware contrib
deb https://mirrors.163.com/debian-security/ bookworm-security main
deb-src https://mirrors.163.com/debian-security/ bookworm-security main
deb https://mirrors.163.com/debian/ bookworm-updates main non-free non-free-firmware contrib
deb-src https://mirrors.163.com/debian/ bookworm-updates main non-free non-free-firmware contrib
deb https://mirrors.163.com/debian/ bookworm-backports main non-free non-free-firmware contrib
deb-src https://mirrors.163.com/debian/ bookworm-backports main non-free non-free-firmware contrib

华为云镜像站

deb https://mirrors.huaweicloud.com/debian/ bookworm main non-free non-free-firmware contrib
deb-src https://mirrors.huaweicloud.com/debian/ bookworm main non-free non-free-firmware contrib
deb https://mirrors.huaweicloud.com/debian-security/ bookworm-security main
deb-src https://mirrors.huaweicloud.com/debian-security/ bookworm-security main
deb https://mirrors.huaweicloud.com/debian/ bookworm-updates main non-free non-free-firmware contrib
deb-src https://mirrors.huaweicloud.com/debian/ bookworm-updates main non-free non-free-firmware contrib
deb https://mirrors.huaweicloud.com/debian/ bookworm-backports main non-free non-free-firmware contrib
deb-src https://mirrors.huaweicloud.com/debian/ bookworm-backports main non-free non-free-firmware contrib

Debian Bullseye 11 软件仓库镜像源

网易镜像站

#http://mirrors.163.com/debian/为软件源也可以为其他的 bullseye为版本代号 main non-free contrib区别如下
deb https://mirrors.163.com/debian/ bullseye main non-free contrib
deb-src https://mirrors.163.com/debian/ bullseye main non-free contrib
deb https://mirrors.163.com/debian-security/ bullseye-security main
deb-src https://mirrors.163.com/debian-security/ bullseye-security main
deb https://mirrors.163.com/debian/ bullseye-updates main non-free contrib
deb-src https://mirrors.163.com/debian/ bullseye-updates main non-free contrib
deb https://mirrors.163.com/debian/ bullseye-backports main non-free contrib
deb-src https://mirrors.163.com/debian/ bullseye-backports main non-free contrib

腾讯云镜像站

deb https://mirrors.tencent.com/debian/ bullseye main non-free contrib
deb-src https://mirrors.tencent.com/debian/ bullseye main non-free contrib
deb https://mirrors.tencent.com/debian-security/ bullseye-security main
deb-src https://mirrors.tencent.com/debian-security/ bullseye-security main
deb https://mirrors.tencent.com/debian/ bullseye-updates main non-free contrib
deb-src https://mirrors.tencent.com/debian/ bullseye-updates main non-free contrib
deb https://mirrors.tencent.com/debian/ bullseye-backports main non-free contrib
deb-src https://mirrors.tencent.com/debian/ bullseye-backports main non-free contrib

阿里云镜像站

deb https://mirrors.aliyun.com/debian/ bullseye main non-free contrib
deb-src https://mirrors.aliyun.com/debian/ bullseye main non-free contrib
deb https://mirrors.aliyun.com/debian-security/ bullseye-security main
deb-src https://mirrors.aliyun.com/debian-security/ bullseye-security main
deb https://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib
deb-src https://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib
deb https://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib
deb-src https://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib

华为云镜像站

deb https://mirrors.huaweicloud.com/debian/ bullseye main non-free contrib
deb-src https://mirrors.huaweicloud.com/debian/ bullseye main non-free contrib
deb https://mirrors.huaweicloud.com/debian-security/ bullseye-security main
deb-src https://mirrors.huaweicloud.com/debian-security/ bullseye-security main
deb https://mirrors.huaweicloud.com/debian/ bullseye-updates main non-free contrib
deb-src https://mirrors.huaweicloud.com/debian/ bullseye-updates main non-free contrib
deb https://mirrors.huaweicloud.com/debian/ bullseye-backports main non-free contrib
deb-src https://mirrors.huaweicloud.com/debian/ bullseye-backports main non-free contrib

清华大学开源软件镜像站

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free

deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free

deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free

# deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free
# # deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free

deb https://security.debian.org/debian-security bullseye-security main contrib non-free
# deb-src https://security.debian.org/debian-security bullseye-security main contrib non-free

引用

Debian 软件仓库镜像使用帮助 —— 清华大学开源软件镜像站

Docker 相关容器配置

更新时间:2023年7月11日
– 新增 qbittorrent

自从服务器重置以后,重新安装了 Docker,下面记录一下正在使用的容器和相关配置内容。

创建容器间网络

docker network create -d bridge individual

Nginx

docker run -d \
--name nginx \
-p 80:80 \
-p 443:443 \
-v $PWD/nginx/html:/usr/share/nginx/html \
-v $PWD/nginx/nginx.conf:/etc/nginx/nginx.conf \
-v $PWD/nginx/log:/var/log/nginx \
-v $PWD/nginx/cert:/etc/nginx/cert \
-v $PWD/nginx/conf.d/default.conf:/etc/nginx/conf.d/default.conf \
--restart=always \
nginx

MySQL

docker run -d \
--name mysql \
-p 3306:3306 \
-v $PWD/mysql/log:/var/log/mysql \
-v $PWD/mysql/data:/var/lib/mysql \
-v $PWD/mysql/conf:/etc/mysql \
-e MYSQL_ROOT_PASSWORD=123456 \
--restart=always \
--network individual mysql --lower_case_table_names=1

MySQL 密码修改

ALTER USER 'root'@'%' IDENTIFIED WITH [mysql_native_password, caching_sha2_password] BY '123456';

MySQL 配置

进入 $PWD/mysql/conf/conf.d/ 创建 mysqld.cnf 文件,粘贴以下内容:

[mysqld]
performance_schema_max_table_instances=400
table_definition_cache=400 #缓存
performance_schema=off #用于监控MySQL server在一个较低级别的运行过程中的资源消耗、资源东西
table_open_cache=64 #打开表的缓存
innodb_buffer_pool_chunk_size=64M #InnoDB缓冲池大小调整操作的块大小
innodb_buffer_pool_size=64M #InnoDB 存储引擎的表数据和索引数据的最大内存缓冲区大小

phpMyAdmin

docker run -d \
--name phpmyadmin \
--network individual \
-e PMA_HOST="mysql" \
-p 80:80 \
--restart=always \
phpmyadmin

Redis

创建目录:
mkdir -p $PWD/redis/conf
创建文件:
touch $PWD/redis/conf/redis.conf

docker run -d \
--name redis \
-p 6379:6379 \
--network individual \
-v $PWD/redis/data:/data \
-v $PWD/redis/conf:/etc/redis \
--restart=always \
redis \
redis-server /etc/redis/redis.conf \
--appendonly yes

Warchtowe

docker run -d \
--name watchtower \
--restart=always \
-v /var/run/docker.sock:/var/run/docker.sock  \
containrrr/watchtower \
--cleanup \
-i 3600

WordPress

docker run -d \
--name wordpress \
--network individual \
--restart=always \
-v $PWD/wordpress:/var/www/html \
-p 8080:80 \
wordpress

Vaultwarden

docker run -d \
--name vaultwarden \
--restart=always \
-v $PWD/vaultwarden:/data \
-p 80:80 \
vaultwarden/server:latest

QianDao

docker run -d \
--name qiandao \
--restart=always \
-p 80:80 \
-v $(pwd)/qiandao/config:/usr/src/app/config \
a76yyyy/qiandao

QingLong

docker run -dit \
--name qinglong \
--restart=always \
-p 5775:5700 \
-v $PWD/ql:/ql/data \
whyour/qinglong:latest

qbittorrent

docker run -d \
  --name=qbittorrent \
  -e PUID=1000 \
  -e PGID=1000 \
  -e TZ=Asia/Shanghai \
  -e WEBUI_PORT=8090 \
  -p 9821:6881 \
  -p 9821:6881/udp \
  -p 8090:8090 \
  -v /data/qbittorrent/config:/config \
  -v /data/qbittorrent/downloads:/downloads \
  --restart=always \
  lscr.io/linuxserver/qbittorrent:latest

从 npm 迁移到 pnpm

目前自己写的项目都是使用的是 npm,但是昨天偶然看到了介绍,想把自己的项目从 npm 替换为 pnpm,遂上网搜索了一下迁移教程。

介于 npm 与 pnpm 的区别,可以浏览我先前发布的文章:《npm、yarn、pnpm 各自区别》。

如何将 npm 迁移到 pnpm

需要执行以下步骤:

1. 卸载 npm

首先,将 npm 包从当前项目中卸载

rm -rf node_modules

2. 安装 pnpm

安装 pnpm ,以便可以在项目中使用它

npm install -g pnpm

3. 创建配置文件

在项目目录下创建 .npmrc 的文件

# pnpm 配置
shamefully-hoist=true
auto-install-peers=true
strict-peer-dependencies=false

4. 转换相关文件

package-lock.jsonyarn.lock 转成 pnpm-lock.yaml 文件,保证依赖版本不变

pnpm import

5. 安装依赖包

通过 pnpm 安装依赖包

pnpm install

最后,迁移完成!

在项目正常运行之后,可以删除原本的 package-lock.jsonyarn.lock 文件,保持项目的整洁。