惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

有赞技术团队
有赞技术团队
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
aimingoo的专栏
aimingoo的专栏
IT之家
IT之家
G
Google Developers Blog
爱范儿
爱范儿
博客园 - 司徒正美
Recent Announcements
Recent Announcements
The Register - Security
The Register - Security
J
Java Code Geeks
The Cloudflare Blog
M
MIT News - Artificial intelligence
Apple Machine Learning Research
Apple Machine Learning Research
Microsoft Security Blog
Microsoft Security Blog
博客园 - Franky
雷峰网
雷峰网
酷 壳 – CoolShell
酷 壳 – CoolShell
Blog — PlanetScale
Blog — PlanetScale
Vercel News
Vercel News
宝玉的分享
宝玉的分享
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
B
Blog
小众软件
小众软件
Microsoft Azure Blog
Microsoft Azure Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
WordPress大学
WordPress大学
T
Troy Hunt's Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
H
Hacker News: Front Page
H
Help Net Security
S
Security @ Cisco Blogs
V
V2EX
Security Archives - TechRepublic
Security Archives - TechRepublic
Stack Overflow Blog
Stack Overflow Blog
O
OpenAI News
L
LINUX DO - 最新话题
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
S
Secure Thoughts
Help Net Security
Help Net Security
F
Full Disclosure
博客园 - 叶小钗
The Hacker News
The Hacker News
Spread Privacy
Spread Privacy
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Jina AI
Jina AI
K
Kaspersky official blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
V
Vulnerabilities – Threatpost
P
Privacy International News Feed
Scott Helme
Scott Helme

Hunsh's Blog

如何选择合适的加密手段 Nginx SNI Proxy 如何优雅导入 k8s.io/kubernetes Make Go mod and Git to use specify .netrc 多架构镜像的体积优化 使用 buildkit 进行多架构构建并提取产物 如何修改镜像 layer(以 sourcemap-less grafana 为例) acme.sh 自动化 Google CA 申请证书 微信小程序嵌入任意公众号文章 k8s && bazel 项目从 go1.20 升级 go1.21 go serve http and https on same port typecho 迁移到 hexo 实现 hexo 文章和资源在同一目录下 golang mitm 遇到的问题 流式数据专用的 mine-type Golang 正向代理对于 Host 的处理 (RFC 7230) 分享 MacOS 的一些系统fix脚本(dns、sleep) prometheus rate/increase/delta/sum等函数不符合预期或出现小数的原理 [油猴脚本] USTB Everywhere 为校外访问添加访问任意网站的能力
生成个人的 Github PR List
2025-05-18 · via Hunsh's Blog

写了一个小脚本,可以生成任意用户的 pr list

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
from collections import defaultdict

import requests

USERNAME = 'hunshcn'
TARGET = 'source/about/index.md'

def generate_contributing_table(username, target):
url = f'https://api.github.com/search/issues?per_page=100&q=is%3Apr+author%3A{username}+archived%3Afalse+is%3Aclosed+is%3Amerged+is%3Apublic+type%3Apr&page='
data = []
page = 1
while True:
r = requests.get(url + str(page)).json()
total = r['total_count']
data.extend(r['items'])
if total <= page * 100:
break
page += 1

repos = defaultdict(list)

for item in data:
repo = item['repository_url'].removeprefix('https://api.github.com/repos/')
number = item['number']
repos[repo].append(number)

items = sorted(repos.items(), key=lambda x: len(x[1]), reverse=True)

# Generate markdown table
table_lines = [
"| # | 仓库 | PR |",
"|:---|:---|:---|"
]

for index, (repo, numbers) in enumerate(items, 1):
pr_links = [f"[#{n}](https://github.com/{repo}/pull/{n})" for n in numbers]
pr_list = " ".join(pr_links)
table_lines.append(f"| {index} | [{repo}](https://github.com/{repo}) | {pr_list} |")

# Read the index.md file
with open(target, 'r', encoding='utf-8') as f:
content = f.read()

# Replace the table block
start_marker = "<!-- Contributing block start -->\n"
end_marker = "\n<!-- Contributing block end -->"
table_content = "\n".join(table_lines)
start_index = content.find(start_marker)
end_index = content.find(end_marker)
assert start_index != -1 and end_index != -1, "Contributing block not found"
new_content = content[:start_index+len(start_marker)] + table_content + content[end_index:]

# Write back to the file
with open(target, 'w', encoding='utf-8') as f:
f.write(new_content)

print("done")

if __name__ == "__main__":
generate_contributing_table(USERNAME, TARGET)

这个主要是为了我的 about 页面而写的,会将 pr list 作为 table 写入指定的 markdown 中,只需要在 markdown 中准备一个 Contributing block

1
2
<!-- Contributing block start -->
<!-- Contributing block end -->

脚本就会自动填充,效果可以见 我的 aboout