Lectures on curved beta-gamma systems, pure spinors, and anomalies