0%

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

一些需要弄明白的名词:commit range/refspec。

git 基础

git 的管理方式是记录每个文件的快照。

然后分成三个区:

在没有 --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 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.

这大概是说 git checkout 利用历史 commit 改动单个文件的同时也会改动 index。

Namespaces - cppreference.com

inline namespace 既本身存在,又将所有内容引入外围(enclosing)名字空间中。相当于名字空间后面加了一句:using namespace X;

例子:

inline namespace A {
    using Int = int;
}

int main() {
    A::Int a;
    Int b; // 也能成功
}

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
)

实际上在桌面上分开放两个脚本文件会比在脚本文件中选择要重启的显卡驱动更方便。因为在脚本中选择是一项额外操作。