Refactor identities generation

The generate_identities script now accepts a filename as a command
argument and outputs a JSON object per line.