Skip to content

Instantly share code, notes, and snippets.

View vjk2005's full-sized avatar

Vijay vjk2005

View GitHub Profile
@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>'))
@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 = () => {
convert <space-separated-list-of-images> -quality 100 output.pdf
convert -resize '4000' -density 576 input.pdf -resize 50% output.png
@vjk2005
vjk2005 / dynamic-scaling-factor-airmash.js
Created May 16, 2018 17:05
Dynamically zoom-in on keypress to make close-quarters fighting easier on Airmash. Also adds a shortcut key for flag drops.
// press option key to zoom-in for close-quarters fighting
let zoom = false
document.onkeydown = e => {
if(e.key == 'Alt') {
zoom = true
e.stopPropagation()
e.preventDefault()
config.scalingFactor = 2000
Graphics.resizeRenderer(window.innerWidth, window.innerHeight)
return false