Add comprehensive GitHub guide covering account setup, collaboration, and API usage

This commit is contained in:
2026-02-05 21:00:02 -06:00
parent e8f4979ff3
commit ea00a7be82
13 changed files with 8495 additions and 79 deletions
+161 -78
View File
@@ -2,33 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 8,
"id": "9f587bf1",
"metadata": {},
"outputs": [],
"source": [
"import { load } from \"jsr:@std/dotenv\";\n",
"import OpenAI from \"jsr:@openai/openai\";\n",
"\n",
"const _ = await load({ export: true });\n",
"const openai = new OpenAI();"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "4650126c",
"metadata": {},
"outputs": [],
"source": [
"const safeName = (s: string) => s.replace(/[<>:\"/\\\\|?*\\x00-\\x1F]/g, \"_\").trim();\n",
"const bookName =\n",
" \"Nmap Network Scanning Official Nmap Project Guide to Network Discovery and Security Scanning\";\n"
]
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 2,
"id": "ae701b32",
"metadata": {},
"outputs": [],
@@ -59,7 +33,66 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 7,
"id": "9f587bf1",
"metadata": {},
"outputs": [],
"source": [
"import { load } from \"jsr:@std/dotenv\";\n",
"import OpenAI from \"jsr:@openai/openai\";\n",
"\n",
"// flush all previous env vars\n",
"/* for (const key of Object.keys(Deno.env.toObject())) {\n",
" Deno.env.delete(key);\n",
"} */\n",
"const _ = await load({ export: true });\n",
"const openai = new OpenAI();"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "4650126c",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"progit\n"
]
}
],
"source": [
"const safeName = (s: string) => s.replace(/[<>:\"/\\\\|?*\\x00-\\x1F]/g, \"_\").trim();\n",
"const bookName = Deno.env.get(\"BOOK_NAME\");\n",
"\n",
"if (!bookName) {\n",
" throw new Error(\"BOOK_NAME environment variable is not set\");\n",
"}\n",
"\n",
"console.log(bookName);\n"
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "211e589f",
"metadata": {},
"outputs": [],
"source": [
"// BOOKMARK_LEVEL=1\n",
"// BOOK_FROM=10\n",
"// BOOK_TO=-1\n",
"\n",
"Deno.env.set(\"BOOKMARK_LEVEL\", \"1\");\n",
"Deno.env.set(\"BOOK_FROM\", \"10\");\n",
"Deno.env.set(\"BOOK_TO\", \"-1\");"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "8bee369d",
"metadata": {},
"outputs": [
@@ -68,51 +101,33 @@
"output_type": "stream",
"text": [
"[\n",
" { title: \"01\", level: 1, page: 27, endpage: 50 },\n",
" { title: \"02\", level: 1, page: 51, endpage: 71 },\n",
" { title: \"03\", level: 1, page: 72, endpage: 97 },\n",
" { title: \"04\", level: 1, page: 98, endpage: 119 },\n",
" { title: \"05\", level: 1, page: 120, endpage: 158 },\n",
" { title: \"06\", level: 1, page: 159, endpage: 168 },\n",
" { title: \"07\", level: 1, page: 169, endpage: 193 },\n",
" { title: \"08\", level: 1, page: 194, endpage: 227 },\n",
" { title: \"09\", level: 1, page: 228, endpage: 278 },\n",
" { title: \"10\", level: 1, page: 279, endpage: 315 },\n",
" { title: \"11\", level: 1, page: 316, endpage: 326 },\n",
" { title: \"12\", level: 1, page: 327, endpage: 356 },\n",
" { title: \"13\", level: 1, page: 357, endpage: 382 },\n",
" { title: \"14\", level: 1, page: 383, endpage: 391 },\n",
" { title: \"15\", level: 1, page: 392, endpage: 392 }\n",
"]\n",
"Processing chapter: 01\n",
"Processing chapter: 02\n",
"Processing chapter: 03\n",
"Processing chapter: 04\n",
"Processing chapter: 05\n",
"Processing chapter: 06\n",
"Processing chapter: 07\n",
"Processing chapter: 08\n",
"Processing chapter: 09\n",
"Processing chapter: 10\n",
"Processing chapter: 11\n",
"Processing chapter: 12\n",
"Processing chapter: 13\n",
"Processing chapter: 14\n",
"Processing chapter: 15\n",
"Finished processing chapter: 15\n",
"Finished processing chapter: 11\n",
"Finished processing chapter: 14\n",
"Finished processing chapter: 05\n",
"Finished processing chapter: 07\n",
"Finished processing chapter: 06\n",
"Finished processing chapter: 12\n",
"Finished processing chapter: 04\n",
"Finished processing chapter: 03\n",
"Finished processing chapter: 01\n",
"Finished processing chapter: 13\n",
"Finished processing chapter: 09\n",
"Finished processing chapter: 08\n",
"Finished processing chapter: 02\n"
" { title: \"Git Branching\", level: 1, page: 69, endpage: 110 },\n",
" { title: \"Git on the Server\", level: 1, page: 111, endpage: 131 },\n",
" { title: \"Distributed Git\", level: 1, page: 132, endpage: 172 },\n",
" { title: \"GitHub\", level: 1, page: 173, endpage: 225 },\n",
" { title: \"Git Tools\", level: 1, page: 226, endpage: 348 },\n",
" { title: \"Customizing Git\", level: 1, page: 349, endpage: 380 },\n",
" { title: \"Git and Other Systems\", level: 1, page: 381, endpage: 436 },\n",
" { title: \"Git Internals\", level: 1, page: 437, endpage: 476 },\n",
" {\n",
" title: \"Appendix A: Git in Other Environments\",\n",
" level: 1,\n",
" page: 477,\n",
" endpage: 489\n",
" },\n",
" {\n",
" title: \"Appendix B: Embedding Git in your Applications\",\n",
" level: 1,\n",
" page: 490,\n",
" endpage: 501\n",
" },\n",
" {\n",
" title: \"Appendix C: Git Commands\",\n",
" level: 1,\n",
" page: 502,\n",
" endpage: 502\n",
" }\n",
"]\n"
]
}
],
@@ -133,7 +148,7 @@
" (res) => new TextDecoder().decode(res.stdout),\n",
").then((data) => {\n",
" const lines = data.split(\"\\n\");\n",
" let bookmarks = [];\n",
" let bookmarks: Bookmark[] = [];\n",
" let currentBookmark: Partial<Bookmark> | null = null;\n",
"\n",
" for (const line of lines) {\n",
@@ -164,7 +179,12 @@
" bookmarks.push(currentBookmark as Bookmark);\n",
" }\n",
"\n",
" bookmarks = bookmarks.filter((b) => b.level === 1).slice(8);\n",
" bookmarks = bookmarks.filter((b) =>\n",
" b.level === parseInt(Deno.env.get(\"BOOKMARK_LEVEL\") ?? \"1\")\n",
" ).slice(\n",
" parseInt(Deno.env.get(\"BOOK_FROM\") ?? \"0\"),\n",
" parseInt(Deno.env.get(\"BOOK_TO\") ?? String(bookmarks.length)),\n",
" );\n",
"\n",
" for (let i = 0; i < bookmarks.length; i++) {\n",
" const current = bookmarks[i] as Bookmark;\n",
@@ -178,8 +198,71 @@
"\n",
" return bookmarks;\n",
"});\n",
"console.log(bookmarks);\n",
"\n",
"if (!bookmarks || bookmarks.length === 0) {\n",
" throw new Error(\"No bookmarks found in the PDF.\");\n",
"} /* else if (bookmarks.length > ordinals.length) {\n",
" throw new Error(\n",
" `Not enough ordinals for the number of chapters: ${bookmarks.length} chapters but only ${ordinals.length} ordinals.`,\n",
" );\n",
"} */\n",
"\n",
"console.log(bookmarks);\n"
]
},
{
"cell_type": "code",
"execution_count": 13,
"id": "6029d4ac",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Processing chapter: Appendix C: Git Commands at resp_04d1e841c5c4dfc2006984fd06079c81949afb817229705523\n",
"Finished processing chapter: Appendix C: Git Commands\n",
"Processing chapter: Customizing Git at resp_0ee8a5d1ba6d78a6006984fd06313c819087c4177391a50101\n",
"Finished processing chapter: Customizing Git\n",
"Processing chapter: Appendix A: Git in Other Environments at resp_00ee07fd3ffdee22006984fd069c7c8193bf192277fb80f4bc\n",
"Finished processing chapter: Appendix A: Git in Other Environments\n",
"Processing chapter: Git Internals at resp_0d312b5627d2306a006984fd0660c081939ebc561caf071506\n",
"Finished processing chapter: Git Internals\n",
"Processing chapter: Git on the Server at resp_07581a2e7f9be083006984fd05d32c8190b87cf1e8d7d68a5c\n",
"Finished processing chapter: Git on the Server\n",
"Processing chapter: GitHub at resp_0e4a9edfb24ed6a1006984fd06722081909497d0c7e35bfb1d\n",
"Finished processing chapter: GitHub\n",
"Processing chapter: Appendix B: Embedding Git in your Applications at resp_079044470442fcc0006984fd05fc1881978cacbd612d6e2f30\n",
"Finished processing chapter: Appendix B: Embedding Git in your Applications\n",
"Processing chapter: Distributed Git at resp_0947b861b710eb8a006984fd06918881968e0e1f70b418cc88\n",
"Finished processing chapter: Distributed Git\n",
"Processing chapter: Git Tools at resp_01ec7c1b665f5b12006984fd06b9048196a56f1e376843b55a\n",
"Finished processing chapter: Git Tools\n",
"Processing chapter: Git and Other Systems at resp_0e3a4b42775ae33f006984fd061cf8819389817080ff57b78f\n",
"Finished processing chapter: Git and Other Systems\n",
"Processing chapter: Git Branching at resp_0bb2c9b2b1435efc006984fd0641d08194b3fd55b5e3b3b432\n",
"Finished processing chapter: Git Branching\n"
]
},
{
"data": {
"text/plain": [
"[\n",
" \u001b[90mundefined\u001b[39m, \u001b[90mundefined\u001b[39m,\n",
" \u001b[90mundefined\u001b[39m, \u001b[90mundefined\u001b[39m,\n",
" \u001b[90mundefined\u001b[39m, \u001b[90mundefined\u001b[39m,\n",
" \u001b[90mundefined\u001b[39m, \u001b[90mundefined\u001b[39m,\n",
" \u001b[90mundefined\u001b[39m, \u001b[90mundefined\u001b[39m,\n",
" \u001b[90mundefined\u001b[39m\n",
"]"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"const promises = [];\n",
"for (const [idx, ch] of bookmarks.entries()) {\n",
" async function processChapter(idx: number, title: string, file: File) {\n",
@@ -215,7 +298,7 @@
"\n",
" const mindMapContent = response.output_text;\n",
" await Deno.writeTextFile(\n",
" `./mindmaps/${safeName(title)}.md`,\n",
" `./mindmap/${safeName(title)}.md`,\n",
" mindMapContent,\n",
" );\n",
"\n",
@@ -266,7 +349,7 @@
{
"data": {
"text/plain": [
"{ object: \u001b[32m\"file\"\u001b[39m, deleted: \u001b[33mtrue\u001b[39m, id: \u001b[32m\"file-X2CJi3gozhJniBURG2qfsm\"\u001b[39m }"
"{ object: \u001b[32m\"file\"\u001b[39m, deleted: \u001b[33mtrue\u001b[39m, id: \u001b[32m\"file-CxDoeyfgNLkuizajP6EHas\"\u001b[39m }"
]
},
"execution_count": 5,