ZHYQ118

一个太过正常的人的自白

git安装

debian系

1
sudo apt install git

arch linux

1
sudo pacman -S git

macos

1
brew install git

设置git

设置提交用户名

1
git config --global user.name "Mona Lisa"

设置提交电子邮件

1
git config --global user.email "YOUR_EMAIL"

验证一下

1
2
git config --global user.name
git config --global user.email

设置GitHub

现在github已不能使用传统token的方式验证,网上大部分教程已失效,可采用官方推荐的gh(GitHub CLI)方式验证自己的账户。

安装gh

macos

1
brew install gh

debian系

1
2
3
4
5
6
type -p curl >/dev/null || (sudo apt update && sudo apt install curl -y)
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
&& sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& sudo apt update \
&& sudo apt install gh -y

arch linux

1
sudo pacman -S github-cli

验证账户

1
gh auth login

一直下一步即可完成账户验证。

本篇内容纯粹为了个人安装方便,并非完整的安装教程。因为太喜欢装系统,所以hexo也要不断安装,写下这篇之后希望可以加速安装时间,不用再到处查看文档。

Hexo安装

安装Node.js

Linux(DEB/RPM-based):从 NodeSource 安装
Ubuntu:

1
2
curl -fsSL https://deb.nodesource.com/setup_19.x | sudo -E bash - &&\
sudo apt install -y nodejs

安装git

Ubuntu

1
sudo apt install git

安装Hexo

1
npm install -g hexo-cli

建立网站

1
2
3
hexo init <folder> #建立文件夹并初始化
cd <folder>
npm install

新建文件夹目录如下

1
2
3
4
5
6
7
8
.  
├── _config.yml
├── package.json
├── scaffolds
├── source
| ├── _drafts
| └── _posts
└── themes

如果非首次安装,在之前备份的文件内,把scaffoldspublic文件夹、_config.yml_config.next.yml文件拷贝到新建立的网站文件夹内相应位置。

配置

_config.yml中修改网站配置

_config.next.yml中配置next主题

next主题安装及配置

安装

1
2
cd hexo-site
npm install hexo-theme-next

安装后,在系统配置文件_config.yml中设置

1
theme: next

配置

next官方现不推荐在主题目录下修改任何文件,目的是为了方便升级,这种做法很好。那么,现在需要复制一份配置文件进行编辑,根据官方文档 ,有多种方式,我选择第一种,方式如下:

1、在根目录创建一个配置文件
1
touch _config.next.yml
2、从主题目录复制配置文件到根目录
1
2
# Installed through npm
cp node_modules/hexo-theme-next/_config.yml _config.next.yml

我至今不明白此处第一步意义何在,因为第二步复制的同名文件会直接覆盖第一步建立的空文件。

然后,所有的配置都在复制到根目录的这个_config.next.yml中进行。

实际上,具体的配置文件可以直接复制之前备份的那个文件,通用。但是,因为有些依赖没有安装,所以导致运行hexo g 的时候总是报错,这也正是我写这篇纪录最大的原因。

个人使用的第三方插件需要安装这几个依赖:

字数统计显示(Post Wordcount)

Install hexo-word-counter by executing the following command in site root dir:

1
2
npm install hexo-word-counter  
hexo clean

然后在_config.next.yml 中把相应参数设置为 true
此处还需要在hexo配置文件_config.yml 中做相应设置,个人配置如下:

1
2
3
4
5
6
7
8
9
symbols_count_time:
symbols: true
time: true
total_symbols: true
total_time: true
exclude_codeblock: false
awl: 3
wpm: 275
suffix: "mins."

Install hexo-related-posts by executing the following command in site root dir:

1
2
npm install hexo-related-posts  
hexo clean

