menu Chancel's Blog
rss_feed lightbulb_outline

我的笔记

搜索
列表(129)
VSCode调试信息输出控制台
类型:IDE

Visual Studio Code 调试信息输出到 Debug Console

更新于 2021-06-18 10:59:31
创建于 2021-06-18 10:59:04

VSCode调试信息输出控制台

修改项目的launch.json文件,添加console参数

{   "version": "0.2.0",
    "configurations": [
        {   "name": "Python: Current File",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "internalConsole"
        }
    ]
}

资料来源

Linux主机实现NAT转发
类型:Linux

如何配置一台Linux系统的主机作为网关实现NAT转发?

更新于 2021-06-16 10:45:41
创建于 2021-06-16 10:45:41

Linux主机实现NAT转发
sudo vim /etc/sysctl.conf
net.ipv4.ip_forward=1

sudo sysctl -p

sudo iptables -t nat -A POSTROUTING -s 192.168.4.0/24 -o enx00a0c6000000 -j MASQUERAD
VSCode CPU占用过高
类型:IDE

VSCode - runJediLanguageServer 进程占用CPU过高

更新于 2021-06-16 10:44:49
创建于 2021-06-16 10:44:49

VSCode CPU占用过高

关闭VSCode之后发现CPU占用很高,一查竟然是一个名为 runJediLanguageServer的进程在疯狂占用CPU

解决方案如下

  1. 打开VSCode的命令界面(Ctrl+Shift+P),输入Open Settings,选择以Json文件打开VSCode设置
  2. 在打开的文件中添加配置 "python.experiments.optOutFrom": ["pythonJediLSP"]

资料来源:https://stackoverflow.com/questions/66518708/runaway-jedi-language-task-in-vscode

Ubuntu1804修改主机名
类型:Linux

Linux - Ubuntu1804使用hostnamectl命令修改主机名称

更新于 2021-06-16 10:44:19
创建于 2021-06-16 10:44:19

Ubuntu1804修改主机名
sudo hostnamectl set-hostname my-machine-new
Office转变版本脚本错误
类型:Windows

Office 2016 转变VOl版本报错解决

更新于 2021-06-16 10:42:01
创建于 2021-06-16 10:42:01

Office转变版本脚本错误
@echo off
:ADMIN
openfiles >nul 2>nul ||(
echo CreateObject^("Shell.Application"^).ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs" >nul 2>&1
goto:eof
)
del /f /q "%temp%\getadmin.vbs" >nul 2>nul

for /f "tokens=6 delims=[]. " %%G in ('ver') do set win=%%G

setlocal

set OPPKEY=XQNVK-8JYDB-WJ9W3-YJ8YR-WFG99
set PPKEY=YG9NW-3K39V-2T3HJ-93F3Q-G83KT
set VPKEY=PD3PC-RHNGV-FXJ29-8JK7D-RJRJK
set S4BKEY=869NQ-FJ69K-466HW-QYCP2-DDBV6

pushd "%~dp0"
Title Office 2016 Retail to Volume License Converter

SET OfficePath=%ProgramFiles%\Microsoft Office
if not exist "%OfficePath%\root\Licenses16" SET OfficePath=%ProgramFiles(x86)%\Microsoft Office
if not exist "%OfficePath%\root\Licenses16" (
    echo Could not find the license files for Office 2016!
    pause
    goto :eof
)

echo Press Enter to start VL-Conversion...
echo.
pause
echo.
cd /D "%SystemRoot%\System32"

