The solution is to keep your scripts private, automate your job, and work on whatever you want while making sure you always look busy when your boss walks by.
More importantly, what will you tell your grandkids, presuming you have any? "I was doing an unnecessary job instead of not wasting resources and doing anything productive"?