Thursday, October 14, 2010

Startup GNU Screen with multiple regions (split screen)

Since I've been doing a lot of work remotely lately I've been brushing up my GNU Screen skillz.

One thing I'd like is to be able to reattach a screen with a number of regions (AKA split screens) setup automatically. Screen is supposed to get this in the next release, but it's been a while.

In the meantime, the following kludge seems to work well enough: (sleep 0.1; screen -X split) & screen -r. Basically, this says: "reattach to my screen and at the same time in the background wait a fraction of a second and then send the split command to screen from a separate thread".

This was a common enough pattern that I wrote it into a little shell script:


if [ -z $splits ] ; then

if [ -z $sleep ] ; then

sleep $sleep
while [ $i -lt $splits ] ; do
  screen -X split
  screen -X focus bottom
  screen -X select `expr $i + 1`
  i=`expr $i + 1`
which is used: splitscreen 4 & screen -r.

There's plenty of room for improvement. A more principled replacement for the call to sleep would be to monitor the socket files. In my Mac OS 10.5 these are under /tmp/uscreens/.... (I believe the standard location is /usr/tmp/screens/...) This is purely empirical, but it appears the user permission on the socket file changes from -x to +x (i.e. becomes executable) when the screen is attached. So instead of sleep we should be able to do a wait until that permission change occurs.

In principle I think this could even be used to save and restore region settings. For example, rebind the split key to not only split but also save a flag to filesystem indicating how many regions, then read this flag when reattaching. Or we could just wait for the next release...

Thursday, October 7, 2010

Bluegiga WT12 Breakout Board V0.2

I just got my first ever printed circuit boards back from BatchPCB. Pretty exciting! One of the boards is a Toyota audio system interface, but it needs to have a chip replaced and the pinout is different, so that board is not totally usable. The other board is this breakout board for the Bluegiga WT12 bluetooth module.

Bluegiga WT12 Breakout Board V0.2

This breaks out all the pins so you have complete freedom, and it's still pretty small. I have another version I will probably release that breaks out only the UART pins and is compatible with the BlueSmirf pinout. That one is much smaller.

Bluegiga WT12 Breakout Board V0.2

The WT12 has iWrap4 firmware that is a very simple interface to a variety of common Bluetooth profiles. It's quite affordable; please see my Flickr page and BatchPCB page for more information and ordering.

Bluegiga WT12 Breakout Board V0.2

Friday, October 1, 2010

Chords: "Holiday" by the Kinks

The chords posted around online are a bit wrong. And it's such a great, simple song! Fixed it up a little:
Artist-The Kinks
Album-Muswell Hillbillies
Writer-Ray Davies
Tabbed by S. McNally, Peter H. Li


Verse 1
A     F#     B7
          E7     A     F#
Oh what a lovely day today,
B7        E7        A       F#
I'm oh so glad they sent me away,
   B7            E7   A    F#   Bm Eb E
To have a little holiday today, holiday.

Verse 2
A     F#
B7           E7              A        F#  
And I'm just standing on the end of a pier,
B7          E7      A        F#
Hoping and dreaming you were here,
B7          E7     A            (turnaround: A F E C A ???)
To share my little holiday.

Verse 3 (type II)
A              F#        B7         E7
Lookin' in the sky for a gap in the clouds,
A           F#                   B7           E7
Sometimes I think that sun ain't never coming out,
        A         A7/G              D          B7
But I'd rather be here than in that dirty old town,
  E                                             (E+)
I had to leave the city cos it really brought me down.

Verse 4
Oh holiday, oh what a lovely day today,
I think I'll get down on my little ol' knees and pray, thank you Lord,
Thank heaven for this holiday today, holiday.

    D           B7       A
I'm leaving insecurity behind me,
    D             B7               A
The environmental pressures got me down,
C#              C#7          D       B7
I don't need no sedatives to pull me round,
E                                              (E+)
I don't need no sleeping pills to help me sleep sound.

Verse 5
Oh holiday,
Oh what a lovely day today,
I think I'll get down on my little ol' knees and pray,
That's what I'll do,
Thank heaven for this holiday.

Verse 6 (type II)
Lying on the beach with my back burned rare,
The salt gets in my blisters and the sand gets in my hair,
And the sea's an open sewer,
But I really couldn't care,
I'm breathing through my mouth so I don't have to sniff the air.

Verse 7
Oh holiday,
Oh what a lovely day today,
I'm so glad they sent me away,
To have a little holiday. 
(I sure miss OLGA sometimes...)