StephEric

Department of Computer Science and Technology, Tsinghua University

0%

锁屏后[[Theme/WSL|WSL]]会卡死无法连接或启动,只能重启计算机。
若不想重启计算机,可以按如下方法:

  1. 管理员权限下运行如下命令:
1
hcsdiag kill @(hcsdiag list | Select-Object -First 1)

该命令行使用 hcsdiag list 的输出来选择列表中的第一个项目,然后尝试使用 hcsdiag kill 来杀死某些东西。这些命令的具体行为和目的取决于 hcsdiag 实用程序的功能,它不是 PowerShell 或 Windows 的标准组成部分。

  1. 重新启动或连接WSL即可。

The error message you provided is in Chinese, and it translates to:

1
ssh-copy-id: Cannot recognize "ssh-copy-id" as the name of a cmdlet, function, script file, or executable program. Please check the spelling of the name, and if it includes a path, make sure the path is correct, and try again.

This error indicates that the ssh-copy-id command is not recognized in your current environment, which is likely a Windows Command Prompt or PowerShell.

If you're trying to copy your SSH key to a remote server on Windows, ssh-copy-id might not be available by default. However, you can achieve the same result with a few manual steps:

  1. Generate SSH Key (if you haven't already):

    1
    ssh-keygen

  2. Display and Copy Your Public Key:

    1
    type $env:USERPROFILE\.ssh\id_rsa.pub | clip

    This command will copy your public key to the clipboard.

  3. Manually Add the Key to the Remote Server: SSH into your remote server:

    1
    ssh username@remote_server_address

    Once logged in, append the copied key to the ~/.ssh/authorized_keys file:

    1
    echo "YOUR_COPIED_PUBLIC_KEY" >> ~/.ssh/authorized_keys

    Make sure to replace YOUR_COPIED_PUBLIC_KEY with the actual key you copied to the clipboard.

  4. Set Proper Permissions (if needed): On the remote server, ensure that the ~/.ssh directory and ~/.ssh/authorized_keys file have the correct permissions:

    1
    2
    chmod 700 ~/.ssh
    chmod 600 ~/.ssh/authorized_keys

After these steps, you should be able to SSH into the remote server without entering a password.

how to shutdown ssh connetion with the Linux server

simply type

1
exit

passphrase

[[单调队列 MonotonousQueue]]

std::qsort使用示例

必须要#include <cstdlib>

1
2
3
4
5
6
7

int *num;
int cmp(const void *a, const void *b) {
return *((int *)b) - *((int *)a); //前减后从小到大 后减前从大到小
}
std::qsort(num + 1, n, sizeof(int), cmp);

git revert

git reset

给出一个数组,输出其中每\(k_i\)个连续的数中的最大值和最小值(\(k_i\)\(k\)可随下标变化而变化)。对于自然的暴力枚举的想法,我们需要\(\mathcal{O}(nk)\)的代价,这在\(n\)\(k\)可能很大时明显代价很高,这时我们需要单调队列。

最终解决办法,打开Allow LAN选项,然后开启tun mode,注意必须要下载并启用service mode1

阅读全文 »

条件格式 conditional formatting

You can use conditional formatting in Excel to change the background color of cells based on a condition. Here's how you can do it to change the background color to red if the unit value in a cell is greater than 0.04:

  1. Select the cell or range of cells where you want to apply the conditional formatting.

  2. Go to the "Home" tab in the Excel ribbon.

  3. In the "Styles" group, click on "Conditional Formatting."

  4. Choose "New Rule" from the dropdown menu.

  5. In the "New Formatting Rule" dialog box, select "Use a formula to determine which cells to format."

  6. In the "Format values where this formula is true" field, enter the following formula:

    1
    =A1>0.04

    Note: Replace "A1" with the reference to the cell you want to apply this rule to. If you are formatting a range of cells, adjust the formula accordingly.

  7. Click the "Format" button to set the formatting for cells that meet the condition.

  8. In the "Format Cells" dialog box, go to the "Fill" tab.

  9. Choose the red color you want for the background from the color palette.

  10. Click "OK" to confirm the formatting.

  11. Back in the "New Formatting Rule" dialog box, you will see a preview of how the formatting will look. Make sure it's what you want.

  12. Click "OK" to apply the conditional formatting rule.

The selected cells will now have a red background if the unit value is greater than 0.04. You can adjust the formula and formatting settings as needed for your specific Excel sheet.

常用快捷键

ctrl+c用于终止当前命令的执行

ctrl+alt+t 打开终端

Linux文件目录

Linux文件系统区分大小写,这与Windows文件系统不同,Windows文件系统通常是不区分大小写的。

至于目录分隔符,Linux使用正斜杠 (/) 作为路径分隔符。例如,/home/user/documents。这与Windows不同,Windows使用反斜杠 (\) 作为其路径分隔符。

Linux目录中有空格

通过\进行转义

1
2
cd My\ Directory\ With\ Spaces/

加引号表示目录

1
2
cd "My Directory With Spaces/"
cd 'My Directory With Spaces/'

which显示某个软件包的安装位置

1
which gdb