Skip to content

Instantly share code, notes, and snippets.

Rahul Bansal rahul286

View GitHub Profile
View merge_repos.sh
#!/bin/bash
# This script takes a remote repository and merges it into
# the current one as a subdirectory
set -e
if [ -z "$1" ]
then
echo "Usage:"
@rahul286
rahul286 / README.md
Last active Jul 11, 2018 — forked from milo2012/genPunycodeDomain.py
genPunycodeDomain.py
View README.md

Install deps using

pip install ipwhois

You may need to prefix above command with sudo if you are using python version that ships with system. Or change ownership (not recommended) by running sudo chown -R $USER /Library/Python/2.7

Download script and execute it

@rahul286
rahul286 / fb_friend_count.js
Last active Jun 22, 2018
Count Facebook Friend Requests You Receive Everyday
View fb_friend_count.js
// goto https://www.facebook.com/rahulb286/allactivity?privacy_source=activity_log&log_filter=receivedfriendrequests
// open js console
// insert jquery by copy-pasting http://code.jquery.com/jquery-latest.min.js
jQuery('#pagelet_all_activity_2018_6 ._5ep8').each(function (index) {
console.log( jQuery( this ).text() + " : " + jQuery(this).next('.uiList').find('a.profileLink').filter(':odd').length)
});
View linkedin-unfollow.js
# goto https://www.linkedin.com/feed/following/
# in JS console run
var buttons = $("button"),
interval = setInterval(function(){
var btn = $('.is-following');
console.log("Clicking:", btn);
btn.click();
if (buttons.length === 0) {
clearInterval(interval);
View docker-examples.md

Commit, clone a container

To 'clone' a container, you'll have to make an image of that container first, you can do so by "committing" the container. Docker will (by default) pause all processes running in the container during commit to preserve data-consistency.

For example;

docker commit --message="Snapshot of my container" my_container my_container_snapshot:yymmdd
@rahul286
rahul286 / apt-upgrade.sh
Created Jul 22, 2017
apt upgrade keeping old config file as it is
View apt-upgrade.sh
apt -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade
@rahul286
rahul286 / rbenv-mac.md
Last active Jul 21, 2017
rbenv on mac/ubuntu homebrew method gem bundler path fix
View rbenv-mac.md
brew install rbenv ruby-build rbenv-bundler

Run

rbenv --init
@rahul286
rahul286 / non-veg.md
Last active Jun 7, 2017
Pure non-vegetarian menu on Zomato and Swiggy🍗 😋
View non-veg.md

Open JavaScript console and run following codes on respective sites. 🍗 😋

It hides all vegeterian dishes from the menu!


Zomato - https://www.zomato.com/

$('.veg').parent().parent().parent().parent().parent().hide()
@rahul286
rahul286 / wp-cli-sed.md
Last active Mar 21, 2017
sed extract numbers from filename
View wp-cli-sed.md

Sample file names from wp-cli export example.wordpress.2017-03-03.988.xml

ls -1 | sed 's/example.wordpress.[0-9]*-[0-9]*-[0-9]*.\([0-9]*\).xml$/\1/' 

Extracts 998

@rahul286
rahul286 / 0_reuse_code.js
Created Dec 28, 2016
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
You can’t perform that action at this time.