Entries from February 2009 ↓
February 23rd, 2009 — Technology
There are a has been a number of version control systems en vogue over time, CVS, SVN, Git etc.
I try to keep up with them, use them where possible, but don’t put EVERYTHING I do in version control. Since I am on a Mac running Leopard, I do have, and use Time Machine and so wanted to see if it would be pretty easy to use that to do some quick diffs between some source files.
The result is a quick and dirty python script. In the unlikely event that I ever have time, this would be a cool pyObjC project, a file browser panel, date versions picker, and a webkit view (with some better css).
The source to the script is below the fold – it will look for the first attached volume that has time machine backups for the current machine. It will not work with network based time machine backups that are on disk images. This script will run on a stock Leopard install without any extra python modules needed.
Continue reading →
February 20th, 2009 — Technology
After reading this excellent tutorial on using screen, I’ve started to use it more especially when on remote ssh connections. I wanted a way to invoke it automatically whenever I logged in, but only for remote sessions (locally I still have multiple terminal windows…) To do this paste the snippet below into your .bash_profile on the remote machine. Be sure to set up a .screenrc file as described in the above link – it makes a huge difference.
What this does is check to see if you are remote (whoami ends with (0.0.0.0) your IP)
Checks to see if there is one and only 1 screen session running – if so, resume – if more than one, list them. Otherwise create a new one. The reason I start screen with a named screen, in this case “start” is to bypass the intro screen that comes up otherwise.
AMREMOTE=`who am i | grep -c ")$"`
if [ ! -z $AMREMOTE ]; then
SCREENS=`screen -list | head -1 | awk '{ print $1 }'`
if [ $SCREENS = 'No' ]; then
screen -t start
else
SCREENCOUNT=`screen -list | tail -2 | head -1 | awk '{ print $1 }'`
if [ $SCREENCOUNT -eq 1 ]; then
screen -r
else
screen -list
fi
fi
fi
February 13th, 2009 — Technology
While my primary Twitter usage is on my iPhone – I sometimes get behind and would like to not have to catch up with 100 tweets at the end of the day. I’ve had Growl installed on my machine for a while now and figured it would be nice to just have some tweets appear in that.
I’m also always on the look out for reducing the number of apps I need to run, so I didn’t want to run twitterific just for its growl support. A quick search of scripts that would link twitter to growl turned up some working and not working examples in ruby [ 1
2
3
]
And some overly complex examples in Python which do their own twitter api calling. [
4
5
]
I wanted to add some features, and lean on one of the well done twitter modules.
So here is another take on a twitter and growl conduit – done in python. Some of the features not seen in the others:
- Will watch your input devices for when you are idle/away and store up tweets to show you when you return
- Lets you designate certain users as being “sticky” so their tweets stay on screen
- manages a cache of user profile images
- is very lightweight (only about 100 lines of readable code)
Requirements
- You need Growl of course
- You need the Growl Python language bindings that are part of the SDK
- You need the less recognized, but very well done Twitter module from Mike Verdone
Here is the script
February 10th, 2009 — Technology
I’m trying to squeeze the process of learning Django into my busy life, but keep getting distracted by little projects around making the learning easier, rather than actually messing with Django proper (That should change soon). Anyway, while the official Django docs are readable on the iPhone – I wanted something a bit better. So you can build the docs from the Django SVN source, and then if you want you can run this patch that only affects the CSS files.
cd django-trunk
patch -p0 < path-to-patch
You will also need to remove the file reset-fonts-grids.css from the static folder.
The changes were quick and hacky – but do make the pages a bit more readable (larger font) and prevent the code examples from getting chopped off on the right side. I’ve put up a current snapshot here but don’t plan on keeping them updated. For that I’m using AirSharing on the phone itself.
February 3rd, 2009 — Random Observation
Background
As a busy father there are times during the day when I can not be glued to the computer, but am free to listen to something on headphones (ie doing dishes, cleaning the garage etc). Sometimes I listen to podcasts – but sometimes I’m out of interesting ones. I’ve recently been working on learning Django and wanted to be able to lurk on the IRC channel more. Its not something that I always want to have front and center on my screen, but would be interested in listening in on as if it were a conversation. So I thought: “I wonder if I can use the built-in OS X text to speech engine and broadcast that over streaming MP3 to my iPhone”. So began a saturday project during the kid’s nap, with some tweaks over the next several evenings.
The result is several pieces that can be used separately or together:
- a basic IRC bot (basically taken from a python irc library)
- a method of taking a set of strings, converting them to spoken text and then pushing them out as streaming MP3
While I developed the latter to work in service of the former, the basic technique could be used with any number of text sources – such as tailing logs etc, there is some interesting potential.
Continue reading →
February 3rd, 2009 — Technology
I had recently done some work on one machine and wanted to install it on a second.
The work relied on a number of libraries that I had downloaded and compiled from source and at first I was thinking I would end up redoing that on the other machine.
Well this isn’t so much a tip as a realization, just use rsync.
rsync -av -e ssh /usr/local/ user@host:/usr/local/
Done! (Note this assume same architecture etc, in my case both were Intel machines running OS X 10.5)