Brain-inspired computing with resistive non-volatile memories