if %win% GEQ 9200 (
    cscript slmgr.vbs /ilc "%OfficePath%\root\Licenses16\ProPlusVL_KMS_Client-ppd.xrm-ms"
    cscript slmgr.vbs /ilc "%OfficePath%\root\Licenses16\ProPlusVL_KMS_Client-ul.xrm-ms"
    cscript slmgr.vbs /ilc "%OfficePath%\root\Licenses16\ProPlusVL_KMS_Client-ul-oob.xrm-ms"

    cscript slmgr.vbs /ilc "%OfficePath%\root\Licenses16\ProjectProVL_KMS_Client-ppd.xrm-ms"
    cscript slmgr.vbs /ilc "%OfficePath%\root\Licenses16\ProjectProVL_KMS_Client-ul-oob.xrm-ms"
    cscript slmgr.vbs /ilc "%OfficePath%\root\Licenses16\ProjectProVL_KMS_Client-ul.xrm-ms"

    cscript slmgr.vbs /ilc "%OfficePath%\root\Licenses16\VisioProVL_KMS_Client-ppd.xrm-ms"
    cscript slmgr.vbs /ilc "%OfficePath%\root\Licenses16\VisioProVL_KMS_Client-ul-oob.xrm-ms"
    cscript slmgr.vbs /ilc "%OfficePath%\root\Licenses16\VisioProVL_KMS_Client-ul.xrm-ms"

    cscript slmgr.vbs /ilc "%OfficePath%\root\Licenses16\SkypeforBusinessVL_KMS_Client-ppd.xrm-ms"
    cscript slmgr.vbs /ilc "%OfficePath%\root\Licenses16\SkypeforBusinessVL_KMS_Client-ul.xrm-ms"
    cscript slmgr.vbs /ilc "%OfficePath%\root\Licenses16\SkypeforBusinessVL_KMS_Client-ul-oob.xrm-ms"

    cscript slmgr.vbs /ilc "%OfficePath%\root\Licenses16\client-issuance-bridge-office.xrm-ms
    cscript slmgr.vbs /ilc "%OfficePath%\root\Licenses16\client-issuance-root.xrm-ms
    cscript slmgr.vbs /ilc "%OfficePath%\root\Licenses16\client-issuance-root-bridge-test.xrm-ms
    cscript slmgr.vbs /ilc "%OfficePath%\root\Licenses16\client-issuance-stil.xrm-ms
    cscript slmgr.vbs /ilc "%OfficePath%\root\Licenses16\client-issuance-ul.xrm-ms
    cscript slmgr.vbs /ilc "%OfficePath%\root\Licenses16\client-issuance-ul-oob.xrm-ms
    cscript slmgr.vbs /ilc "%OfficePath%\root\Licenses16\pkeyconfig-office.xrm-ms
)
 if %win% LSS 9200 (
    cscript "%OfficePath%\Office16\ospp.vbs" /inslic:"%OfficePath%\root\Licenses16\ProPlusVL_KMS_Client-ppd.xrm-ms"
    cscript "%OfficePath%\Office16\ospp.vbs" /inslic:"%OfficePath%\root\Licenses16\ProPlusVL_KMS_Client-ul.xrm-ms"
    cscript "%OfficePath%\Office16\ospp.vbs" /inslic:"%OfficePath%\root\Licenses16\ProPlusVL_KMS_Client-ul-oob.xrm-ms"

    cscript "%OfficePath%\Office16\ospp.vbs" /inslic:"%OfficePath%\root\Licenses16\ProjectProVL_KMS_Client-ppd.xrm-ms"
    cscript "%OfficePath%\Office16\ospp.vbs" /inslic:"%OfficePath%\root\Licenses16\ProjectProVL_KMS_Client-ul-oob.xrm-ms"
    cscript "%OfficePath%\Office16\ospp.vbs" /inslic:"%OfficePath%\root\Licenses16\ProjectProVL_KMS_Client-ul.xrm-ms"

    cscript "%OfficePath%\Office16\ospp.vbs" /inslic:"%OfficePath%\root\Licenses16\VisioProVL_KMS_Client-ppd.xrm-ms"
    cscript "%OfficePath%\Office16\ospp.vbs" /inslic:"%OfficePath%\root\Licenses16\VisioProVL_KMS_Client-ul-oob.xrm-ms"
    cscript "%OfficePath%\Office16\ospp.vbs" /inslic:"%OfficePath%\root\Licenses16\VisioProVL_KMS_Client-ul.xrm-ms"0

    cscript "%OfficePath%\Office16\ospp.vbs" /inslic:"%OfficePath%\root\Licenses16\SkypeforBusinessVL_KMS_Client-ppd.xrm-ms"
    cscript "%OfficePath%\Office16\ospp.vbs" /inslic:"%OfficePath%\root\Licenses16\SkypeforBusinessVL_KMS_Client-ul.xrm-ms"
    cscript "%OfficePath%\Office16\ospp.vbs" /inslic:"%OfficePath%\root\Licenses16\SkypeforBusinessVL_KMS_Client-ul-oob.xrm-ms"

    cscript "%OfficePath%\Office16\ospp.vbs" /inslic:"%OfficePath%\root\Licenses16\client-issuance-bridge-office.xrm-ms
    cscript "%OfficePath%\Office16\ospp.vbs" /inslic:"%OfficePath%\root\Licenses16\client-issuance-root.xrm-ms
    cscript "%OfficePath%\Office16\ospp.vbs" /inslic:"%OfficePath%\root\Licenses16\client-issuance-root-bridge-test.xrm-ms
    cscript "%OfficePath%\Office16\ospp.vbs" /inslic:"%OfficePath%\root\Licenses16\client-issuance-stil.xrm-ms
    cscript "%OfficePath%\Office16\ospp.vbs" /inslic:"%OfficePath%\root\Licenses16\client-issuance-ul.xrm-ms
    cscript "%OfficePath%\Office16\ospp.vbs" /inslic:"%OfficePath%\root\Licenses16\client-issuance-ul-oob.xrm-ms
    cscript "%OfficePath%\Office16\ospp.vbs" /inslic:"%OfficePath%\root\Licenses16\pkeyconfig-office.xrm-ms
)

