Skip to content

Instantly share code, notes, and snippets.

@coldwaterq
coldwaterq / download.js
Last active December 4, 2023 07:33
download thins
const delay = ms => new Promise(res => setTimeout(res, ms));
const yourFunction = async () => {
downloads = document.getElementsByClassName("bc-icon-download-s2");
for(var i =0; i<downloads.length; i++){
if(downloads[i].parentElement.children[1] != null && downloads[i].parentElement.children[1].innerText == 'Download'){
downloads[i].click();
console.log(i);
await delay(60000);
}
}
@coldwaterq
coldwaterq / pdfExpander.py
Last active August 13, 2024 18:06
make a new pdf that repeats the first page of test.pdf 4000 times. Allowing for a file that is smaller but baloons to use a ton of memory
pdfcontent = open(r'test.pdf','rb').read()
loc = pdfcontent.index(b"\n2 0 obj\n<<")
loc = pdfcontent.index(b"[", loc)+2
loc2 = pdfcontent.index(b"R", loc)+2
page = pdfcontent[loc:loc2]
print(page)
pdfcontent = pdfcontent[:loc]+(page+b"\n")*4000+pdfcontent[loc2:]
countLoc = pdfcontent.index(b"\n/Count ")
endCountLoc = pdfcontent.index(b"\n",countLoc+1)
pdfcontent = pdfcontent[:countLoc]+pdfcontent[endCountLoc:]