1. Download corkscrew and compile it (./configure && make)
2. If you don't have .ssh/config, create it and set up permissions (chmod a-rw,g-rw,u+rw)
3. Add following code to .ssh/config:
ProxyCommand /home/user/corkscrew-2.0/corkscrew proxy.example.com 8080 %h %p
8080 are your proxy's host and port, and
/home/user/corkscrew-2.0/corkscrew is path to corkscrew executable. If proxy needs authentication, create a file with username and password separated by ":" and use its path as last argument to corkscrew.
% ssh -D 8081 -p 443 myhost
8081 is local port on which SOCKS-proxy to normal internet will be listening,
443 is remote ssh port and
myhost is your SSH server.
5. Use localhost:8081 as SOCKS-proxy to access the internet. If program does not support it, you can use tsocks to wrap it.