WIfi dropping problems in Lenovo Y520 legion

Looks like after 2 days of fighting i found a fix..

If someone will have similar problem with y520 Legion/Ideapad lenovo laptop under ubuntu 16.04 / 17 should try:

First what u have to do is

Find out exact what drive u need:

deepsec@deepnetwork:/tools$ sudo lspci -knn | grep Net -A3 
03:00.0 Network controller [0280]: Realtek Semiconductor Co., Ltd. 
RTL8821AE 802.11ac PCIe Wireless Network Adapter [10ec:8821] 
Subsystem: Lenovo RTL8821AE 802.11ac PCIe Wireless Network Adapter 
[17aa:a814] Kernel driver in use: rtl8821ae Kernel modules: rtl8821ae 
04:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. 
RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller [10ec:8168] (rev 10)

So for me it was

RTL8821AE

Then i installed this driver from github, by using following commands:

deepsec@deepnetwork:/tools$ cd /tmp
deepsec@deepnetwork:/tmp$ sudo apt-get install build-essential linux-headers-generic git dkms
deepsec@deepnetwork:/tmp$ git clone http://github.com/lwfinger/rtlwifi_new.git
deepsec@deepnetwork:/tmp$ cd /tmp/rtlwifi_new
deepsec@deepnetwork:/tmp$ make
deepsec@deepnetwork:/tmp$ sudo modprobe -rv rtl8821ae
deepsec@deepnetwork:/tmp$ sudo make install
deepsec@deepnetwork:/tmp$ sudo modprobe -v rtl8821ae

The above solution helped me in one error fix then i had to remove network-manager and pptp gnome, and install wicd (alternative to network-manager) by using following commands:

Installing wicd, alternative for network-manager:

deepsec@deepnetwork:/tools$ sudo apt-get install wicd 
deepsec@deepnetwork:/tools$ sudo apt-get install wicd-gtk 

Now we have to add the wicd to the top icon like network-manager (by default u will not have that option)

Ubuntu 16.04+ and above solution:

deepsec@deepnetwork:/tools$ sudo apt-get install python-appindicator

All version below 16.04 solution:

https://askubuntu.com/questions/69005/wicd-tray-icon-doesnt-show

Now make an reboot and be sure that u have icon of wicd on the top right corrnet, check if wicd also is working and u can scan for all available wifi connections

If all is fine then remove network-manager:

deepsec@deepnetwork:/tools$ sudo apt-get purge network-manager
deepsec@deepnetwork:/tools$ sudo apt-get purge network-manager-pptp-gnome
deepsec@deepnetwork:/tools$ sudo apt-get purge network-manager-pptp

I noticed that my connection didint dropped for over 48 hour so i guess its fine, there is no more errors that i posted above.