I'm sorry, but what's the point of this? Most of it is basic linux ssh setup, and the rest is running
ssh -D 8080
Most of the setup isn't even required. SSH forwarding works out-of-the box for the vps provider I'm using.