Wlan
Turn off power management
To turn off the wifi adapter's power management run
iwconfig wlan0 power off
Manage wifi with wpa_supplicant and dhcpcd
Create the following basic wpa_supplicant config:
# /etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=/run/wpa_supplicant
ctrl_interface_group=wheel
eapol_version=1
ap_scan=1
fast_reauth=1
update_config=1
# Add your networks here.
Then add networks using wpa_passphrase:
wpa_passphrase <SSID> >> /etc/wpa_supplicant/wpa_supplicant.conf
Note that the passphrase can be either supplied as a second argument or read from stdin It will be added to the config in cleartext as a comment, you may want to remove that line.
Finally, install wpa_supplicant and dhcpcd as services, and possibly adjust the wireless interface name in the wpa_supplicant service config.