Which preposition is generally used?

• I hope you weren’t shocked by / at what I said.
• I was shocked by / at what I saw. I’d never seen anything like it before.


Solution 1:

Both are common. A good resource for this sort of information is the Google Ngram Viewer: here it shows shocked by overtaking shocked at in frequency (within published books scanned into the Google Books database) around 1927, though without ever driving it out of currency.

Difference in meaning seems slight and hard to nail down. One hypothesis might be that by suggests that the stimulus is objectively shocking, while at puts the emphasis more on the subjective response: the same stimulus might seem shocking to some but not to others.