一个宝藏

https://v.youku.com/v_show/id_XNTQ0MjA1NzUy.html

卡时

if(clock()>0.95*CLOCKS_PER_SEC)break;

计数题:TopCoder 500-700 1000 分的题

Latex 手动安装宏包:https://www.ctan.org/ 下载后把解压的文件夹丢/usr/share/texmf/tex/latex里,然后sudo texhash一下。如果是ins文件还得手动编译一下。

Linux 自定义命令

把可执行文件放到/usr/bin下即可

Linux 权限设置

chmod,一般是 755
chown,可以设置所有者

V2ray

bash <(curl -s -L https://git.io/v2ray.sh)

生成 UUID

cat /proc/sys/kernel/random/uuid

CF 读题(解)小助手

中 英 双 语

document.querySelectorAll('p').forEach(function(item){
    item.innerHTML=item.innerHTML
        .replace(/You are given/g,"给你")
        .replace(/at least/g,"至少")
        .replace(/overlap/g,"重叠")
        .replace(/can not/g,"不能")
        .replace(/cannot/g,"不能")
        .replace(/can't/g,"不能")
        .replace(/twice/g,"两次")
        .replace(/tournament/g,"锦标赛")
        .replace(/simplify/g,"简化")
        .replace(/consists of/g,"包含")
        .replace(/contains/g,"包含")
        .replace(/bidirectional/g,"双向")
        .replace(/easily/g,"容易地")
        .replace(/convex/g,"凸的")
        .replace(/functions/g,"函数")
        .replace(/function/g,"函数")
        .replace(/path/g,"路径")
        .replace(/tricky/g,"棘手的")
        .replace(/definition/g,"定义")
        .replace(/coincides with/g,"等价于")
        .replace(/centroid decmoposition/g,"点分治")
        .replace(/decreases/g,"递减")
        .replace(/increases/g,"递增")
        .replace(/increasing/g,"递增")
        .replace(/vertex/g,"结点")
        .replace(/vertices/g,"结点")
        .replace(/exists/g,"存在")
        .replace(/contradict/g,"否认")
        .replace(/gradient/g,"斜坡")
        .replace(/efficiently/g,"快速地")
        .replace(/algorithms/g,"算法")
        .replace(/algorithm/g,"算法")
        .replace(/given/g,"给定")
        .replace(/dichotomy/g,"二分法")
        .replace(/no larger than/g,"不大于")
        .replace(/optimum/g,"最优解")
        .replace(/already/g,"已经")
        .replace(/as we can see/g,"我们可以发现")
        .replace(/As we can see/g,"我们可以发现")
        .replace(/ we /g," 我们 ")
        .replace(/We /g,"我们 ")
        .replace(/subtrees/g,"子树")
        .replace(/subtree/g,"子树")
        .replace(/calculation/g,"计算")
        .replace(/global/g,"全局")
        .replace(/easy/g,"容易")
        .replace(/derivative/g,"导数")
        .replace(/degree/g,"度")
        .replace(/formula/g,"公式")
        .replace(/Indeed,/g,"具体地说,")
        .replace(/calculate/g,"计算")
        .replace(/Fix/g,"固定")
        .replace(/fix /g,"固定 ")
        .replace(/ a single /g," 一个 ")
        .replace(/ a /g," 一个 ")
        .replace(/A /g,"一个 ")
        .replace(/name/g,"名字")
        .replace(/substrings/g,"子串")
        .replace(/substring/g,"子串")
        .replace(/strings/g,"字符串")
        .replace(/string/g,"字符串")
        .replace(/Sometimes/g,"有时")
        .replace(/sometimes/g,"有时")
        .replace(/For example/g,"举个例子")
        .replace(/length/g,"长度")
        .replace(/sequence/g,"序列")
        .replace(/integer/g,"整数")
        .replace(/input/g,"读入")
        .replace(/Input/g,"读入")
        .replace(/lowercase/g,"小写")
        .replace(/the longest/g,"最长的")
        .replace(/longest/g,"最长的")
        .replace(/such that/g,"满足")
        .replace(/Print/g,"输出")
        .replace(/print/g,"输出")
        .replace(/except /g,"除了 ")
        .replace(/set up/g,"设立")
});

C++ 多维数组指针声名

int _f[MM][C][C],_g[MM][C][C];
int (*f)[C][C]=_f,(*g)[C][C]=_g;

m3u8

npm ci --registry https://registry.npmjs.org/ --https-proxy 127.0.0.1:1080

creat_ap

创建热点

create_ap wlo1 eno1 sshwy-manjaro 00000000

遇到ERROR: Failed to initialize lock

sudo rm /tmp/create_ap.all.lock

Linux 系统信息

screenfetch

Access website was denied

多半是服务器的文件权限问题。注意检查文件夹的可执行权限,这个东西在文件夹上面的意思是能否进入文件夹读取里面的文件,tar 解压出来的文件夹对其他用户多半没有这个权限。

系统信息

sudo inxi -Fxzz-

SSH 小技巧

正常的 ssh 命令形如

ssh -p [port] [user]@[hostname]

要添加反向通道可以有

ssh -R [custom unoccupied port on remote]:localhost:[ssh port of target host, usually 22] -p [remote ssh port] [user]@[remote host name]
ssh -R 9124:localhost:22 -p 36164 [email protected]

要利用反向通道设置跳板可以有

Host agibot_206
  HostName localhost
  IdentityFile ~/.ssh/nopass
  Port [custom unoccupied port on remote]
	ProxyJump A
	User [user of target host]

Host A
  HostName [remote host name]
  IdentityFile ~/.ssh/nopass
  Port [remote ssh port]
	User [user]

如果要断线自动重连可以看 autossh

VSCode SSH 遇到 “Remote Extension host terminated unexpectedly 3 times within the last 5 minutes”

试试 code --disable-extensions 能不能成功。如果可以的话说明是插件开太多了,那就手动关一些莫名其妙的吧.

文件权限处理

有时候复制或者移动大批量文件之后,权限会发生变化。常用的处理方式包括

sudo chown -R huangweiyao . # 递归修改文件 owner (group 不变)
sudo chmod -R g+w . # 给 group 加上可写权限(因为一般来说 owner 是可写的,改了 owner 之后原来的 owner 可能就不可写了,这时给 group (通常是 root)加上可写权限就可以解决这个问题

有关 Shell 歧视

遇到一些莫名其妙的服务器,在 pip install -e . 如果涉及到 cuda 编译相关的内容,如果 conda 没配好的话可能会g,可以换个shell试试。

VSCode Remote SSH 手动安装插件

首先下载 VSIX 文件,然后传到远程服务器上,接着通过简单的 ls 手段找到 ~/.vscode-server/cli/servers/Stable-[HASH]/server/bin,其中 [HASH] 是一个哈希值(找一个最新版本的 server)。然后在其中执行 ./code-server --install-extension [VSIX path] 即可。