Thursday, August 23, 2012

Trace your python programs

Bash programming has a very helpful command of:

bash -x myscript.sh

This will show you what bash is doing while running through myscript.sh. Python has the same functionality, through this command:

python -m trace --trace myscript.py 

Very useful in debugging python programs.  Additional info:

http://docs.python.org/library/trace.html


Friday, August 3, 2012

Create ssh public key from private key

If you have a private key and want to create the public key from that (to put in ~/.ssh/authorized_keys, for example), do the following:

ssh-keygen -f <my_private_key> -y > <my_public_key>

For example:

ssh-keygen -f ~/.ssh/id_rsa -y > ~/.ssh/id_rsa.pub


If you are using this to ssh with keys, add my_public_key (eg. ~/.ssh/id_rsa.pub) to ~/.ssh/authorized_keys on the remote server.

Then ssh with the private key to the remote server to test.