Am I connected remotely?

I now share my dotfiles between the various OS X machines I use daily, using Dropbox and symlinks.

However, I have many aliases and functions that need to act differently if I only have a console session at the machine in question, or a full GUI session.

With bash, this is easy to test:

1 export EDITOR='nano'
2 if [[ -z "$SSH_CONNECTION" && $OSTYPE =~ ^darwin ]]; then
3 export EDITOR='mate --wait'
4 export TEXEDIT='mate -w -l %d "%s"'
5 export LESSEDIT='mate -l %lm %f'
6 fi

Now, if I am remotely connected to a machine, then I will get nano as my editor, but if I am sitting directly in front of it, then it will open Textmate.

django-bshell

bpython is pretty cool. It gives you an improved python shell, with popups of completeable values. About the only drawback is that some command-line editing doesn’t work that well, but I can live with that.

I made a django app that provides a new management command: bshell. This will start a new shell, using bpython, and import all of your models.

You can get it with:

pip install django-bshell

And then install it into your django settings.INSTALLED apps. The app itself is called ‘bshell’. Then you can just use:

django-admin.py bshell

The code can be found on bitbucket.

Issues with PyPI/other python.org sites

I was having some issues connecting to (although not pinging) python.org and some of the python-subdomains: notably the CheeseShop (http://pypi.python.org).

I disabled IPv6, and they all cleared up.

I don’t know if this was an issue with Internode’s IPv6 stuff, but it was being handled by my Airport Extreme. My iPhone was working fine, because it doesn’t use IPv6.

What a relief.

I had tried everything I could think of: from changing my DNS server, DHCP server, I even tried a reinstall of my OS (although this wasn’t why I did that - I wanted a cleanup of my dev machine).