Posts tagged as "*nix":

Using Gist to Keep Task Synced

The folks at GitHub recently launched Gist which may well be the best code sharing/pasting tool ever. It has nice syntax highlighting and a plain user interface plus you can share more than one file in the same paste or gist. In addition to this you have the ability to create a ‘private’ gist. The quotes are because they are private only by obscurity not by any authentication logic. A SHA1 (I think) key is created and they use that as the url to you new, small git repository but they don’t show up in the view of all gists and a SHA1 is pretty unlikely to have it’s value guessed correctly.

Gist by itself is great news and a useful tool but the thing I find really appealing is that I can use it to keep simple text files in sync across multiple computers. This is incredibly useful to me because I typically track my work hours in a simple text file because our timesheet application is pretty horrendous to use and I want to deal with it as few times a week as possible. So I created a new private gist and added this time tracking text file and now I don’t have to worry about having my hours at work but not at home or vice versa because I can just pull from the private gist. Not only that but now my time tracking sheet is versioned so I don’t have worry about losing notes I make about how I spent my time in the unlikely event someone asks I can find it.

This was a grand breakthrough for me and I was quite pleased. Lately though I got to looking at some task tracking software and found some great ones but I am reluctant to pay for software I know I’m likely to stop using after a little while. Of the free options I didn’t find any which would allow me to easily sync my todo list from my home computer to my work computer. About this time I remembered a shell script I had used about a year ago which tracked all the information in simple text files. After a little looking I found Todo.txt – Task tracking for command line lovers. I dug around for the script on my computer and tried to update it but whenever I listed out my tasks I had this -e being printed in front of the first one. I’m fairly certain it was a misplaced sed argument but with all the regular expressions in the shell script I didn’t want to break things worse. I tried to search for the problem and came up empty on the mailing list but did find a link to a todo manager called Task which even provided an installer for Leopard!

Once I installed the package it was a simple matter of updating the configuration to write files to the directory where my time tracking gist was already located and TADA! easy syncing of time and tasks across multiple computers using the magic of the command line.

August 13, 2008

Displaying Git Branch in the Command Line

I was hunting around looking for information about port from svn to git and getting git-svn to compile on OS X a little while back when I ran across Maddox’s explanation of branch name in command line. At the time I thought ‘Awesome!’ but I was on a mission so into del.icio.us it went to await later discover.

A couple of days ago I found the post again in my bookmarks and proceeded to spruce up my command line with the knowledge in Maddox’s post and in MacTip’s Customize Prompt on OS X article. The long and short of it is that the colors in my command prompt bother me so I cut them out of Maddox’s function and ended up with the following to lead off my ~/.bash_login.

Prompt Setup

function parse_git_branch { git branch --no-color 2> /dev/null | sed -e '/^[^]/d' -e 's/ (.*)/[\1]/' }

function gitPrompt { PS1="\h:\W\$(parse_git_branch) \u\$ " PS2='> ' PS4='+ ' } gitPrompt

I have to say I’m quite please with the new addition to my command line!

August 13, 2008

How-To: Run Firefox2 and Firefox3 Simultaneously on a Mac

I’ve found a number of step by steps to set this up on a Windows machine, the most in-depth being on Lifehacker. However, I haven’t found a quick one to set up multiple profiles on the Mac.

My reason for wanting to do this was pretty simple; I wanted to be able to play with Firefox3 while still using Firefox2 and the magic of Firebug for debugging and web development. As I knew from the many PC articles I just needed to set up a profile for each browser. Since I already had Firefox2 in my Applications folder (Firefox.app) I opened up terminal and ran /Applications/Firefox.app/Contents/MacOS/firefox -ProfileManager which brings up a screen allowing you to manage existing profiles and create new ones it should look something like this… Firefox Profile ManagerAs you can see I’ve already added the profile, yours will probably only have one profile called default and will have the “Don’t ask at startup” checked. The first thing I did was rename the default profile to Firefox2 (since that is what I already had installed and had been using). Then I created a new profile called Firefox3 and unchecked “Don’t ask at startup”. Easy as pie. After that I renamed Firefox.app in my Applications folder to Firefox2.app, downloaded the Firefox3 beta, copied it to Applications and renamed it to Firefox3.app.

The drawback is that whenever I launch either application it asks me which profile to use and I have to select the profile I want. I probably could edit the actual shell script at /Applications/Firefox2.app/Contents/MacOS/firefox and /Applications/Firefox3.app/Contents/MacOS/firefox respectively and hardcode the -P option in order to avoid this minor hassle but at this point it doesn’t seem worth it.

Update: after realizing I knew how I would do it if I wanted to setup default profiles it really started to bother me that I had to select a profile every time so I tried the method outlined above and it doesn’t work. Well it does if you start Firefox by running the script at /Applications/Firefox3.app/Contents/MacOS/firefox but that’s not what I foresee most people doing.

May 9, 2008