Notes

Install Perl module in your home directory

To install a Perl module in your home directory is helpful for a couple of reasons. 1) It doesn’t require root permission. 2) It’s installed separately from the site-wide installed modules, hence can coexist with those modules and useful when trying a module that has different version with what’s already installed.


$ perl -MCPAN -e shell PREFIX=~/lib/perl LIB=~/lib/perl
cpan> install
cpan> quit

Assuming that you want it installed on the directory lib/perl on your home directory. Also, don’t forget to set PERL5LIB:

export PERL5LIB=~/lib/perl:$PERL5LIB

Rollback a file in a subversion repository

To rollback a file in the working directory to a previous version in the repository:
svn -r <revnum> update <filename>

Where is the revision number you want to rollback into; is the file you want to rollback.

Finding python’s site-packages directory

Python modules or packages that you install yourself are installed in a directory called site-packages. The location of this directory is subdivided into the specific python version you are running and is also different for each platform for obvious reasons. To determine your system’s site-packages directory, run this from the command line:

python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"

Enabling AirDrop on older systems

You can enable AirDrop for many older Lion systems at the Terminal command line. Enter:

defaults write com.apple.NetworkBrowser BrowseAllInterfaces 1

After setting the defaults, you’ll need to restart Finder:

killall Finder

Ejecting a stuck CD or DVD on a Mac

If you have a stuck CD or DVD on your Mac, and the desktop icon for the media has disappeared from the desktop so that you can no longer drag it to the trash, you can manually eject the media without rebooting the machine by executing the following command from the Terminal:

drutil tray eject