${toc}
常见配置拾遗
neovim
安装 neovim
for ubuntu
sudo apt install software-properties-common -y
sudo add-apt-repository ppa:neovim-ppa/stable -
sudo add-apt-repository ppa:neovim-ppa/unstable -y
sudo apt-get update
sudo apt install neovim -y
neovim 自动补全
自动补全触发的逻辑
首先在coc中,推荐的配置是用 tab 选择补全,用cr or
而由于在 utilsnippets 中 用于触发补全的键是 tab, 和coc的快捷键冲突了 所以tab切换无效,我们可以在 vimrc 中将 util snippets 的触发改成c-e 这样大家就不互相干扰,各玩各的。
为snippets增加数学环境
在snippets文件 最开始的地方加上
global !p
def math():
return vim.eval('vimtex#syntax#in_mathzone()') == '1'
def comment():
return vim.eval('vimtex#syntax#in_comment()') == '1'
def env(name):
[x,y] = vim.eval("vimtex#env#is_inside('" + name + "')")
return x != '0' and x != '0'
endglobal
snippets 的组成
symbol | meaning |
---|---|
w | expand on word boundaries |
A | automaticaly expanding |
<++> |
再给属于 数学环境下的snippets 头上加 context “math()”
配置 lsp
c / c++
- install clangd
sudo apt install clangd
Then - add
coc-clangd
or - config language server in cocconfig.json
java
- add
coc-java
ing:coc\_global\_extensions
list - install open-jdk (version >= 17)
apt-cache search openjdk | egrep '11|17|18'
apt update
apt install openjdk-17-jdk
rust
cargo
very simple
- install rust itself website
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
- add
coc-rust-analyzer
ing:coc\_global\_extensions
list - some tutorial offical tutorial
go
- install go itself website
- install gopls
- export GO111MODULE=on
- go env -w GOPROXY=https://goproxy.cn,direct 切换为国内代理
- go install golang.org/x/tools/gopls@latest 下载 gopls
- set up languageserver in cocConfig, remember write absolute path for gopls
- begin writing code
go mod init example/hello
cd example/hello
touch hello.go
package main
import "fmt"
func main() {
fmt.Println("Hello, World!")
}
- some tutorial offical
rm -rf /usr/local/go && tar -C /usr/local -xzf go1.19.4.linux-amd64.tar.gz
- add
coc-rust-analyzer
ing:coc\_global\_extensions
list
haskell
- first install ghcup, website
after installing, may need to add ghcup to your environment variable.
export PATH=$PATH: ...
- using ghcup to install hls, website
- Then add configrations in cocConfig.json
"haskell": {
"command": "haskell-language-server-wrapper",
"args": ["--lsp"],
"rootPatterns": ["*.cabal", "stack.yaml", "cabal.project", "package.yaml", "hie.yaml"],
"filetypes": ["haskell", "lhaskell"],
// Settings are optional, here are some example values
"settings": {
"haskell": {
"checkParents": "CheckOnSave",
"checkProject": true,
"maxCompletions": 40,
"formattingProvider": "ormolu",
"plugin": {
"stan": { "globalOn": true }
}
}
}
},
- some tutorial ws3 school offical tutorial
kotlin
- download kotlin lsp at github
- add configrations
"languageserver": { "kotlin": { "command": "~/lsp/kotlin/server/bin/kotlin-language-server", "filetypes": ["kotlin"] } }
-
install kotlin via sdk
-
下载
kotlin
tutorial注意使用
curl -s "https://get.sdkman.io" | bash
安装sdkman
sdkman usage -
如果下载速度太慢,可以前往 kotlin 下载二进制安装包,解压到任意位置,再将 解压后根目录中
bin
文件夹 添加到环境变量解压 .tar.gz 文件 用 tar -xzf 命令
-
need install gradle (can not directly use kotlinc)
using gradle to build project and run project
see this link Neovim for beginners
php
coc-phpls
lua
how to install lua and luarock 1. follow the offical doc
curl -R -O http://www.lua.org/ftp/lua-5.4.4.tar.gz
tar zxf lua-5.4.4.tar.gz
cd lua-5.4.4
make all test
make local
, and copy everything in install
directories to /usr/local/bin/lua-5.4
python
meet with issue 600 fixed by deleting coc-python in directory
latex
installing texlive
sudo pacman -S texlive texlive-langchinese
或者 可参考 Linux 下的LaTex写作工具链 Makefiles
LATEX=xelatex #定义变量,指定编译引擎
LATEXOPT=--shell-escape #定义变量 指定编译参数
NONSTOP=--interaction=nonstopmode #定义变量 指定编译模式
LATEXMK=latexmk #采用latexmk来编译latex文档
LATEXMKOPT=-pdf #latexmk参数 输出pdf
CONTINUOUS=-pvc #若加入-pvc选项则可以持续检测文件改动并实时显示
MAIN=main #根文件名称
MAIN_SRC = $(patsubst %, %.tex, $(MAIN))
SOURCES= $(MAIN_SRC)
FIGURES := $(shell find figures/* movies/* -type f)
all: $(MAIN).pdf
$(MAIN).pdf: $(SOURCES) $(FIGURES)
$(LATEXMK) $(LATEXMKOPT) \
-pdflatex="$(LATEX) $(LATEXOPT) $(NONSTOP) %O %S" $(MAIN)
force:
rm $(MAIN).pdf
$(LATEXMK) $(LATEXMKOPT) $(CONTINUOUS) \
-pdflatex="$(LATEX) $(LATEXOPT) %O %S" $(MAIN)
clean:
$(LATEXMK) -C $(MAIN)
-rm -f $(MAIN).pdfsync
-rm -rf *~ *.tmp
-rm -f *.bbl *.blg *.aux *.end *.fls *.log *.out *.fdb_latexmk
once:
$(LATEXMK) $(LATEXMKOPT) -pdflatex="$(LATEX) $(LATEXOPT) %O %S" $(MAIN)
debug:
$(LATEX) $(LATEXOPT) $(MAIN)
.PHONY: clean force once all
- download and build
texlab
- config settings
"texlab.path": "$HOME/notes/tex/texlab/target/release/texlab",
"texlab.build.onSave": true,
"texlab.build.args": ["-xelatex", "-interaction=nonstopmode", "-synctex=1", "%f"],
git 代理
- 根据这篇博客,配置了github的代理。git 代理
- 如果遇到了从github拉取失败的情况,要么是没开clash 代理,要么是节点废了
- 有时候通过 ssh 的方式 clone 仓库也会失败,这个时候需要配置 ssh 走 http 的代理
- 设置 ssh 走 http 代理 doc
配置 Android Studio
配置 maven
- In IDEA find settings->build->Maven change
User settings file
, andLocal Repository
- In the location of
user settings file
,touch a settings json, which Maven will read before execution - In
settings.json
, addlocal repository
andmirror
. settings~/.m_2/settings.xml is user config file ../conf/settings.xml is system config file The priority of user file weights than system configration file.
if you are not sure what script is being executed, you can somehow random change the contents see whether the change affect idea
- for maven or some thing related to java, go to bilibli channel to see tutorial.
- intelliJ offical doc is also a great reference
配置 gradle
- To modify gradle location permanently,
Add a environment variable
GRADLE_USER_HOME
, and set its value as your self defined location. for exampleD:\.gradle
- To move location of avd.
go
~/.android/avd
, modifyXXX.ini
file
avd.ini.encoding=UTF-8
path=D:\avd\Pixel_XL_API_33_2.avd // change this to your desired location
path.rel=avd\Pixel_XL_API_33_2.avd
target=android-33
配置 vscode
vscode configration
which-key
could specify function of same key-bindings for different circustancesmulti-command
- find the api for spercific action in vscode docs
"terminal.integrated.fontFamily": "NotoSansMono Nerd Font"
// amazing
"keyboard.dispatch": "keyCode"
// keyboard
// Place your key bindings in this file to override the defaults
[
{
"key": "ctrl+alt+t", // you could use "key": "ctrl+`", if you wish
"command": "workbench.action.closePanel",
// "when": "terminalFocus"
},
{
"key": "ctrl+alt+t",
"command": "workbench.action.toggleMaximizedPanel",
"when": "!terminalFocus"
},
{
"key": "ctrl+shift+alt+z",
"command": "workbench.action.tasks.runTask"
},
{
"key": "tab",
"command": "selectNextSuggestion",
"when": "editorTextFocus && suggestWidgetMultipleSuggestions && suggestWidgetVisible" },
{
"key": "tab",
"command": "-acceptSelectedSuggestion"
},
]
vscode cpp 调试
- 从 官网 拷贝 task.json, launch.json
- 选择 debug cpp/c 文件时,记得不要选 带有
/usr/bin/cpp
那个任务
- 之后就可以了
配置 ideavim
ideavimrc
- how to use which key
- how to find the task id
- first,
shift
shift
and searchtrack action ID
- perform and copy the action
- write mappings
map keyMappings <Action>({action_id})
- first,
不常用命令行
git
git stash pop 可以撤销git stash 操作并删除stash的记录
pandoc
!pandoc % -o %<.pdf --pdf-engine=xelatex -V CJKmainfont=KaiTi
\(a_1 + b_2 = c_3\)
ranger
- need syntax highlighting
- open pdf document for the first time is extremely slow
wget
wget --mirror --convert-links --adjust-extension --page-requisites --no-parent https://www.eecs189.org/sp18/
rclone
rclone mount oss:trace1729 /home/trace/rclone --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000 --daemon
pacman
pacman -Ss {{package}}
s for search.pacman -Sc
clear cachepacman -Scc
clear all cachepacman -Rc {{package}}
remove packagepacman -Rs
remove package and its dependencypacman -Rns
remove package, its dependency and its global configration filepacman -Qe
search user installed packagepacman -R $(pacman -Qdtq)
当太久没更新
pacman-key --populate archlinux
pacman -S archlinux-keyring
更新出现报错
"Failed to commit transaction (conflicting files)" error
首先去 arch wiki 上找 pacman 的 trouble shooting.
使用 pacman -Qo
确定冲突的文件不是其他包的依赖后,可以将冲突文件重命名或者删除,再尝试更新
zellij
- 配置文件
~/.config/zellij
- 布局文件
~/.config/zellij/layouts
- 加载布局
zellij --layout {写文件名就好}
布局介绍 - tab 是一个满屏 - 一个 tab 下 可以有 多个 pane
参考配置
layout {
pane split_direction="vertical" {
pane
pane
}
}
gdb
.gdbinit
可以预设一些gdb 命令 方便调试- 需要在
~/.config/gdb/gdbinit
里添加安全路径,.gdbinit
才能被执行
add-auto-load-safe-path /home/trace/trace/learning/open_course/6.s081/xv6-labs-2021/.gdbinit
add-auto-load-safe-path /home/trace/trace/learning/cpp/.gdbinit
- 如果 gdb 打印 异常
(gdb) p intervals[0][0]
$2 = (__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type &) @0x555555
572000: 15
可能是因为设置了 set auto-load safe-path XXX
Manjaro cheatsheet
- How to installing fonts for manjaro
- downloading
ttf
file - create directory for your font in
/usr/share/fonts
- move your
ttf
file into the directory you just created -
Done!
-
注意 使用
yay
时,需要开代理,而日终端默认是不走代理的,需要手动运行
export http_proxy=''
export https_proxt=''
- i3wm 使用
font:pango {{fontsize}}
- 需要在使用代理的终端下,开启浏览器,才能走代理
./clash-linux-amd64-v3-v1.11.4 -f config.yml >/dev/null 2>& 1 &
-
source proxy.sh
-
关闭代理
ps aux | grep clash
kill -9
-
source noproxy.sh
-
键位绑定
xev
show ascii code for keystroke-
capslock: 66, esc: 9
-
待折腾
-
调整标签页的大小
-
When using
fanyi
command line tools - either using
-S
option to close voice - or you install relavent package
pacman -S festival festival-englist
npm - 淘宝镜像https 证书过期了,而有些项目构建时,又指定 了淘宝镜像,导致构建失败。目前没找到解决办法 - 也许可以手动安装,但是不想折腾了。
卸载软件
- 使用 pacman 卸载软件后,可能会有残留文件,一般检查一下几个文件位置
~/.config/
~/
/usr/share/
~/cache/
bluetoothctl
首先启动服务
sudo systemctl enable bluetoothctl.service
sudo systemctl start bluetoothctl.service
再输入 bluetoothctl
进入命令行界面
bluetoothctl #连接交互命令
power on #开启控制器电源,默认关闭
devices #获取要配对设备的MAC
agent on #打开代理
pair MAC_ADDRESS #配对,输入MAC地址即可配对,建议使用Tab
connect MAC_ADDRESS #连接,建议使用Tab
如果输入 power on
后,出现 Failed to set power on: org.bluez.Error.Failed
错误,
返回终端输入 rfkill unblock bluetooth
,再进入到 bluetoothctl
界面重新输入 power on
通知
如果qq不现实消息通知,可能是因为你开了 Do not Disturb
模式
服务器配置拾遗
How to deploy website using Apacha2
-
install
apache
sudo apt update sudo apt install apache2
-
config ufw (ubuntu firewall)
sudo ufw allow OpenSSH # for ssh into server
sudo ufw allow 'Apache Full' # 为 apache 服务 放行
sudo ufw enable # 启用防火墙
sudo systemctl start apache2
- installing php,
php plugin for apache
, mysql,sql plugin for php
sudo apt install php libapache-mod-php mysql-server php-mysql
-
the root dir is located at
/var/www/html
, You can modify the content in index.html -
mysql 服务
After installing mysql service automaticaly activatied
First we need to config password for root Alter ...
Then run mysql_secure_installation
定时任务
0 22 * * * ncdu / -o ~/log/disk_$(date +\%Y\%m\%d_\%H\%M\%S).json
Side Notes
- About
systemctl
-
systemctl [start | reload | restart | stop] {{service}}
-
About
ufw
ufw status
ufw allow in {{service}}
-
ufw app list
-
About Apache
- apache2.conf 主配置
- ports.conf 配置端口
- conf-available
- conf-enabled
mods-available
安装的插件mods-enabled
启用的插件sites-available
待使用的站点-
sites-enabled
启用的站点 -
查看端口占用情况
sudo netstat -tlnp | grep ':80'
文件描述符
&1 表示 序号为1 的 文件描述符,而非文件名为1文件
2>&1 表示 让文件描述符2指向 文件描述符1所指向的设备
cloud server + hexo
- 进入
trace1729.github.io
, 输入hexo new {post name}
新建博客 hexo g
生产静态页面hexo d
将内容同步至 github- oss 如果需要将文件上传至云端,可以使用这个
Github
Repo 导入 secrets.TOKEN