Wednesday, July 30, 2008

My current python "IDE"

The script below is one that I'm currently using to quickly setup my python coding environment.
#!/usr/bin/python
import os
os.popen4('gnome-terminal -e python --working-directory ~/scripts/python -t PYTHON')
os.popen4('gnome-terminal --working-directory ~/scripts/python')
os.popen4('xterm -e "cd scripts/python && /bin/bash"')
os.popen4('firefox http://docs.python.org/ http://www.pygtk.org/pygtk2tutorial/index.html')

You may be asking yourself why I'm opening 3 terminals. I personally like having lots of text in front of me at once so I can focus on reading/thinking and not using the mouse (or the keyboard).

Xterm is there because it is really really fast. Gnome-terminal is there due to it's superior copy/paste support (I grew up on Windows, sue me).

Saturday, July 12, 2008

determining your visible IP address using perl and whatipmyip.com

A while back Ashish Shukla put together
a great hack for using perl an whatismyip.com to determine your IP address. My modified version of this is below:
#!/usr/bin/perl -w
#whatismyip.pl - This script uses http://www.whatismyip.com/ service.

use LWP::Simple;
use strict;

my $url = "http://www.whatismyip.com/automation/n09230945.asp";

my $content = get($url);
print "$content\n";