Skip to content

Instantly share code, notes, and snippets.

View vjk2005's full-sized avatar

Vijay vjk2005

View GitHub Profile
mpv link_to_youtube_vid --no-video
@vjk2005
vjk2005 / automator_jquery.txt
Created March 2, 2017 06:23
Inject jquery into the most active tab using JXA (Javascript for Automation, OSX)
// put this inside a Run Javascript block in Automator
app.doJavaScript("var script = document.createElement('script'); script.src = 'https://ajax.googleapis.com/ajax/libs/jquery/1.6.3/jquery.min.js'; document.getElementsByTagName('head')[0].appendChild(script);", {
in: app.windows[0].currentTab
})
delay(1); // wait for jQuery to load
//... jQuery is now loaded, now add the rest of the script
@vjk2005
vjk2005 / load_all_reddit_comments.js
Last active August 27, 2018 11:55
Copy-paste this script in your browser console to load all comments on that reddit thread. (added resume after some time as well as a way to pause all downloads)
pause = false, timeout = lastFetch = restarter = null, moreCommentSelector = 'span.morecomments > a'
moreCommentLinks = () => document.querySelectorAll(moreCommentSelector)
showProgress = msg => {
lastFetch = Date.now()
console.log(`${new Date().toLocaleTimeString()} — ${msg}`)
}
restartIfPaused = () => {
@vjk2005
vjk2005 / get_all_safari_tab_urls.scpt
Created August 18, 2018 15:02
Get list of all open URLs in all Safari Windows and paste them into a new TextEdit document
tell application "Safari"
set windowCount to number of windows
set docText to ""
repeat with x from 1 to windowCount
set tabcount to number of tabs in window x
repeat with y from 1 to tabcount
set tabName to URL of tab y of window x
set docText to docText & tabName & linefeed as string
end repeat
end repeat
@vjk2005
vjk2005 / concatenate_multiple_pages.js
Created August 1, 2018 22:23
De-paginates a blog or image gallery by fetching multiple pages and attaching them to the current page for easy archival. (NO JQUERY REQUIRED.)
/*
Similar to:
• https://gist.github.com/vjk2005/3331714 (ajax-page-loader.js)
• https://gist.github.com/vjk2005/3812832 (deepload.js)
*/
let start = 2,
end = 8,
url = ''
@vjk2005
vjk2005 / remove_elements_with_class.js
Created August 1, 2018 22:19
Cleans up DOM by removing elements with the specified class name
[...document.getElementsByClassName('class-name-goes-here')].map(el => el.parentNode.removeChild(el))
@vjk2005
vjk2005 / three_vids.sh
Created July 28, 2018 21:00 — forked from Erkaman/three_vids.sh
example script, that uses ffmpeg to make a video that shows three videos side by side
# Example video made by this script: https://twitter.com/erkaman2/status/990873258416361472
ffmpeg \
-y \
-i vid1.mp4 \
-i vid2.mp4 \
-i vid3.mp4 \
-filter_complex '[0:v]pad=iw*3:ih[int];[int][1:v]overlay=W*0.33:0[temp];[temp][2:v]overlay=W*0.66:0[vid]' \
-map [vid] \
-c:v libx264 \
@vjk2005
vjk2005 / full_size_images_instagram.js
Created July 24, 2018 19:37
Extract full-res (1080p) images on Instagram
javascript:window.location = document.querySelectorAll('img[srcset^="http"]')[0].srcset.split(',').pop().split(' ')[0]
@vjk2005
vjk2005 / linkify_ebook3000_dot_com.js
Created July 15, 2018 10:46
Linkfy download links in the descriptions on ebook3000.com
[...document.querySelectorAll('.list_box_info.list_title')].map(el => el.innerHTML = el.textContent.replace(/http(.*)\.\.\./, '<a href="http$1">http$1</a>'))
convert <space-separated-list-of-images> -quality 100 output.pdf