Calvin and Hobbes – Keep it Simple Silly

Calvin and Hobbes – Keep it Simple Silly

Calvin & Hobbes is a comic series created by Bill Watterson. Calvin is a 6 year old child, who imagine about a Tiger named Hobbes is real and his best friend. He is remarkably funny at moments.

While Justifying his pleasure cum secret of low grades

c5While making an innocent mockery of education system.

c3

Sometimes too innocent,
c2
Or sometimes at top of his wits!
c6
Being smart is just usual for him.
c1
Defining procrastination in most humble way
c7
Well, He make valid points most times..
c8
Long live Bill Watterson, the creator!
c9

Success – Definition from the successful persons

Success – Definition from the successful persons

Success is often overrated. A collection of quotes from successful persons of our generation, defining success.

willsmith

You might have more talent than me, you might be smarter than me, you might be sexier than me, you might be all of those things you got it on me in nine categories. But if we get on the treadmill together, there’s two things: You’re getting off first, or I’m going to die. It’s really that simple, right?

– Will Smith

—————————————————————————————-

steve

“The moment you realize that everything in the world around you was built by people who were no smarter than you, you become an element of change yourself…you can change anything”

– Steve Jobs

—————————————————————————————-

messi

“I start early, and I stay late, day after day, year after year, it took me 17 years and 114 days to become an overnight success.”

-Lionel Messi

—————————————————————————————-

jkrowling
“You might never fail on the scale I did, but some failure in life is inevitable. It is impossible to live without failing at something, unless you live so cautiously that you might as well not have lived at all – in which case, you fail by default.”

– J.K Rowling

—————————————————————————————-

FelixBaumgartner

The only thing standing between you and your goal is the bullshit story you keep telling yourself as to why you can’t achieve it.

Felix Baumgartner(First person to break sound barrier)

How do you define success!

Using Javascript for mass invitation for a Facebook page

Using Javascript for mass invitation for a Facebook page

funnyjavascript

Recently, For a friend’s Facebook page, We need to send invitations to all of his friends. So instead of clicking Invite button for every single person, I preferred to write a small javascript for this.

Script:

var a = Array.prototype.slice.call(document.getElementsByClassName("_5tef"))[0];if(a)a.click();setTimeout(function(){Array.prototype.slice.call(document.querySelectorAll("ul._5kwh li")).forEach(function(c){var d = $(c); var e = d.getElementsByTagName("button")[0]; if(e) e.click();})}, 1000);

 

How to use it

Open Facebook page for which you need to send invites, Make sure there is a peoples section on that page though which invites can be sent.

open console. via right click –> Inspect element –> Console. and pasting above script followed by enter.

How it works

It works as a daemon which will first click on show more friends button and then click invite against all friends listed in that list, one by one.

Key elements to write such scripts or modify this script

You need to know specific components of this script and their usage to modify it

1. document.getElementsByClassName – To select all elements with given class name, which in this case is 5tef (Use inspect element to get this).

2. document.querySelectorAll – To select all friends with specified selector, child <li> with parent class as _5kwh in our case.

3. getElementsByTagName – To get all child buttons which we target to click on.

 

Future of Search – a naive analysis

Search, by far most elementary part of internet which helped shaping company like Google to be Internet giant. As per stats, Google owns roughly 86% of entire search done globally.search-engine-market-shares-global.1

 

Even with a market share as huge as 86%, Google must be worried about future of search. It can be taken from their ad-campaign which was aired in late last year.