本地搜索(Local Search

Install hexo-generator-searchdb by executing the following command in site root dir:

1
npm install hexo-generator-searchdb

根据官方文档在hexo配置文件和next配置文件中做相应设置

上传到GitHub的补充设置

前面在安装好已经设置好git和GitHub,需要注意现在GitHub授权不要用token方式,太麻烦,可以直接采用GitHub CLI的方式进行认证。

想要使hexo d 成功运行,需要

1、在`_config.yml` 中添加以下内容
1
2
3
4
deploy: 
type: 'git'
repo: 'url'
branch: 'master'
2、安装相应插件
1
npm install hexo-deployer-git --save

有需要再完善。

安装配置中文输入法的方法如下:

首先安装fcitx5和fcitx5-pinyin:

apt-get install fcitx5 fcitx5-pinyin

接着在im-config(input method)中激活fcitx5作为输入方式。

打开fcitx5-configure,配置拼音输入法:

在右侧搜pinyin,然后添加到左边

然后用ctrl+space切换输入法,shift切换中英。

apt install firmware-iwlwifi

原文链接

Debian 11 Linux(bullseye) 可用的国内镜像源

Debian 默认的软件源在国外,使用默认源安装软件速度感人,浪费大量不必要的等待时间。所以在安装完 Deiban 系统后的首要事情就是更换为国内的镜像源,能显著提高软件安装和系统更新速度。本文收集了 8 个能用的 Debian 国内镜像源以供选择。

如果不熟悉 Debian 镜像源的使用和配置,请直接翻到最后。文末提供了手动和命令式的两种镜像源配置方式。

可用的国内源

由阿里云提供的 Debian 镜像源:

1
2
3
4
5
6
7
8
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

由腾讯提供的 Debian 镜像源:

1
2
3
4
5
6
7
8
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

由北京清华大学提供的 Debian 镜像源:

1
2
3
4
5
6
7
8
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

由中国科学技术大学提供的 Debian 镜像源:

1
2
3
4
5
6
deb http://mirrors.ustc.edu.cn/debian bullseye main contrib non-free
deb-src http://mirrors.ustc.edu.cn/debian bullseye main contrib non-free
deb http://mirrors.ustc.edu.cn/debian bullseye-updates main contrib non-free
deb-src http://mirrors.ustc.edu.cn/debian bullseye-updates main contrib non-free
deb http://mirrors.ustc.edu.cn/debian bullseye-proposed-updates main contrib non-free
deb-src http://mirrors.ustc.edu.cn/debian bullseye-proposed-updates main contrib non-free

由上海交通大学提供的 Debian 镜像源:

1
2
3
4
5
6
deb http://mirrors.sjtu.edu.cn/debian bullseye main contrib non-free
deb-src http://mirrors.sjtu.edu.cn/debian bullseye main contrib non-free
deb http://mirrors.sjtu.edu.cn/debian bullseye-updates main contrib non-free
deb-src http://mirrors.sjtu.edu.cn/debian bullseye-updates main contrib non-free
deb http://mirrors.sjtu.edu.cn/debian bullseye-proposed-updates main contrib non-free
deb-src http://mirrors.sjtu.edu.cn/debian bullseye-proposed-updates main contrib non-free

由北京外国语大学提供的 Debian 镜像源:

1
2
3
4
5
6
7
8
deb https://mirrors.bfsu.edu.cn/debian/ bullseye main contrib non-free
deb-src https://mirrors.bfsu.edu.cn/debian/ bullseye main contrib non-free
deb https://mirrors.bfsu.edu.cn/debian/ bullseye-updates main contrib non-free
deb-src https://mirrors.bfsu.edu.cn/debian/ bullseye-updates main contrib non-free
deb https://mirrors.bfsu.edu.cn/debian/ bullseye-backports main contrib non-free
deb-src https://mirrors.bfsu.edu.cn/debian/ bullseye-backports main contrib non-free
deb https://mirrors.bfsu.edu.cn/debian-security bullseye-security main contrib non-free
deb-src https://mirrors.bfsu.edu.cn/debian-security bullseye-security main contrib non-free

由华为提供的 Deiban 镜像源:

1
2
3
4
5
6
7
8
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

由网易提供的 Debian 镜像源:

1
2
3
4
5
6
7
8
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

手动更换镜像源

手动更换 Debian 镜像源配置主要分为以下三步:

  1. 用熟悉的文本编辑器打开 /etc/apt/sources.list 文件(需要 sudo 权限),或是直接执行 sudo apt edit-sources 命令。
  2. 替换文件内容为上面任意一个镜像站的源配置代码并保存。
  3. 运行 sudo apt-get update 命令更新软件索引。

命令更换镜像源

使用命令替换镜像源更为快捷。比如在没有更换过数据源的情况下,要使用阿里云的 Debian 镜像源:

1
sudo sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list

这样就完成了默认源到阿里云镜像源的配置。接下来同样需要执行一下 sudo apt-get update 命令更新软件索引。

上面这个命令的原理在镜像源的地址上。不同的镜像源通常只是域名有所区别,其他部分大致类似。所以之需要通过 sed 命令来修改 /etc/apt/sources.list 这个源配置文件中的域名地址就足够了。

但这意味着使用这个命令方式修改镜像源的配置时需要格外注意。如果输入的匹配地址或替换地址有误,有可能不会生效,或是导致镜像源异常。遇到这种情况,可以选择上面手动更换镜像源的方式来解决。

针对“普通用户提示用户名不在sudoers文件中,此事将被报告“,如此解决:

解决办法:

  1. 终端输入 su 回车,输入 root 密码,回车,切换到 root 用户
  2. 打开 sudoers 文件:vi /etc/sudoers
  3. 找到 # Allow members of group sudo to execute any command,在 %sudo ALL=(ALL:ALL) ALL 下面添加 xxx ALL=(ALL:ALL) ALL,xxx 为前面无法执行 sudo 命令的用户名

vi 给 sudoers 添加内容方法:

  1. 光标移动到指定位置,按 i 键当前光标位置插入
  2. 输入内容
  3. ESC
  4. 输入 :wq! 回车,因为 sudoers 是只读文件,所以要加 ! 强制保存。

在linux端操作

timedatectl set-local-rtc 1 --adjust-system-clock

1、下载最新版

[地址在此]
(https://github.com/Dreamacro/clash/releases)

2、解压缩

3、授予可执行权限

chmod +x clash

4、初始化

./clash

初始化执行 clash 会默认在 ~/.config/clash/ 目录下生成配置文件和全球IP地址库:config.yaml 和 Country.mmdb。

5、配置config.yaml

没找到自动下载订阅的方式,只能采取笨方法,从clash for windows 中导出配置,粘贴到~/.config/clash/ 目录下的config.yaml

6、运行,可添加守护进程

这样就不用一直打开一个terminal了。

./clash &

7、配置系统代理

找到网络-代理设置-手动
http 127.0.0.1:7890
socks 127.0.0.1:7890

socks端口存疑,也可能是7891。

8、网页管理

http://clash.razord.top/#/proxies

在Clover时代,被这个问题困扰已久,搜了无数解决方案都没成功,偶然看到一个叫做innie.kext,然后竟然神奇地发生了作用,可惜,升到macos11 big sur后,可能由于安全方面的原因,这个第三方kext不能被注入,所以,硬盘又重新被识别成了外置硬盘,好在现在终于也解决了,不过原教程是英文的,我就用中文转述一下,方便有同类问题的爱好者参考。

实际测试的是三星960 EVO NVME硬盘,其它同样问题的可以参考,不保证有效性。

操作步骤如下:

查找设备地址

1.下载hackintool

2.打开并找到PCIe标签,

3.查找设备名称,找到相应的设备地址,然后右击,选择**”Copy Device Path”*,就像这样的内容:“PciRoot(0x0)/Pci(0x1,0x1)/Pci(0x0,0x0)”。

OpenCore中内建

1.挂载EFI分区,并用ProperTree打开config.plist,

2.找到DeviceProperties/Add

​ · 右键点击Add增加一个子项目

​ · 名字命名为刚才拷贝的设备路径,如*”PciRoot(0x0)/Pci(0x1,0x1)/Pci(0x0,0x0)”.*

​ · Type类型选择**”Dictionary”.**

​ · 右键增加一个子项目,命名为**”built-in”, type改为“Data”, 并且把value值设为“01000000”**

3.至于Kernel-Quirks中的**”ExternalDiskIcons”**是否有必要设置成true请自己尝试,我是之前已经为true,也就懒得再取消了。

最终效果如下:截屏2021-01-21 22.23.22.png

4.记得保存config.plist,然后重启设备应该就生效了。

这就是所有步骤。

使用 SSH 连接

1.进入 ssh 目录

1
cd ~/.ssh

2.生成 SSH key (文件名:id_rsa, id_rsa.pub)

1
ssh-keygen -t rsa -C "xxxxxx@yy.com"  #填写自己真实有效的邮箱地址

3.文本编辑器打开公钥 id_rsa.pub 复制内容,添加到 Github setting。

4.测试

1
ssh -T git@github.com

You’ve successfully authenticated, but GitHub does not provide shell access.

hexo配置文件中选择git协议,不能用https

1
2
3
4
deploy:
type: 'git'
repo: 'git@github.com:xxx/xxx.github.io.git'
branch: 'master'