Instruction 2023

Windows shutdown

1
2
3
4
# shutdown in one hour
shutdown -s -t 3600
# cancel shutdown
shutdown -a

Maven

通过 mvn 命令,统一修改整个项目的版本信息

1
2
3
mvn versions:set -DnewVersion=1.0-dev
# 删除生成的 备份文件
find ./ -name pom.xml.versionsBackup | xargs rm

查看当前文件的 dep tree

1
mvn -f pom.xml dependency:tree

update deps version

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Displaying Available Updates (heavy operation, not recommend)
mvn versions:display-dependency-updates

# Converting SNAPSHOTs into RELEASEs
mvn versions:use-releases

# Updating to the Next RELEASE
mvn versions:use-next-releases

# Updating to the Latest RELEASE
mvn versions:use-latest-releases

SwitchyOmega

using auto proxy mode, set to https://raw.githubusercontent.com/gfwlist/gfwlist/master/gfwlist.txt

Grafana

Reset password with cli

sudo grafana-cli admin reset-admin-password pwd123

Memos

podman run -d --name memos -p 127.0.0.1:5230:5230 -v /iris/memos:/var/opt/memos docker.io/neosmemo/memos:latest

Rust

compile openssl in windows

  1. 克隆 vcpkg
  2. 打开您克隆 vcpkg 的目录
  3. 运行./bootstrap-vcpkg.bat
  4. 运行 ./vcpkg.exe install openssl-windows:x64-windows
  5. 运行 ./vcpkg.exe install openssl:x64-windows-static
  6. 运行 ./vcpkg.exe 集成安装
  7. 运行 set VCPKGRS_DYNAMIC=1(或简单地将其设置为您的环境变量)

Format all files in [[vscode]]

  1. install extension Format files
  2. Crtl+Shift+P and select Start to format

Useful DNS Record

1
2
140.82.113.4    github.com
185.199.111.133 githubusercontent.com

NVIM

1
2
3
4
winget install Neovim.Neovim

brew install neovim
yum install neovim

With Plugins

1
2
3
4
5
6
/root/.config/nvim
├── init.lua
├── lua
│   └── plugins.lua
└── plugin # compiled stuffs
    └── packer_compiled.lua
  1. add require("plugins") to init.lua
  2. install packer.vim for plugin managements
    1. a git clone --depth 1 https://github.com/wbthomason/packer.nvim ~/.local/share/nvim/site/pack/packer/start/packer.nvim
    2. add custom plugins configuration to plugins.lua
  3. run nvim & :PackerSync
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
-- init.lua
requre("plugins")

-- disable netrw at the very start of your init.lua (strongly advised)
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1

-- set termguicolors to enable highlight groups
vim.opt.termguicolors = true

-- empty setup using defaults
require("nvim-tree").setup()

-- OR setup with some options
require("nvim-tree").setup({
  sort_by = "case_sensitive",
  renderer = {
    group_empty = true,
  },
  filters = {
    dotfiles = true,
  },
})
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
-- plugins.lua

return require('packer').startup(function()
  -- Packer can manage itself
  use 'wbthomason/packer.nvim'
  use {
    'nvim-tree/nvim-tree.lua',
    requires = {
      'nvim-tree/nvim-web-devicons', -- optional
    },
    config = function()
      require("nvim-tree").setup {}
    end
  }
end)

Git Useful

1
2
# switch default editor
git config --global core.editor "vim"

configure proxy for specific host

1
2
3
4
5
6
7
8
9
Host github.com
  HostName github.com
  User azusachino
  IdentityFile ~\.ssh\id_rsa_github
  PreferredAuthentications publickey
  # for windows
  ProxyCommand connect -S localhost:30808 %h %p
  # for macos
  ProxyCommand nc -v -x 127.0.0.1:1080 %h %p

ZSH

1
2
3
4
5
6
# install zsh
yum install zsh git
# install ohmyzsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# chsh
chsh -s /usr/bin/zsh
1
2
3
4
5
6
7
8
# useful plugins
# brew install history-substring-search
plugins=(
git
history-substring-search
zsh-autosuggestions
zsh-syntax-highlighting
)
1
2
3
4
5
6
7
# install history
git clone https://github.com/zsh-users/zsh-history-substring-search ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-history-substring-search
# install zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

# install zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-syntax-highlighting ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

YUM

Yum install local

yum localinstall *.rpm

HomeBrew

Tuna

ref: https://mirrors.tuna.tsinghua.edu.cn/help/homebrew/

1
2
3
4
5
6
export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git"
export HOMEBREW_API_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/api"
export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles"
export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git"
export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git"
export HOMEBREW_PIP_INDEX_URL="https://pypi.tuna.tsinghua.edu.cn/simple"

update local homebrew config

1
2
3
4
export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git"
for tap in core cask{,-fonts,-drivers,-versions} command-not-found services; do
    brew tap --custom-remote --force-auto-update "homebrew/${tap}" "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-${tap}.git"
done

Linux

kill all my processes who is zombie.

1
ps -ef | grep ycpang | awk '{if($3==1) {print $2}}' | xargs kill -9

Nginx

PWA 应用 刷新 404 问题解决

  1. nginx location 添加 本地路由提示 try_files $uri /index.html
  2. 在 index.html 中添加 <base href="/" />,具体参考 ref

Mac VSCode

1
2
# jump back to last location
control + `-`

yt-dlp

  • yt-dlp https://youtube.com?s=12334 downloads the best video+audio by default
    • but the result might not match
    • we could install ffmpeg to solve that problem

References

Get Things Done
Built with Hugo
Theme Stack designed by Jimmy