为win10配置windows terminal的主题。
当无法识别AllowPrerelease参数时,可能是因为PowershellGet版本太旧。
通过Get-module PowershellGet取得当前版本
通过Find-module PowershellGet取得最新版本
通过Install-Module PowershellGet -Force安装最新版本
Install-Module posh-git -Scope CurrentUserInstall-Module oh-my-posh -AllowPrerelease -Scope CurrentUser
如遇魔女结界,则使用爱与魔法。
使用notepad $PROFILE编辑powershell的配置文件,添加如下内容:
Import-Module posh-git
Import-Module oh-my-posh
Get-PoshThemes
Set-PoshPrompt -Theme Paradox
如果显示没有权限执行脚本,则运行Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine可以赋予权限。
打开windows terminal的配置文件,为powershell添加如下配置,可以使得终端打开时的默认路径即为打开的目录。
"startingDirectory" : null
然后更改字体和颜色主题,可以直接添加到defaults里面,这样直接对所有终端都生效:
"fontFace": "Monofurbold NF",
"colorScheme":"Tango Dark"
其中,字体需要安装,地址见参考文献。
官方使用的字体是Meslo LGM NF,体积比较大(63.8Mb)。
这里选用的是微软出品的Cascadia Code PL体积比较小(7.8Mb)。
根据官方描述,任意的Nerd Font应当都是兼容的。可以在nerdfonts.com网站浏览。
为Linux安装zsh shell并配置主题。
首先:sudo apt install zsh -y
然后:wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh 下载安装脚本。由于魔女结界的存在,可能需要使用爱与魔法。
chmod +x install.sh 最后运行安装脚本即可。
修改默认shell为zsh后,需要记得对于~/.bashrc的操作都要换成~/.zshrc
执行git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
然后:修改 ~/.zshrc 的 ZSH_THEME="powerlevel10k/powerlevel10k"
处于魔女结界内的用户可以使用 gitee 源替代:git clone --depth=1 https://gitee.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
重启 shell,运行 zsh 进行配置。
需要重新配置时,运行p10k configure即可。
参考:https://www.gdbgui.com/guides/
安装 gdbgui: https://www.gdbgui.com/installation/
然后需要编译一个交叉调试版本的 gdb。
首先下载 gdb 源码:https://www.gnu.org/software/gdb/download/
解压源码,进入源码目录。
安装编译依赖:sudo apt install texinfo
以 linux 调试 arm 为例:
执行 ./configure --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --target=arm-none-eabi 配置编译参数。
编译 make -j8
安装 sudo make install
经过以上步骤,就可以使用编译好的 linux->arm 版本的 gdb 了。
最后使用 gdbgui -g arm-none-eabi-gdb 来启动 gdbgui 就行了。
例: $CheckSum = \sum_5^n n \oplus A_n$ 和 $x = {-b \pm \sqrt{b^2-4ac} \over 2a}$
在templates/custom目录下新建header.tmpl,内容如下:
<script>
MathJax = {
tex: {
inlineMath: [['$', '$'], ['\\(', '\\)']],
displayMath: [["$$", "$$"], ["\\[", "\\]"]]
},
svg: {
fontCache: 'global'
}
};
</script>
<script type="text/javascript" id="MathJax-script" async
src="https://cdn.bootcdn.net/ajax/libs/mathjax/3.0.5/es5/tex-svg.js">
</script>
渲染方式可以更改为如下面的其他方式等:
<script src="https://cdn.bootcdn.net/ajax/libs/mathjax/3.0.5/es5/tex-chtml.js"></script><script src="https://cdn.bootcdn.net/ajax/libs/mathjax/3.0.5/es5/tex-mml-svg.js"></script><script src="https://cdn.bootcdn.net/ajax/libs/mathjax/3.0.5/es5/tex-mml-chtml.js"></script>在大多数桌面版 Linux 中会使用 crontab -e 来编辑 crontab 配置,但是注意不要在威联通中使用这种方法,威联通在重启的时候会覆盖使用这种方式写入的配置。如果想要永久的保存配置,应该使用
vi /etc/config/crontab
然后写入配置,比如
1 4 * * * /share/homes/account/scripts.sh
另外需要注意别忘记添加可执行权限 chmod +x filename.sh
重启 crontab
crontab /etc/config/crontab && /etc/init.d/crond.sh restart
删除文件脚本如下:
#!/bin/bash
keep_days=7
log_path=/share/临时文件共享/
find $log_path -type f -mtime +$keep_days -print0 |
while IFS= read -r -d '' file; do
rm -f "$file"
done
find $log_path -type d -print0 |
sort -nzr |
while IFS= read -r -d '' dir; do
rmdir --ignore-fail-on-non-empty "$dir"
done
管理员权限下运行:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
wsl --set-default-version 2
执行上面命令时如果看到:
WSL 2 requires an update to its kernel component.
则需要安装MSI Linux kernel update package,详见 https://aka.ms/wsl2kernel
安装后再执行上面命令即可。
之后即可直接通过商店安装WSL的Linux发行版了。
默认IDF的powershell配置需要在SDK目录下执行。再切换回项目目录有些繁琐。
使用Push-Location和Pop-Location命令则可以保存和恢复到项目目录。
可以使用别名pushd和popd。
pushd
Set-Location F:/_rSoftware/esp-idf
F:/_rSoftware/esp-idf-tools/Initialize-Idf.ps1
popd