Uniqueness of twisted linear periods and twisted Shalika periods