Hi Giuseppe, and welcome!
The structure you're referring to is called "inversion."
Your examples fall into a singular category (that of negative/restrictive expression) which includes other expressions, such as
barely, scarcely, hardly, seldom, little, never, under no circumstances, at no time, etc (there are many more!)
Besides in direct questions, inversion is also used:
- In short tags. "I like it!" "So do I"
- In formal/emphatic conditional sentences: "Should you need further information, please call ..."
- When expressing wishes starting with may: "May you find what you're searching for."
- Sometimes in indirect questions, especially when the subject is too long (cannot think of an example right now, sorry!)
- Sometimes (quite literary) after as, so, than: "She was very pretty, as were her sisters."
There can be other circumstances in which inversion occurs; these are the ones that came to my mind.
As for your examples, I think the first one needs a past simple because you've got a time reference (
Only yesterday did I realise...). I also would put an object (
it) after repeat.
I'm not a native either, so you'd probably better wait for one of them.