October 27, 2008

Colour Prompt

Filed under: Uncategorized — Tags: , , , , , , , , — alsuren @ 9:25 pm

Inspired by konversation’s pretty colours for users in an IRC channel, and pissed off with forgetting which of the many (smaug, soup, pip, concorde, harrier, excalibur, telford, dl325) linux boxes I’m remotely logged into at any given time, I decided to assign a different prompt to each host. Since some of the machines share home directories but not installed software, hard-coding a colour into each machine’s ~/.bashrc wouldn’t hack it.

That’s enough talking… I present to you “colourhash”.

# Save this file as 'colourhash', and put it somewhere in your $PATH
# Usage: colourhash [string] ; echo message
# Wherever you see a colour escape sequence in your ~/.bashrc (like 33[01;32m (bold green))
# Replace it with '$(colourhash)'
if [[ -n $@ ]]
# We have command line arguments
# We don't have command line arguments. Create a colour for this user@host combo
echo -n ${string} | cksum | (read hash tail
# We only really care about the first word printed by cksum: a crc hash of $string.
# Also note that crc is not a cryptographic checksum. This is not important, since we
# only have 7 colours to pick from, so hash collisions will be frequent.
# The readable colour codes lie between 31 and 37
colour_code=$(( 31 + ($hash % 7) ))
# Magic escape sequence follows:
echo -en '33[01;'${colour_code}'m'

Right now I’m only picking one of 7 colours. Who fancies doing the birthday problem on that?

If I end up getting too many hosts the same colour, I will start thinking of ways to increase the number of colours available. There are potentially lots of colour combinations to pick from, but changing the background colour might look be a bit odd. If anyone wants to wrap this up and push it into ubuntu/gentoo, give me a shout.

This is a good reference for anyone adding colours to shell programs. Code to generate the above grid can be found here.


October 22, 2008

Apple Goodies

Filed under: Uncategorized — Tags: , , , , , , , , — alsuren @ 9:19 pm

Went into the apple shop today to get a Kensington lock for my eee. Ended up buying one of those bluetooth keyboards as well. I’ve decided that this style of keyboard is pretty much as good as it’s going to get until you start getting zigbee keyboards: It’s reported to have a pretty decent battery life (6 months) and decent range (though obviously not as far as you’d get out of a mesh network like zigbee). It’s pretty much only as heavy as the batteries, and the keys are far better than your average laptop keyboard. It’s even a toss-up between these and the ones on the MS ergonomic keyboard. If you like thin keys for fast tapping, these are probably better for you, but I’ve been brought up on microsoft keyboards, with a bit of depth to them, so I personally prefer the ergo. The ergo is also easier on the wrists (unsurprisingly).

I think the best thing about bluetooth keyboards is that they can be used on your phone (I had to install an app using the nokia “download” program from my phone, which took about 5 minutes, but n95 users get it pre-installed). It has the potential to turn my dad’s old phone (which I absolutely hate) into something even more productive than my old phone (which served me well, but is no longer with us, rest its soul)

It also turns out that the kensington lock isn’t suitable for me, since it’s right next to the VGA port, and the only time I will ever be locking it is in the lab, when it’s connected to a VGA screen, and plugged into the wall. What I’ve now bought is a bike lock (uber-thin 2-loop cable lock, and a padlock), which I can thread through the slot where the battery goes. Cost me a total of £10, compared to £25 for the kensington, which I took back.

Still haven’t done any work today other than getting wavread and wavwrite working for my project. I still need to port a few things to use the new implementations. At some point, I may push for their inclusion in scipy, because the python standard library’s wave module is really quite annoying to use, (It sends data in and out as byte arrays, and expects you to convert them to arrays of integers yourself. Also, it was truncating my files when it saved them. It has probably cost me at least a week’s hacking in total, if you count the time it took me to port my code over to scikits.audiolab and the time it’s going to take me to port it all back again now I’ve found out that scikits.audiolab’s doesn’t work with easy_install (because of the dependence on C’s libsndfile, which doesn’t get bundled in) and debug my wave-based implementation, once I port across my other code.)

I should get on with that examples paper, shouldn’t I?

October 21, 2008

Lindy Exchanges

Filed under: Uncategorized — Tags: , , , , , , , , , , — alsuren @ 12:02 am

Okay… I haven’t blogged about Edinburgh yet, so I might as well write something about both exchanges.

In terms of general style of dancing, I’ve been mostly sitting out of anything fast, because there can be less playing in fast lindy, and it becomes a test of your fast swing-outs (which are a completely different move from normal ones) rather than an actual conversation between the dancers and the music. Also, it’s possible to make the same song seem either fast or slow depending on what emphasis you put on which parts of which basics. I could do a blog about why I hate soil-dancing fast lindy, but that will have to wait. The only good fast lindy dance I had was with Meg, who usually needs really heavy connection, because she [almost always] delays the hell out of the start of swing-outs, so that she can come in at a stupid speed and force a heavy connection. It didn’t seem like it took any extra effort at all to do fast swing-outs with her than normal ones, because she just dropped the delay, and came in at the same speed.

At Cambridge, since going to lots of Tango lessons, and not much Lindy, I had the aim of being as subtle as possible, while still leading whatever. This had some good responses, especially from Heather, who said that I seemed responsive to what she was wanting. I was also trying to play with the feel of the basics I was doing to fit the feel of the music, after the musicality workshop (though generally without changing the footwork too much, since that would require a lot of bal-like-fu). My next challenge on the lindy front will be to incorporate the subtleties of the rhythm/melody into a standard basic like the swing-out. I do suspect that in order to get it followed, I might need to change the footwork in some noticeable way.

I think that a special mention needs to go to Erika. At Edinburgh we had some random fun dances (including one in which brownies and ice cream were consumed, if I remember correctly (I’ve decided that I can feed myself better when leading than following [blues])) but nothing that made me go “wow” any more than the dozen or so other amazing dancers at the exchange. Then, on the Sunday night, there was a blues after-party with a little alcohol and tea, and I nabbed a few dances with her. At some point she led some smooth blues on me, as an “I really love this kind of thing” demo, and she managed to make me do something with my arse that I may never understand. I gave it a shot at leading too and there was definitely a lot of melty. I was very tempted to just keep dancing with her forever, but I knew that attempting to do so would probably result in less dances in the future. I also became aware that the more I danced with her, the more likely I was to do something stupid (made even more stupid by the fact that I had consumed a variety of beers, ciders, and chilli that evening). I remember thinking that I wasn’t in much control of anything: Everything I led was dictated by a mixture of what she was [/we were] already doing and what the music was doing.

In Cambridge, on the Friday night and early (before one) Saturday night, we had strings of really playful dances. I felt like there weren’t more than a handful of basics that weren’t twisted and stylised somehow by one of us [insert reference to Andrew Sutton’s ideas on levels of leading and following], and there were a good few bluesy-flourishes thrown in too. I actually offered her all of the remaining dances of the night at one point, and would have done so if I hadn’t signed up to help out with the refreshments for the next hour. By the time I started looking for her again, she was pretty engrossed in dancing with James (another Edinburgh dancer). I spent the next half hour or so variously trying to pretend that I wasn’t supremely jealous (and didn’t, in fact, have a massive crush on her) and sleeping, so that I could help out with the packing up at 6 like I’d stupidly offered to do. I think I may have refused a few dances in that time which I never managed to get back (and at least one from Holly, who I felt like I had danced with at least half a dozen times that night anyway). When I eventually got my blues dance with Erika, it was dreadful. Probably a good thing, as it meant that I could more happily let her get back to dancing with James, and have a few decent dances with other people myself.

On the Sunday of Cambridge, we had some decent dances again. I caught myself leading slow tuck turns (in the same way) more times than I might have liked, but honestly, who cares: at least they turned out as slow tuck turns and didn’t morph themselves into one-footed pivots [mentioning no names]. I just love it when you feel like you’re picking up on everything in your partner’s body[/mind], as well as the music. Due to my being all bunged up and probably infectious, and breaking some of my own terms, I think that Erika came firmly under the heading of “I know this is a really bad idea… why do I want it so much?”

It’s probably also worth observing that Gill looked stunning in her saturday night costume, but since we were busy pretending not to know each other, I didn’t say anything. I’m sure there will be pictures on facebook for the curious.

In terms of health, my shoulder went to hell again on the sunday when we were at the pub. I think it was probably just one dance that was the last straw, after a weekend’s punishment. I really need to go easy on it over the next few months, and do all of the exercises that my physio showed me. I suspect that it may mean ducking out of troupe, which is very annoying, as I really wanted to be part of an ADC show before I left. I guess this gives me yet another reason to focus on Tango.

Create a free website or blog at