Not sure if this is overkill for s single piece of code but I use the plugin WP-Syntax to post code in WP but that would be for code in posts and looks like you're putting it into a sidebar.
In that case try
HTML Code:
<pre class="mycode"> YOUR CODE </pre>
i.e. in a text widget
and add a HTML/CSS Inserts -> CSS Insert
HTML Code:
pre.mycode {
width: 200px;
height: 150px;
overflow: scroll;
}