If your local keyboard is working, you can try the "magic keys"
gksu gedit /etc/sysctl.conf
# Command line
sudo -e /etc/sysctl.conf
Add in the line (at the bottom)
kernel.sysrq = 1
"To perform a safe reboot of a Linux computer, use RSEIUB magic SysRq Magic combination key:
Hold Alt+PrtSc then type R+S+E+I+U+B , you need to press each key for 2-3 seconds."
If you are not getting a response from the local keyboard or mouse, your only other option would be to try to ssh from another box.
You will need to install openssh-server first
sudo apt-get install openssh-server
You would then ssh in and shut it down. If you can ssh in, it helps to check the logs as well (before you shut down).
sudo shutdown -h now