A loop within loops, Seeking the base case to find, Endless paths unwind.
— create by openai
DevOps
A loop within loops, Seeking the base case to find, Endless paths unwind.
— create by openai
publicsuffix/list: The Public Suffix List (github.com)
要实现一个http client,可能就会涉及cookiejar,这就需要了解cookie的存储,就和域名有关系,你不能把 a.com.cn 和 a.cn 的cookie都存到 .cn下面,因为.cn 是个顶级域名;也不能把 a.com.cn 好 b.com.cn 的cookie都存在.com.cn 下面,因为.com.cn也是个顶级域名;但是1.a.cn 和 2.a.cn 这两个域名的cookie就可以都设置在 a.cn下面,因为这个a.cn 不是顶级域名。没有一个算法快速判断哪个域名是否顶级域名,只能把所有顶级域名都存起来,就是上面的public suffix list,比如,golang中就有一个net.publicsuffix ,这个是硬编码的。
eTLD: effective top level domain
天气通 – 关注天气,开启美好生活 来自 Weibo Internet Technology (China) Co.Ltd.
天气通 – 关注天气,开启美好生活 来自 Weibo Internet Technology (China) Co.Ltd.
https://apps.apple.com/cn/app/%E5%A4%A9%E6%B0%94%E9%80%9A-%E5%85%B3%E6%B3%A8%E5%A4%A9%E6%B0%94-%E5%BC%80%E5%90%AF%E7%BE%8E%E5%A5%BD%E7%94%9F%E6%B4%BB/id458032309
man gcc
gcc 编译时,如果使用了 -fvisibility=hidden 选项,编译的so文件中的函数默认是不导出的,就是动态链接是链接不到的;不仅有隐藏的效果(使用nm还是能看到的,所以,该选项不是出于安全考虑,主要是实现private的效果),也有利于编译器的进一步优化。由于历史代码可能不期望这个行为,所以该选项也不是默认行为(好像在object-c中是默认行为)。
下面测试一下:
main
1 2 3 4 5 6 7 8 9 |
#include<stdlib.h> #include<stdio.h> #include "f.h" int main(int ac, char** av) { printf("%d\n", a()); return 0; } |
f.h
1 |
int a(); |
这个头文件太简单了🤦♀️
libf.c
1 2 3 4 |
// __attribute__((visibility ("default"))) // 打开该注释就可以显式导出 int a() { return 1; } |
编译main.c
1 2 |
gcc -lf -L . main.c f.h #使用clang也行,参数都一样 |
编译libf.c
1 2 |
// 隐藏的编译方式,编译后,运行报错 gcc -shared -fvisibility=hidden -o libf.so libf.c |
0.207 还不支持设置history file,只能是 HOME目录下的.presto_history
Central Repository: com/facebook/presto/presto-cli/0.207 (maven.org)
1 2 3 4 |
private static MemoryHistory getHistory() { return getHistory(new File(getUserHome(), ".presto_history")); } |
较新的版本(如: 0.284 )就可以通过环境变量 PRESTO_HISTORY_FILE 来设置了:
1 2 3 4 5 6 7 8 9 10 11 12 |
private static MemoryHistory getHistory() { String historyFilePath = System.getenv("PRESTO_HISTORY_FILE"); File historyFile; if (isNullOrEmpty(historyFilePath)) { historyFile = new File(getUserHome(), ".presto_history"); } else { historyFile = new File(historyFilePath); } return getHistory(historyFile); } |
查看presto版本号:
1 2 |
$ presto --version Presto CLI 0.207-dirty |
MacOS 电池模式下,过几分钟就自动休眠,使用键盘或电源键也无法唤醒,合上盖子等几秒钟再打开就可以唤醒了。
解决办法: