Australian shares have defied a heavy sell-off to clock a third straight week of gains, thanks in part to rebounding technology and mining stocks.