Skip to content

Instantly share code, notes, and snippets.

View Arcitec's full-sized avatar
🤣

Johnny Arcitec Arcitec

🤣
View GitHub Profile
@Arcitec
Arcitec / youtubevideolist.js
Created January 7, 2022 04:07
YouTube Studio: Export titles and links for all your videos.
// 1. Go to https://studio.youtube.com/
// 2. Go to the "Content" (Channel content) page, which is the list of all your videos.
// 3. Run this in the browser's Javascript console.
// 4. Just copy the console text (contains all of the currently visible videos).
let lines = []; document.querySelectorAll("ytcp-video-section-content a#thumbnail-anchor").forEach((lbl) => { lines.push(lbl.getAttribute("aria-label")); let href = lbl.href.match(/video\/(.+?)\/edit$/); href = href ? "https://www.youtube.com/watch?v=" + href[1] : "Failed to retrieve link."; lines.push(href + "\n"); }); console.log(lines.join("\n"));
@Arcitec
Arcitec / Force PiP Mode (Chrome)
Last active January 29, 2021 19:27
Save as a bookmarklet to have an easy, 1-click button for opening HTML5 videos in PiP mode.
javascript:if("pictureInPictureEnabled"in document&&"querySelectorAll"in document){(async function(){const a=document.querySelectorAll("video");if(0===a.length)window.alert("Sorry, no videos on the page.");else if(0<a.length){const b=a[0];try{b===document.pictureInPictureElement?await document.exitPictureInPicture():await b.requestPictureInPicture()}catch(a){console.error(a)}}})()}else"pictureInPictureEnabled"in document?document.pictureInPictureEnabled||window.alert("Picture-in-Picture not available."):window.alert("Picture-in-Picture is disabled.");
@Arcitec
Arcitec / analyzelua.sh
Last active January 7, 2022 04:10
Static analysis of Lua 5.1/5.2/5.3 source, finding all global references and making them local
# Based on http://lua-users.org/wiki/DetectingUndefinedVariables, but extended to automate the code generation.
# Lua 5.1
for f in *.lua; do luac-5.1 -p -l "$f" | grep ETGLOBAL | cut -d ';' -f 2 | sort | uniq | sed -E 's/^ (.+)$/local \1 = \1;/' > "_globals.${f}.txt"; done
# Lua 5.2 and 5.3
for f in *.lua; do luac-5.3 -p -l "$f" | grep 'ETTABUP.*_ENV' | cut -d ';' -f 2 | cut -d ' ' -f 1-3 | sort | uniq | sed -E 's/^ _ENV "(.+)"\s*$/local \1 = \1;/' > "_globals.${f}.txt"; done
# The resulting log files will be overzealous (any non-"local"-declared vars from the same file will be seen as globals),
# so you'll still have to do manual work to remove the things that aren't necessary. But it's a lot better than doing