Skip to content

Instantly share code, notes, and snippets.

View tristone13th's full-sized avatar
🎯
Focusing

Leinux tristone13th

🎯
Focusing
  • Alibaba
  • Hangzhou
View GitHub Profile
@tristone13th
tristone13th / content.md
Created January 8, 2025 09:03 — forked from baymaxium/content.md
知其然知其所以然,/PROC/MEMINFO之谜

原文:运维帮

转自:http://linuxperf.com/?p=142

作者:VMUNIX,已授权运维帮转发

/proc/meminfo是了解Linux系统内存使用状况的主要接口,我们最常用的”free”、”vmstat”等命令就是通过它获取数据的 ,/proc/meminfo所包含的信息比”free”等命令要丰富得多,然而真正理解它并不容易,比如我们知道”Cached”统计的是文件缓存页,manpage上说是“In-memory  cache  for  files read from the disk (the page cache)”,那为什么它不等于[Active(file)+Inactive(file)]?AnonHugePages与AnonPages、HugePages_Total有什么联系和区别?很多细节在手册中并没有讲清楚,本文对此做了一点探究。

负责输出/proc/meminfo的源代码是:fs/proc/meminfo.c : meminfo_proc_show()

@tristone13th
tristone13th / set_default_kernel.py
Created August 8, 2022 01:15
This snippet can help you change your grub default kernel when booting up.
import subprocess
import os
import sys
import re
if os.geteuid() != 0:
subprocess.call(['sudo', 'python3', *sys.argv])
sys.exit()
output = subprocess.check_output(
@tristone13th
tristone13th / lsp.log
Last active March 22, 2022 16:20
lsp.log
[START][2022-03-15 05:42:01] LSP logging initiated
[START][2022-03-16 00:15:24] LSP logging initiated
[ERROR][2022-03-16 00:15:24] .../vim/lsp/rpc.lua:420 "rpc" "clangd" "stderr" "I[00:15:24.850] clangd version 10.0.0-4ubuntu1 \nI[00:15:24.851] PID: 272776\nI[00:15:24.851] Working directory: /home/sdp/projects/pks-upstream\nI[00:15:24.851] argv[0]: clangd\nI[00:15:24.851] Starting LSP over stdin/stdout\n"
[ERROR][2022-03-16 00:15:24] .../vim/lsp/rpc.lua:420 "rpc" "clangd" "stderr" "I[00:15:24.867] <-- initialize(1)\n"
[ERROR][2022-03-16 00:15:24] .../vim/lsp/rpc.lua:420 "rpc" "clangd" "stderr" "I[00:15:24.895] --> reply:initialize(1) 28 ms\n"
[ERROR][2022-03-16 00:15:24] .../vim/lsp/rpc.lua:420 "rpc" "clangd" "stderr" "I[00:15:24.896] <-- initialized\nI[00:15:24.896] unhandled notification initialized\nI[00:15:24.897] <-- textDocument/didOpen\n"
[ERROR][2022-03-16 00:15:24] .../vim/lsp/rpc.lua:420 "rpc" "clangd" "stderr" "I[00:15:24.901] Failed to find compilation database for /home/sdp/projects/pks-upstream/
@tristone13th
tristone13th / lsp.log
Created March 22, 2022 16:20
lsp.log
[START][2022-03-15 05:42:01] LSP logging initiated
[START][2022-03-16 00:15:24] LSP logging initiated
[ERROR][2022-03-16 00:15:24] .../vim/lsp/rpc.lua:420 "rpc" "clangd" "stderr" "I[00:15:24.850] clangd version 10.0.0-4ubuntu1 \nI[00:15:24.851] PID: 272776\nI[00:15:24.851] Working directory: /home/sdp/projects/pks-upstream\nI[00:15:24.851] argv[0]: clangd\nI[00:15:24.851] Starting LSP over stdin/stdout\n"
[ERROR][2022-03-16 00:15:24] .../vim/lsp/rpc.lua:420 "rpc" "clangd" "stderr" "I[00:15:24.867] <-- initialize(1)\n"
[ERROR][2022-03-16 00:15:24] .../vim/lsp/rpc.lua:420 "rpc" "clangd" "stderr" "I[00:15:24.895] --> reply:initialize(1) 28 ms\n"
[ERROR][2022-03-16 00:15:24] .../vim/lsp/rpc.lua:420 "rpc" "clangd" "stderr" "I[00:15:24.896] <-- initialized\nI[00:15:24.896] unhandled notification initialized\nI[00:15:24.897] <-- textDocument/didOpen\n"
[ERROR][2022-03-16 00:15:24] .../vim/lsp/rpc.lua:420 "rpc" "clangd" "stderr" "I[00:15:24.901] Failed to find compilation database for /home/sdp/projects/pks-upstream/
@tristone13th
tristone13th / lsp.log
Created March 22, 2022 16:20
lsp.log
[START][2022-03-15 05:42:01] LSP logging initiated
[START][2022-03-16 00:15:24] LSP logging initiated
[ERROR][2022-03-16 00:15:24] .../vim/lsp/rpc.lua:420 "rpc" "clangd" "stderr" "I[00:15:24.850] clangd version 10.0.0-4ubuntu1 \nI[00:15:24.851] PID: 272776\nI[00:15:24.851] Working directory: /home/sdp/projects/pks-upstream\nI[00:15:24.851] argv[0]: clangd\nI[00:15:24.851] Starting LSP over stdin/stdout\n"
[ERROR][2022-03-16 00:15:24] .../vim/lsp/rpc.lua:420 "rpc" "clangd" "stderr" "I[00:15:24.867] <-- initialize(1)\n"
[ERROR][2022-03-16 00:15:24] .../vim/lsp/rpc.lua:420 "rpc" "clangd" "stderr" "I[00:15:24.895] --> reply:initialize(1) 28 ms\n"
[ERROR][2022-03-16 00:15:24] .../vim/lsp/rpc.lua:420 "rpc" "clangd" "stderr" "I[00:15:24.896] <-- initialized\nI[00:15:24.896] unhandled notification initialized\nI[00:15:24.897] <-- textDocument/didOpen\n"
[ERROR][2022-03-16 00:15:24] .../vim/lsp/rpc.lua:420 "rpc" "clangd" "stderr" "I[00:15:24.901] Failed to find compilation database for /home/sdp/projects/pks-upstream/
@tristone13th
tristone13th / lsp.log
Created March 22, 2022 16:20
lsp.log
[START][2022-03-15 05:42:01] LSP logging initiated
[START][2022-03-16 00:15:24] LSP logging initiated
[ERROR][2022-03-16 00:15:24] .../vim/lsp/rpc.lua:420 "rpc" "clangd" "stderr" "I[00:15:24.850] clangd version 10.0.0-4ubuntu1 \nI[00:15:24.851] PID: 272776\nI[00:15:24.851] Working directory: /home/sdp/projects/pks-upstream\nI[00:15:24.851] argv[0]: clangd\nI[00:15:24.851] Starting LSP over stdin/stdout\n"
[ERROR][2022-03-16 00:15:24] .../vim/lsp/rpc.lua:420 "rpc" "clangd" "stderr" "I[00:15:24.867] <-- initialize(1)\n"
[ERROR][2022-03-16 00:15:24] .../vim/lsp/rpc.lua:420 "rpc" "clangd" "stderr" "I[00:15:24.895] --> reply:initialize(1) 28 ms\n"
[ERROR][2022-03-16 00:15:24] .../vim/lsp/rpc.lua:420 "rpc" "clangd" "stderr" "I[00:15:24.896] <-- initialized\nI[00:15:24.896] unhandled notification initialized\nI[00:15:24.897] <-- textDocument/didOpen\n"
[ERROR][2022-03-16 00:15:24] .../vim/lsp/rpc.lua:420 "rpc" "clangd" "stderr" "I[00:15:24.901] Failed to find compilation database for /home/sdp/projects/pks-upstream/
@tristone13th
tristone13th / lsp.log
Created March 22, 2022 16:20
lsp.log
[START][2022-03-15 05:42:01] LSP logging initiated
[START][2022-03-16 00:15:24] LSP logging initiated
[ERROR][2022-03-16 00:15:24] .../vim/lsp/rpc.lua:420 "rpc" "clangd" "stderr" "I[00:15:24.850] clangd version 10.0.0-4ubuntu1 \nI[00:15:24.851] PID: 272776\nI[00:15:24.851] Working directory: /home/sdp/projects/pks-upstream\nI[00:15:24.851] argv[0]: clangd\nI[00:15:24.851] Starting LSP over stdin/stdout\n"
[ERROR][2022-03-16 00:15:24] .../vim/lsp/rpc.lua:420 "rpc" "clangd" "stderr" "I[00:15:24.867] <-- initialize(1)\n"
[ERROR][2022-03-16 00:15:24] .../vim/lsp/rpc.lua:420 "rpc" "clangd" "stderr" "I[00:15:24.895] --> reply:initialize(1) 28 ms\n"
[ERROR][2022-03-16 00:15:24] .../vim/lsp/rpc.lua:420 "rpc" "clangd" "stderr" "I[00:15:24.896] <-- initialized\nI[00:15:24.896] unhandled notification initialized\nI[00:15:24.897] <-- textDocument/didOpen\n"
[ERROR][2022-03-16 00:15:24] .../vim/lsp/rpc.lua:420 "rpc" "clangd" "stderr" "I[00:15:24.901] Failed to find compilation database for /home/sdp/projects/pks-upstream/
@tristone13th
tristone13th / gist:690f226b3af0c95f3deae87aef44bb8f
Created December 17, 2021 17:50
解决 GitHub 提交过慢问题
git config --global http.proxy 'socks5://127.0.0.1:7890'
git config --global https.proxy 'socks5://127.0.0.1:7890'
git config --global http.sslVerify false
git config --global https.sslVerify false