Skip to content

Instantly share code, notes, and snippets.

View vjk2005's full-sized avatar

Vijay vjk2005

View GitHub Profile
@vjk2005
vjk2005 / Find total file-size by type in linux
Created September 6, 2014 05:36
Example shows the use case for listing the total file size of all MP4 files in the current directory without any recursion. Use find command for recursion.
ls *.mp4 -l | awk '{total += $5} END {print total}'
@vjk2005
vjk2005 / Downloader Bookmarks
Last active August 29, 2015 14:07
Downloader Bookmarks
// iStock ▽
javascript:(function() {var a = document.createElement('a'), img_src = document.getElementById('s3img').children[0].src; a.href = img_src; a.download = img_src.split('/').pop(); document.body.appendChild(a); a.click();})();
// 500px ▽
javascript:(function() { var a = document.createElement('a'), img_src = document.getElementsByClassName('the_photo')[0].src; a.href = img_src; a.download = document.getElementsByClassName('name')[0].innerText + ' by ' + document.getElementsByClassName('author_name')[0].innerText + '.' + img_src.split('.').pop(); document.body.appendChild(a); a.click();})();
// Pinterest ▽
javascript:(function() { var a = document.createElement('a'), img_src = document.getElementsByClassName('pinImage')[0].src; a.href = img_src; a.download = document.getElementsByClassName('commentDescriptionContent')[0].innerText + '.' + img_src.split('.').pop(); document.body.appendChild(a); a.click();})();
@vjk2005
vjk2005 / bootstrap 3 snippets.html
Last active August 29, 2015 14:07
Bootstrap 3 snippets
<!-- navbar inverted and fixed to top -->
div.navbar.navbar-inverse.navbar-fixed-top[role="navigation"]>div.container>(div.navbar-header>(button.navbar-toggle.collapsed[data-toggle="collapse" data-target=".navbar-collapse"]>(span.sr-only{Toggle Navigation}+span.icon-bar*3))+a.navbar-brand[href="#"]{Project Name})+div.collapse.navbar-collapse>ul.nav.navbar-nav>(li.active>(a[href="#"]{Home})+li>a[href="#"]{link})|c
<!-- navbar type 2 -->
div.container>div.header>(ul.nav.nav-pills.pull-right>(li.active>a[href="#"]{Home})+(li>a[href="#"]{Link})+(li>a[href="#"]{Link}))+h3.text-muted{Project Name}
<!-- jumbotron with padding to clear the navbar -->
div.jumbotron[style="padding:7% 0"]>div.container>h1{hello world!}+p{this is where the description goes}|c
<!-- jumbotron with padding to clear the navbar and call-to-action button -->
@vjk2005
vjk2005 / ffmpeg commands
Created October 29, 2014 13:23
ffmpeg commands
// h264 to hevc(h265) - 20% better compression
ffmpeg -i input.mp4 -c:v libx265 -c:a copy output.mp4
@vjk2005
vjk2005 / count angular bindings.js
Created November 5, 2014 18:35
Count the number of bindings in an angular app (run this in the browser console)
var script = document.createElement('script');
script.setAttribute('src','http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.7.0/underscore-min.js');
document.head.appendChild(script);
function getScopes(root) {
var scopes = [];
function traverse(scope) {
scopes.push(scope);
if (scope.$$nextSibling)
traverse(scope.$$nextSibling);
@vjk2005
vjk2005 / ajax_page_loader.js
Created August 12, 2012 12:53
Load any number of pages via AJAX.
/*
DeepLoad:
Fetch any number of pages via AJAX for infinite scroll-like functionality.
First visit the site you want and put this into your browser console.
ToDo:
0. Determing page structure (where in the url should the page numbers need to be plugged in) from pages where the url doesn't have page structure yet (eg: homepage)
1. User can customize by passing arguments to the "get" function
2. resume a broken DeepLoad. Find if DOM has been modified by a previous DeepLoad run and start resuming from where the previous run left off
3. remove jquery dependency
@vjk2005
vjk2005 / deepload.js
Created October 1, 2012 16:27
Deep Load
/*
DeepLoad:
Fetch any number of pages via AJAX for infinite scroll-like functionality.
First visit the site you want and put this into your browser console.
ToDo:
2. resume a broken DeepLoad. Find if DOM has been modified by a previous DeepLoad run and start resuming from where the previous run left off
3. remove jquery dependency
4. convert it into a bookmarklet
5. make a youtube video tutorial and spread word about DeepLoad around
@vjk2005
vjk2005 / tweetlog.js
Created December 12, 2012 09:46
Get user's tweets from anywhere ( cross-domain )
var s = document.createElement( 'script' );
s.src = 'https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js';
document.body.appendChild( s ); // load jQuery
var
screen_name = "qtbrowneyes"
, this_many_tweets = 40;
function getTweets( screen_name, this_many_tweets ) {
$.getJSON( 'https://api.twitter.com/1/statuses/user_timeline.json?screen_name=' + screen_name + '&callback=?&count=' + this_many_tweets + '',
@vjk2005
vjk2005 / download_flickr_large.js
Created March 14, 2013 06:27
Download full-size photos from Flickr
javascript:window.location.href = document.getElementById( 'allsizes-photo' ).children[1].src
@vjk2005
vjk2005 / g-h.js
Created April 28, 2013 21:28
g.e-h.org loader
var s = document.createElement( 'script' )
s.src = 'http://code.jquery.com/jquery-1.8.0.min.js'
document.body.appendChild( s ) // load jQuery
var current=6, target = 150;
function load( url ) {
$.get( url, function( data ) {
$( '#i4' ).before( $( '#i3', data ).html() )
current++