Misc Unix Commands

SSH Tunnels:

ssh -N -L 2003:localhost:2003 &

SSH Without Password:

ssh-keygen -t rsa
cat .ssh/id_rsa.pub | ssh <user>@<host> 'cat >> .ssh/authorized_keys'

Django superuser:

sudo python /opt/graphite/webapp/graphite/manage.py createsuperuser

Vi: Comment Out Multiple Lines:

First, move the cursor to the first char of the first line in block code you want to comment, then type:


then vim will go in to VISUAL BLOCK mode. Use j to move the cursor down until you reach the last line of your code block. Then type:

Shift + I 

now vim go to INSERT mode and the cursor is at the first char of the firts line. Finally, type # then ESC and the code block is now commented.

To decomment, do the same things but instead of type Shift + I, you just type x to remove all # after highlight them in VISUAL BLOCK mode.

Python Variable Issue fix:

#print (id(repr(issue.fields.status.name)))
#print (id(‘To Do’))
print (str.encode(repr(issue.fields.status.name)))
print (str.encode(‘To Do’))

Change default location on osx for screenshots:

defaults write com.apple.screencapture location /Users/<user>/Desktop/ss/