H-Mem: Harnessing synaptic plasticity with Hebbian Memory Networks