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]; thenSCREENS=`screen -list | head -1 | awk '{ print $1 }'`if[$SCREENS='No']; thenscreen -t start
else
SCREENCOUNT=`screen -list | tail -2 | head -1 | awk '{ print $1 }'`if[$SCREENCOUNT -eq 1]; thenscreen -r
else
screen -list
fi fifi
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 [ 123
]
And some overly complex examples in Python which do their own twitter api calling. [
45
]
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)
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.
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.
There is a cool little glue package out there called PdbTextMateSupport that allows you to highlight the current line of python code as you debug it in PDB, python’s debugger. It works by sending URLs to textmate – however the python code does not escape spaces in the path, and if you are on OS X there is a decent chance that you have a folder somewhere along the way that might have a space…
Here is the fix:
In the previous post I mentioned a python script I was using with curl to send me a SMS message. Its a pretty quick and dirty one, but here is the script I use. Since these are quick messages meant for my phone – I don’t do much with the body. And I just use this with a GET style URL, although the python cgi lib could just as easily handle a POST. So I call it like this:
I had always intended this blog to have some technical tips in the mix, but haven’t written up many, so here is one.
I manage an OS X environment at a school. We installed a new phone system that could email voicemail files as WAV files, and I wanted a way to set the default application that launches when these were double clicked from iTunes to Quicktime. Â This sort of thing is handled by launch services and can’t be manipulated by the defaults command. Â Andrew Mortensen (of the Radmind crew) to the rescue with a command line tool he wrote: duti.
This can be called a number of way, but I wanted to run it from a login script. Â It has to be run as the user whose settings you want to change, but loginscripts run as root, so one needs to call the actual binary as sudo.
I saw an article the other day that set off my peeve alarm when it discussed a plugin hybrid that got 100 MPG. Â Now most everyone knows that MPG is Miles Per Gallon. Â That means that for every gallon, you get 100 miles. Â But since this is a plugin hybrid, many of those 100 miles are coming from the battery being charged from the grid, not the gallon – so its just not fair to count those miles in a MPG rating. Â There are some ways to count kwH as gas equivalents – but no attempt was made to do this. Â Again, the key point is that in a regular hybrid, the only energy input is the gas. Â So MPG = MPG. Â But with a plugin there is another energy source, so you can’t calculate a simple MPG from Miles traveled per gallons used. Â Put another way, if I carried around a gallon of gas in an all electric vehicle – would that count as an infinite MPG car?
Just saw a couple clips of Google’s Android Phone OS. Â There are some things that are cool and improved (like the unlock pattern code). But I’m a bit baffled by this feature:
So if you are standing on a street, what exactly is the point of being able to pan around and see what is right in front of you on your phone? Â Now maybe around the corner is cool – but the compass part of that would only confuse you I think.
I’m sure this is going to circulate far and wide in the Mac blogging world, but it is worth giving it one more airing. Â I can’t imagine how long this must have taken to get all the timing right:
How can an iPhone screen be as large as a 42″ flatscreen, or a 13″ MacBook?
Picture of an iPhone, Macbook, and a 42″ LCD with approx the same scene from Lost lined up so that they “appear” the same size. Â I’ll let someone with more time figure out the pixel arc view resolution differences, but basically each screen can provide a similar viewing experience. Â The blurry iPhone screen? Â Evidence that this is not a photoshop fake as the camera is focused on the distant screen (some 4 meters away).