Programmatically opt-in

The opt-in page mentions that Advanced users can use a series of on-chain transactions which can be prepared manually and issued on the NEM NIS1 blockchain programmatically.
Are there any examples published?