A California police officer has posted threatening messages on social media to people protesting against police brutality and discrimination in the US.