Skip to content

Instantly share code, notes, and snippets.

View rnjailamba's full-sized avatar
🎯
Focusing

Rnjai Lamba rnjailamba

🎯
Focusing
View GitHub Profile
@rnjailamba
rnjailamba / export_hackernews_submitted_posts.js
Last active January 3, 2025 04:50
Hackernews submitted posts
(function () {
const popup = createPopup('HN submitted');
if (location.host != 'news.ycombinator.com' || !(location.pathname == '/user' || location.pathname == '/submitted')) {
popup.innerHTML = 'ERROR: Go to your user or submitted page on HN and then try again.';
return;
}
const id = location.search.split('=')[1];
const types = {
csv: {
header: 'Name,URL',
@rnjailamba
rnjailamba / script.py
Last active August 1, 2025 07:40
Update table of contents and metadata of PDF with pymupdf
import pymupdf
doc = pymupdf.open("book.pdf")
#metadata = doc.metadata
#new_metadata = {"title": "New Title", "author": "New Author"}
#new_metadata = metadata
#doc.set_metadata(new_metadata)
toc = doc.get_toc()
new_toc = toc