Documentation and sample for server-to-server scenario for domain account

It took me whole day to figure out how to use google-api for 2 edge cases:
server-to-server scenario
domain account
There are little pieces of documentation for each of them, and just no documentation when you want to use both of them.
This is most common use case for entreprise users, so I've decided to create some doc and example.