for %%a in (%OPPKEY% %PPKEY% %VPKEY% %S4BKEY%) do cscript "%OfficePath%\Office16\ospp.vbs" /inpkey:%%a
cscript "%OfficePath%\Office16\ospp.vbs" /act

echo.
echo Retail to Volume License conversion finished.
echo.
pause
Linux批量重命名指定文件
类型:Linux

Linux批量重命名指定文件

更新于 2021-06-16 10:40:18
创建于 2021-06-16 10:40:18

Linux批量重命名指定文件
rename '\s\被替换的部分\新的内容\' $(find ./ -name "*.md")
Linux配置sftp传输文件
类型:Linux

Linux 配置用户使用sftp传输文件

更新于 2021-06-16 10:40:04
创建于 2021-06-16 10:40:04

Linux配置sftp传输文件
sudo groupadd sftpusers
sudo useradd -s /bin/false -G sftpusers [user]
sudo passwd [user]

sudo vim /etc/ssh/sshd_config

# Subsystem sftp /usr/lib/openssh/sftp-server
Subsystem sftp internal-sftp
Match Group sftpusers
# 指定 sftp 命令
ForceCommand internal-sftp
# 这两行,如果不希望该用户能使用端口转发的话就加上,否则删掉
X11Forwarding no
AllowTcpForwarding no

sudo systemctl restart sshd
Windows复制文件保留权限
类型:Windows

Windows - 复制文件时保留文件权限

更新于 2021-06-16 10:39:02
创建于 2021-06-16 10:39:02

Windows复制文件保留权限

在视窗操作复制文件时,通常会丢失文件权限,这样会导致一些需要检验文件权限的软件操作失败,如何在复制文件时保留文件权限

使用CMD/Powershell运行以下命令来复制移动文件

xcopy C:\Users\ycs10\Documents\Syncthing\NoteRepository\00.自由收藏\Certificates\ C:\Cerificates\ /O /X /E /H
Pyenv无法初始化
类型:Python

WARNING: pyenv init - no longer sets PAT

更新于 2021-06-16 10:38:46
创建于 2021-06-16 10:38:46

Pyenv无法初始化

安装Pyenv后,按照提示添加下面3个环境初始化的命令到 ~/.zshrc 中,结果提示警告信息 pyenv init - no longer sets PATH.

~ ➤ echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc
~ ➤ echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zshrc
~ ➤ echo 'eval "$(pyenv init -)"' >> ~/.zshrc
~ ➤ source ~/.zshrc
WARNING: `pyenv init -` no longer sets PATH.
Run `pyenv init` to see the necessary changes to make to your configuration.
~ ➤

修改原3个环境变量形式如下即可解决

export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
if command -v pyenv 1>/dev/null 2>&1; then
  eval "$(pyenv init --path)"
fi

参考资料:https://github.com/pyenv/pyenv/issues/1906

PS被禁止运行脚本
类型:Windows

Powershell被禁止运行脚本的解决方案

更新于 2021-06-16 10:37:55
创建于 2021-06-16 10:37:55

PS被禁止运行脚本

在Powershell中运行脚本出错,提示如下

  • Windows - Cannot be loaded because running scripts is disabled on this system

使用管理员权限启动PowerShell,并解除禁止运行脚本

set-executionpolicy remotesigned
Windows切换IP脚本
类型:Windows

Windows - 快速切换IP设置的BAT脚本

更新于 2021-06-16 10:36:24
创建于 2021-06-16 10:36:24

Windows切换IP脚本
Office2016激活脚本
类型:Windows

Windows Office 2016 - 激活脚本

更新于 2021-06-16 10:35:55
创建于 2021-06-16 10:35:55

1 of 11 | A total of 129