It's hard to do for a number of reasons.
You can, as had been discussed, roll it into a shiny app, and that may work for you, at least short term.
However, in my experience, keeping your code to yourself like that is not a long term solution to what you perceive as a problem.
First, your concerns about needing to protect your code are likely overblown. That's not to say they're completely unfounded, rather it's not as likely as you fear that your code would be shared.
Second, depending on what your code does, (you said it automates some tasks done at a company), I believe very few organizations would put this code into a production environment without having the ability to audit the code.
Third, hiding your code away isn't the correct, best, or most secure way to protect it. Contracts1 are. If you're really concerned about your code getting out, the best thing you can do is get yourself an attorney and pound out some standard contracts.
The shiny app idea is a great way to showcase your work before you have established a business relationship, and it can certainly work as a tool for delivering a service if that's your interest. But, as a long-term solution to protecting your intellectual property, I think there are better, more profession approaches you could take.
1. I am not an attorney, and more importantly, I am not your attorney. If you have legal questions get an attorney and talk to them.