[embedplusvideo height=”500″ width=”768″ editlink=”http://bit.ly/1qapfx8″ standard=”http://www.youtube.com/v/gHGDN9-oFJE?fs=1″ vars=”ytid=gHGDN9-oFJE&width=768&height=500&start=&stop=&rs=w&hd=0&autoplay=0&react=1&chapters=&notes=” id=”ep7595″ /]

Behind  a very sensitive track, Google embedded their plans very beautifully. Mobile. Yes, Search has now moved from desktops and laptops to Mobile and expected to bypass desktop users by huge margin in coming years.

Future

MobilevsDesktop

 

Looking at future predictions, Mobile is future. But Google pioneers mobile search too, isn’t it? Yes, but it is an interesting study in itself.

But what worries Google?

When asked “What will you do if you want to find a restaurant nearby?”, 3 out of 5 users preferred Zomato instead of google search.Similarly, If you need to find price of latest i-Phone, you will preferably go to E-Commerce sites like Flipkart, Amazon or Paytm instead of Googling it. You will still be preferring MakeMyTrip for your travel related search even if Google provide flight search option from their search box itself.

This trend is not only for search, it can be extrapolated to all domains including e-commerce. Sachin Bansal (flipkart) and Vijay Shekhar Sharma (Paytm) cleared this in their strategies in past few weeks.

Google is looking to acquire the user base that is shifting to apps like Flipkart, MakeMyTrip and Zomato for specific results. google-mobile-search-450x277

Having said that, Google has seen 400% rise in mobile searches and is targeting retention of these users.

Future of search will be personalised results (apart from what is mentioned in search keyword) which may include social network, past search history and individual’s preferences.

Coin Flipping brainstorming

Coin Flipping brainstorming

 

 

coinHere is a brainstorming session on coin flipping. It involves a game of pattern choosing. You have to choose a pattern which have better probability to occur.

    • Flip a fair coin twice. What is the probability that you get two heads (HH)? What is the probability that you get heads followed by tails (HT)? Are these probabilities the same?

Yes, sure they are. No confusion yet.

    • Flip a fair coin repeatedly until you get two heads in a row (HH). On average, how many flips should this take? What if we flip until we get heads followed by tails (HT)? Are the answers the same?

Based on the previous problem, most folks assume that the answer is Yes, but the answer is No.

    • Let’s play a game: we flip a coin repeatedly until either HH emerges (I win) or HT emerges (you win). Is the game fair?

Based on the previous problem, most folks assume that the answer is No, but the answer is Yes.

    • We play the let’s-flip-a-coin-until-a-pattern-emerges game. You pick HHT as your pattern, I pick THH. We flip a fair coin repeatedly until we get heads-heads-tails in a row (you win) or tails-heads-heads in a row (I win). Is the game fair?

Based on symmetry, most folks assume that the answer is Yes, but the answer is No. I’m winning 75% of the games

  • Seeing as THH is a better pattern, you request to pick it as your pattern. I graciously agree, and switch to TTH. I keep beating you most of the time. You switch to my TTH. I switch to HTT. I keep beating you. You switch to HTT. I switch to… HHT, your original losing pattern. Who’s winning now?

Most folks are by now expecting trouble, and guess correctly even though they feel it’s impossible. Indeed, HHT is better than HTT, which is better than TTH, which is better than THH, which is better than HHT.

This delightful result is known as Penney’s game

Project Naptha – Images text simplified

Project Naptha – Images text simplified

Screenshot 2014-08-06 23.37.22

Have you ever experienced need to copy some text but found that it’s actually an image and you cant copy text from it? If yes, world isn’t same anymore. Introducing Project Naptha, According to its author,

Project Naptha automatically applies state-of-the-art computer vision algorithms on every image you see while browsing the web. The result is a seamless and intuitive experience, where you can highlight as well as copy and paste and even edit and translate the text formerly trapped within an image.

Simply put, Project Naptha is a college project build by Kevin Kwok which offers a chrome extension to allow users highlight, copy-paste, edit and translate on the go.

How it works:

It runs a text detection algorithm, Stroke Width transform along with Optical Character recognition. This project also uses algorithms like connected components analysis (identifying distinct letters), Otsu thresholding (determining word spacing), disjoint set forests (identifying lines of text). 

Over and above applying these algorithms, this project also watches cursor movements all the time to get the words you might be looking for.

Next time, when you go to web and find any image, be it informative or just an internet meme, with naptha in your armour, you know you can copy its text on the go.

Whatsapp Command line tool – Linux developer version

Whatsapp Command line tool – Linux developer version

wa

Whatsapp, a popular cross-platform mobile messaging app can now be used via simple command line tool too. Whatsapp linux chat client, WA, can be coded in a few minutes from scratch if you have adb installed and ready.

Prerequisites:

adb must be installed and set to environment path. To those who arent familiar with adb, It is a command line interface to interact with android phones and is shipped with developer toolkit.
Once downloaded, it can be added to path variable by updating bash_profile file with below line (located at ~/.bash_profile).

export PATH="$PATH:/Users/hitesh/Documents/personal/adt-bundle-mac-x86_64-20140321/sdk/platform-tools"

Command line tool:

Once your system is ready to interact with android device, we can proceed to make whatsapp command line interface. It will be 11 commands tutorial which I will cover step by step

1. To unlock your phone

adb shell input keyevent 82

If your phone is locked, this command will unlock it for you. For those who are using screen-locks, it can also be automated but it is beyond scope of this tutorial.

2. Restart whatsapp

adb shell am force-stop com.whatsapp

This is done just to avoid running into previously opened whatsapp chat client. We will restart this activity in very next step to avoid any issue.

adb shell am start -n com.whatsapp/.Main

3. Ask for name to which you need to send message

echo -n "Enter Name:"
read name

4. Feed the input name to whatsapp

adb shell input text $name

5. Tap to open chat activity*

adb shell input tap 270 350

6. Ask for message which is to be sent

echo -n "Enter Message:"
read message

Feed the message to whatsapp

adb shell input text $message

It is all set now.

7. Send the message by tapping send button*

adb shell input tap 990 1650

and message is sent.

 

This entire experience can be automated by saving below commands in a file

adb shell input keyevent 82
adb shell am force-stop com.whatsapp
adb shell am start -n com.whatsapp/.Main
echo -n "Enter Name:"
read name
adb shell input text $name
adb shell input tap 270 350
echo -n "Enter Message:"
read message
adb shell input text $message

save this file as wa.sh

It can now be triggered via below command

sh wa

to make it more user friendly,

add this path (can be checked via command pwd) to PATH variable as done for adb command earlier

Now your client is ready to send all messages just by typing wa anywhere

 

Bonus:

If you want to lock out your phone as soon as this is done, Use below command

adb shell input keyevent 26

Or you can remove step 1 too to enter full stealth mode.

 

Disclaimer:

1.This post was written for nexus 5 device and was tried via MacBook. You may need to change parameters in step 5 and 7 if your device is not nexus or prerequisites to set environment variable if you are on a different linux version.

  1. Use Pushbullet to receive messages if you can want that too on your mobile.