EDITOR, PAGER, BROWSER
Where do EDITOR, PAGER, BROWSER environment variables come from? - Unix & Linux Stack Exchange
EDITOR, PAGER, BROWSER 这三个环境变量控制 linux 中很多工具展示输出的方式。还有 SUDO_EDITOR
可以设置 sudoedit 使用的编辑器。
Where do EDITOR, PAGER, BROWSER environment variables come from? - Unix & Linux Stack Exchange
EDITOR, PAGER, BROWSER 这三个环境变量控制 linux 中很多工具展示输出的方式。还有 SUDO_EDITOR
可以设置 sudoedit 使用的编辑器。
adduser 有交互过程,比 useradd 更友好。事实上,adduser 是 useradd 的 wrapper。
https://stackoverflow.com/a/5563131/
if:
either is long double other is promoted > long double
either is double other is promoted > double
either is float other is promoted > float
either is long long unsigned int other is promoted > long long unsigned int
either is long long int other is promoted > long long int
either is long unsigned int other is promoted > long unsigned int
either is long int other is promoted > long int
either is unsigned int other is promoted > unsigned int
either is int other is promoted > int
Otherwise:
both operands are promoted to int
在没有 --source
选项时,有 --staged
则默认使用 HEAD 来恢复,如果没有则默认使用 index。此时:
git restore
相当于 git restore --worktree
。git restore --staged
用 HEAD 的信息来恢复 index,不会改动 working tree。git restore --worktree
用 index 的信息来恢复 working tree。git restore --worktree --staged
同时恢复 working tree 和 index。git restore --source HEAD --worktree --staged
相当于 git reset --hard
对于单个文件的效果。(虽然按照官方的描述来说是默认 source 为 HEAD,但是在 git 2.25.1 中实测这种情况下的默认 source 是 index)
-W
link1; link2 link3 Specify the restore location. If neither option is specified, by default the working tree is restored. Specifying--staged
will only restore the index. Specifying both restores both.
Torek insists on the fact
git restore --source <aCommit> --worktree -- somefile
is new (cannot be done with checkout): the ability to restore a file in the working tree without touching the index.Torek insists on the factgit restore --source <aCommit> --worktree -- somefile
is new (cannot be done with checkout): the ability to restore a file in the working tree without touching the index.
这大概是说 git checkout
利用历史 commit 改动单个文件的同时也会改动 index。
inline namespace 既本身存在,又将所有内容引入外围(enclosing)名字空间中。相当于名字空间后面加了一句:using namespace X;
例子:
inline namespace A {
using Int = int;
}
int main() {
A::Int a;
Int b; // 也能成功
}
这三个单词的含义分别是色相、饱和度、亮度。
所有的粉色都是洋红色,所有的洋红色都是紫色。word choice - What is ‘pink’ and what is ‘magenta’? - English Language & Usage Stack Exchange
给一个必定匹配的模式让 grep 打印所有行:
... | grep -E '(^|pattern)' --color=always
Python 的正则表达式函数基本都是从第一个字符开始匹配的。不像 bash 和 JS 是任意位置匹配都行。所以要适当加上 .*
。
主要是双显卡笔记本切换显示屏后,部分应用没有切换图形显示卡,导致未活跃的显卡时不时被唤醒,而每次唤醒会有一秒的卡顿。
创建 bat 文件(其中硬件驱动的实例路径需要在设备管理器上查看后根据实际修改):
:: Run as admin
@echo off
%1 mshta vbscript:createobject("shell.application").shellexecute("%~s0","::","","runas",1)(window.close)&exit
cd /d %~dp0
:: 如果变量为空,整个分支判断会被静默掉,所以给个默认值
set "Input=1"
set /p Input=Index of graphics card to reset? (0: Intel, 1: NVIDIA[default])
if %Input% equ 0 (
pnputil /disable-device "PCI\VEN_8086&DEV_3E9B&SUBSYS_39FD17AA&REV_00\3&11583659&0&10"
pnputil /enable-device "PCI\VEN_8086&DEV_3E9B&SUBSYS_39FD17AA&REV_00\3&11583659&0&10"
) else if %Input% equ 1 (
pnputil /disable-device "PCI\VEN_10DE&DEV_1C8C&SUBSYS_39FD17AA&REV_A1\4&77AC7CD&0&0008"
pnputil /enable-device "PCI\VEN_10DE&DEV_1C8C&SUBSYS_39FD17AA&REV_A1\4&77AC7CD&0&0008"
) else (
echo:
echo|set /p _=">>> Unknown choice! Exiting... <<<"
echo:
echo:
pause
)
实际上在桌面上分开放两个脚本文件会比在脚本文件中选择要重启的显卡驱动更方便。因为在脚本中选择是一项额外操作。