Tachibana Yuuki's Blog

∄

树莓派默认的分辨率是480p……其酸爽程度自行体会……

ssh连上树莓派,一句话解决分辨率问题:

1
vncserver -geometry 1920x1080

当然,这么做只能暂时性地解决问题。其原理是启动了另一个VNC Server进程

一劳永逸的方法是改设置:

1
sudo vi /etc/sysconfig/vncservers

配置文件简明易懂,记得备份好就行。

参考:


新系统的/etc/sysconfig貌似移动到了别处,可用sudo raspi-config > 2 Display Options > D1 Resolution设置分辨率,这会同时应用到显示器和VNC。

每次打开apt,改hosts都要输密码,烦死了……

键入命令:

1
sudo visudo

若不能,直接开启配置文件:

1
sudo vi /etc/sudoers

法一:修改用户权限

于末尾加入行:

1
<YOUR USER NAME>	ALL=(ALL:ALL) NOPASSWD:ALL

例如我的用户名为yuuki410,在末尾加入行:

1
yuuki410	ALL=(ALL:ALL) NOPASSWD:ALL

注意在末尾加入,否则将被用户组设置覆盖。

阅读全文 »

無聊,就是想把root賬戶給打開。

設置root賬戶密碼

1
sudo passwd root

修改50-ubuntu.conf

1
sudo gedit /usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf

修改這兩個:

1
2
greeter-show-manual-login=true
all-guest=false
阅读全文 »

21年9月18日更新
鑿海新增了一個Vite分支
然後也寫好了Readme文件
所以這篇就當回憶和樂子來看吧

记一下折腾Shuen的经历,顺带方便以后遇到问题快速解决。

预准备

需要包管理器:

1
npm i -g pnpm yarn

需要全局安装的包依赖:

1
pnpm i -g cross-env concurrently webpack webpack-cli chalk

运行pnpm i前需要先:

1
pnpm clonewj

随后安装:

1
pnpm i
阅读全文 »

Windows上跑node.js时报错:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
PS C:~> node index.js
C:~\index.js:1
��v


SyntaxError: Invalid or unexpected token
at Object.compileFunction (vm.js:344:18)
at wrapSafe (internal/modules/cjs/loader.js:1106:15)
at Module._compile (internal/modules/cjs/loader.js:1140:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1196:10)
at Module.load (internal/modules/cjs/loader.js:1040:32)
at Function.Module._load (internal/modules/cjs/loader.js:929:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47

经查,确认为UTF-16 LE编码所引起的问题。

VSCode疑似默认文件为UTF-16 LE,悲剧。

解决时切换其编码至UTF-8重新存储即可。

Hexo 好看,但是缺点是每次写完一篇新的博客就要敲一行 hexo d 推送一次,到了手机上则是直接废掉。

所以能不能自动部署呐?

当然可以,Github Action!

为了避免重复造轮子,Github 上甚至已经有现成写好的脚本可以使用了,那就直接白嫖好了~QAQ

照抄一下Hexo Action的示例配置即可,以下是本人的配置方法:

~/yuuki410.github.io/.github/workflows/hexo_actions.yml
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
name: Hexo Deploy

on: [push]

jobs:
build:
runs-on: ubuntu-latest
name: A job to deploy blog.
steps:
- name: Checkout
uses: actions/checkout@v1
with:
submodules: true # Checkout private submodules(themes or something else).

# Caching dependencies to speed up workflows. (GitHub will remove any cache entries that have not been accessed in over 7 days.)
- name: Cache node modules
uses: actions/cache@v1
id: cache
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: npm ci
#run: npm install

# Deploy hexo blog website.
- name: Deploy
id: deploy
uses: sma11black/[email protected]
with:
deploy_key: ${{ secrets.DEPLOY_KEY }}
#user_name: your github username # (or delete this input setting to use bot account)
#user_email: your github useremail # (or delete this input setting to use bot account)
#commit_msg: ${{ github.event.head_commit.message }} # (or delete this input setting to use hexo default settings)
# Use the output from the `deploy` step(use for test action)
- name: Get the output
run: |
echo "${{ steps.deploy.outputs.notify }}"

然后push之前要设置一下仓库的deploy key,首先生成ssh key:

1
ssh-keygen -t rsa -C "[email protected]"

然后在仓库设置秘密变量名为DEPLOY_KEY

好了上面的全部都是抄https://github.com/marketplace/actions/hexo-action的。

享受push完了就能自动部署的快乐吧(

预处理

~/yuuki410.github.io
1
2
3
4
npm install -g hexo
hexo init
npm install hexo-theme-next --save
npm install hexo-deployer-git --save

管理Git版本控制

~/yuuki410.github.io
1
2
3
git init
git remote add origin [email protected]:yuuki410/yuuki410.github.io.git # 注意,需要预先在Github上新建仓库
git branch -M master
阅读全文 »