Monday, 26 March 2018

UNIX Commands

mkdir folderName
cd folderName
To go back
cd ..
vi filename.txt
Esc :wq
clear
whoami
cat filename.txt   #output the contents of file

Find out nth Maximum Salary

Logic
  1. Get salary in decreasing order and give limit n. So, the last salary is required 
  2. Now arrange this is increasing order (ascending order)
  3. Take the first record by using Limit 1, to get the answer
mysql> select * from emp;
+--------+
| salary |
+--------+
|  20000 |
|  50000 |
|  35000 |
|  60000 |
+--------+
Ques - Find 3rd max salary

mysql> select salary from emp order by salary desc limit 3;
+--------+
| salary |
+--------+
|  60000 |
|  50000 |
|  35000 |
+--------+
3 rows in set (0.00 sec)

mysql>  select salary from (select salary from emp order by salary desc limit 3) a order by salary
    -> ;
+--------+
| salary |
+--------+
|  35000 |
|  50000 |
|  60000 |
+--------+
3 rows in set (0.00 sec)

mysql> select salary from (select salary from emp order by salary desc limit 3) a order by salary limit 1;
+--------+
| salary |
+--------+
|  35000 |
+--------+
1 row in set (0.00 sec)
--------------------------------------------------------------------------------------------------------------------------
Ques -  find 2nd min salary = 35000


mysql> select * from emp order by salary limit 2;
asc - first min sal , second min sal
+--------+
| salary |
+--------+
|  20000 |
|  35000 |
+--------+
2 rows in set (0.00 sec)

mysql> select salary from (select salary from emp order by salary limit 2)a order by salary desc ;
+--------+
| salary |
+--------+
|  35000 |
|  20000 |
+--------+
2 rows in set (0.00 sec)

mysql> select salary from (select salary from emp order by salary limit 2)a order by salary desc limit 1 ;
+--------+
| salary |
+--------+
|  35000 |
+--------+
1 row in set (0.00 sec)

Monday, 12 March 2018

Tinder swipe right script

Open Console and run this script

a = setInterval(function(){
    var o = document.getElementsByClassName("recsGamepad__button--like");
    o[0].click();
}, 2000)

Friday, 23 February 2018

Google chrome shortcuts

Ctrl + click - Open link in new tab

Shift + click - Open link in new window

Sunday, 14 May 2017

Tips

Productivity Tips

Feeling distracted? Silence your phone for one hour to GET THINGS DONE.

Learning = self-improvement.

Monday, 27 February 2017

Youtube shortcuts

YouTube Player Seekbar Keyboard Shortcuts

Keyboard shortcut

Action (the seekbar should be selected)
Left / Right arrowJump back / ahead 5 seconds in the current video
Home / EndSeek to the beginning / last seconds of the video
SpacebarPlay / Pause
Numbers 1 to 9Seek to the 10% to 90% of the video
Number 0Seek to the beginning of the video

Shift+N is next video in playlist 
Shift+P is the previous video
F key  to switch to full-screen view