Git aware bash prompt

Browsing for something on the google earlier today, I ran across a way to set up a git branch aware bash prompt. It’s pretty slick if you are always in and out of git branches (if you’re not you should be)

First download git-completion.bash
http://repo.or.cz/w/git.git?a=blob_plain;f=contrib/completion/git-completion.bash;hb=HEAD

I saved it as ~/.git-completion.bash.

Next edit your ~/.bash_profile

Add

source ~/.git-completion.bash
PS1='\h:\W$(__git_ps1 "(%s)") \u\$ '

Finally source ~/.bash_profile to make zee changes active.

What results is this when you are in a git repository:

bigtex:jason(jquery_localize) jason$ git checkout master
Switched to branch "master"
bigtex:jason(master) jason$ git checkout jquery_localize
Switched to branch "jquery_localize"
bigtex:jason(jquery_localize) jason$

git 1.5.5.1 on OS X Leopard

There have been a few git updates since I last made a package. Here’s the latest 1 day after it’s release. Note: It will clean up the previous install for you.

Remeber to add this line to ~/.bash_profile if you haven’t already:

export PERL5LIB=/usr/local/lib/perl5/site_perl/

You can download git 1.5.5.1 here: http://code.twi.gs/git-1.5.5.1.pkg

Installing PIL 1.1.6 on OS X Leopard (10.5)

What a headache. After a couple of hours of googleing, it looks like this is the way you should install PIL on OS X:

Download libjpeg: ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz
At the time of this writing the libjpeg homepage is down.

Next compile it:

tar zxvf jpegsrc.v6b.tar.gz
cd jpeg-6b
cp /usr/share/libtool/config.sub .
cp /usr/share/libtool/config.guess .
./configure --enable-shared --enable-static
make
sudo make install
sudo ranlib /usr/local/lib/libjpeg.a

Edit: If sudo make install fails, mkdir the directories that make is trying to install the files into. There are a couple of man directories and a bin directory.

Now download PIL: http://effbot.org/downloads/Imaging-1.1.6.tar.gz

and compile it

tar xvzf Imaging-1.1.6.tar.gz
cd Imaging-1.1.6
sudo python setup.py install

Whew… what a mess.

git 1.5.4.1 on os x

I didn’t really want to compile git on the Air so I used the MBP to create a package for it. This will install git in /usr/local (so it’s relatively easy to uninstall manually… sudo rm /usr/local/bin/git* … etc). This package is for Leopard. I don’t know if (and doubt) it’ll work on anything else.

The only drawback to me making this package is you need to edit (or create) ~/.bash_profile and add this line:
export PERL5LIB=/usr/local/lib/perl5/site_perl/

You can download git 1.5.4.1 here: http://code.twi.gs/git-1.5.4.1.pkg

Cheatsheet for Postgres


MySQL            Postgres   Description
show databases;  \l         Lists all databases
show tables;     \d         Lists tables of a database
use db;          \c db      Connects to a database for use
desc table;      \d table   Displays table definition
n/a              \z object  View user/host/db permissions

« Previous entries Next Page » Next Page »