Redactor: Set a min height and preserve line breaks
The redactor configs are stored inside the config/redactor directory.
Make sure you're editing the right config that your field uses (eg Standard) and add:
  &quot;minHeight&quot;:&quot;500px&quot;,

... to that file. The configs use JSON so when you see a Redactor configuration, that's how Craft is going to initialize it.
To answer your other question, Redactor is not really designed as a code editor—it's really for end users editing text in a WYSIWYG fashion.
I was able to get Redactor to keep line breaks in tact and keep comments using something like:
  &quot;cleanOnEnter&quot;: false,
  &quot;removeComments&quot;: false

You might also want to turn off HTML purifier (or modify its own config).
FWIW it's probably much easier to use a dedicated field type for editing code, such as the CodeMirror plugin.