Restart OSX networking from the command line

I always forget this, so here it is:

Shutdown network interface:
sudo ifconfig en0 down

Start network interface: sudo ifconfig en0 up