The solution is easy if it is YOUR dog do what is necessary to prevent the behaviour, tons of good advice have alreay been offered.
If it's NOT your dog, move out or have your roommate and his dog move out, if this is the same roommate you were having issues with regarding your snake it won't be a loss anyway, if it is a different roommate than you need to start choosing your roommates a little more wisely or live on your own.