Tuesday, 13 December 2011

The Perils of CDNs

So CERN have just held a popular webcast event to announce the latest results in the search for the Higgs. Many of the webcast viewers (no I don't have usage stats) were complaining that the stream was choppy. What I did notice on my laptop (couldn't get near the auditorium) was that the main libflashplayer traffic was inbound from VELOCIX-EU - could this be the CDN used by Groovy Gecko?

Not having an onsite mirror though then meant that each member of staff watching was then pulling data *in* to site as the traffic graph shows:

I'm sure this can't be efficient... Ho Hum.

Thursday, 8 December 2011

Another year of LHC Secrecy

So, another year of LHC running comes to a successful close, Once again we've managed to keep the real facts hidden from everyone - Not the Higgs (as thats's being discussed next week) but more importantlt that the whole of the LHC is actually a spinoff from one of the major Data Centre companies who had outgrown their shed. The Proof? why - of course...

however, best to keep it a secret - its easier to get runding for a mythical 27km tunnel than a shed :-) Oh, and a lot less sexy in the books too...

Friday, 25 November 2011


Updated to include the plots from monitoring box:

Thursday, 24 November 2011

FTTH update

So, I'm still (till I move flat) with k-net at the flat, and have a monitoring whitebox hanging off my router.
So Far, speed has been consistenly high - downloads in the 90Mb/s range. They are only (heh, 'only') seeing uploads of ~30Mb/s, but I know I can get higher than that using a box closer to the reso-lian network or to work.

Sniff, anyway thats only till the end of the month and then I'm back to orange.fr till May. Somehow I don't think I'll be getting this off my ADSL line...

Wednesday, 28 September 2011

PoE Network controlled signage

I may have a requirement for several 'remote controlled' illuminated signs. (where remote could be network driven) - These aren't Scrolling LED 'calls in queue' type ones, but more the warning 'Laser on', 'Mic Live', 'Conveyor Running' type ones.

Normally these things seem to be driven directly from some local switchgear or output, but what if you want to gather status centrally , or illuminate the sign depending on some remote sensor (be it a web tsunami alert or the boss' car being picked up on the ANPR at the gate)

Cue a quick hacky prototype: Take one nanode and use the digital outputs to drive a mosfet to switch some cheap LED strips from IKEA. So far so good, but that requires a 12v (since thats what the strips use) supply. The nanode can take that on the screw inputs if you add a heatsink to the reguator, but I'd rather get rid of the PSU alltogether: cue a cheapo 802.3af PoE splitter from TP-Link, and I have the whole lot driveable off one RJ45 cable.

Onwards to software, and it looks like bitlash / restuino look useful (esp if I get the whole lot working with DHCP too).

Anyway, with a range of lighting areas possible (thanks to addressable outputs on the nanode) per display, the option to have a nice facia with multiple 'zones' illuminated is possible. Now to find a nice case...

Thursday, 1 September 2011

puppet /. facter / v12n

As I'm starting to get into puppet, especially when used with the foreman for dashboard display, I've started noticing a few (fixable) oddities

1st up ios that not all RHEL clones are treated equally -- some patches are just adding detection and flaggin, others go the full hog and make sure its in all the "constrain:" sections in facter too. I guess I need to do a code review and pull in the extras. Cue lots of different VMs
(the joys of a weeks home leave from work..)

secondly, virtualisation detection is 'flakey' -- some (vmware) are really well detected, but new kernels give false positives (see issue #7723) so I'm going to set about tidying these up and adding hyper-V detection properly

Thursday, 25 August 2011

FTTH / Reso-LIAIN / K-Net

Executive Summary:

I've had fibre installed to the flat. In this area it's all organised by Reso-LIAin who have 'local' ISPs who resell their network. Luckily for me one of the PoPs is located at work so I have nice small (<2ms) pings to site.

So what's involved? Choose your ISP from the shortlist (of about 5) -- all roughly the same prices, some offering more bundled stuff at cost. I ended up with 'k-net' (formerly known as kwaoo.com). They seem to be rather dependent on one supplier if you look at their AS24904. Contractors from reso-lian show up to pull the fibres into your property -- In my case they'd already run multicore into the building (1st and 3rd floors had breakout boxes installed) and I was the first to get it from there. They pull (through the france telecom duct -- which should be installed anyway) a 2-core fibre and terminate it at the CPE (which must be powered, so you have to define a location within reach of a wall-wart. They will put the CPE up to 5m from the france telecom entry point, in my case I asked for it in the walk in cupboard. Being an old flat, the duct was smaller than current Normes (building standards) and partially blocked. when they repulled the phone cable (in use for ADSL) they managed to snap it. It now leaves the duct at floor level rather than in the patress. Hmm.


The 4 ethernet ports are split from 2 vlans - ports one and two carry 'internet' traffic - you give the MAC address of your router (I purchased my own) and they put it in the DHCP server. (you get a static IPv4 address). Ports three and four are for the IPTV service. This is multicast and although they supply a set top box, I've not bothered renting one, as I'll just watch it with VLC instead. Status of the TV streams is available (from reso-liain) at (found via their forum).

Phone service is VoIP -- They will port your existing number (this is the only resason my freebox is still active - am waiting till thats done before cancelling service) and will sell or rent you an ATA. Since they send config details in the mail, I shall use my polycom and if brave the SPA3102.

Disadvantages: No IPv6 yet. boo. Especally as I was used to having it with free. Other than that? I've only mailed specific tech Questions at their helpdesk and theyve been OK (such as can you set reverse dns to ...... -- which they do :-)

Wednesday, 3 August 2011

Shuttle bus tracker

Not that I tend to err, leave things till last possible minute or anything, but I'd really like to have a tracking system on the CERN shuttle busses, so that I can stay in the office until I know the bus is coming. (or, armed with a mobile device waiting at the stop, see where it is)

So - I was thinking something embedded ish that contained a cheapo GPS chipset (probably good enough signal on the dasboard, a 2 line LCD and a keypad

something UI ish for driver along the lines of 'select route:'
and then it'd show the route, upcoming timetabled stops

backhaul to site would be GSM (should be able to transmit a small UDP packet of transponder#,Route#,Position,timestamp) to a central server.

The folks over at rpi.edu (yes, they started concerto too) already have some code that looks interesting at https://github.com/wtg/shuttle_tracking/

Question is, would it be cost effective to roll our own, and if not, who's offering the best / cheapest (open) system out there?

Tuesday, 12 July 2011

nanode built!

One successful evening of soldering, and lo, I have a working nanode. Started off nice n basic with the resistors, but overall a pretty simple pcb to assemble:

Plugged it in, and lo, blinky LED. Have since flashed with the EtherShield Drivers and its happily getting an IP address. now for some pachube / twitter / other integration...

Monday, 11 July 2011

Orange VoIP woes

Our livebox2 repeatedly used to lose the VoIP service (somewhat annoying as we don't have a 'physical' pots line, just ADSL signal on the copper pair)

however there's now a subtle hint on the config pages NOT to change the DNS servers from the automatic setting (we used to use opendns for content filtering)

So, anyone know what hard-coded voodoo sagem/orange were up to?

Monday, 27 June 2011

Electronic components

Vigilant readers (ha, who am I kidding) will have noticed I've been starting on some ATmega hackery, but I'd like to prototype up without needing to but an arduino (clone) card for each one. So, off to the electronics equivalent Laminated Book Of Dreams (ie, farnell) to stock up on core components.

Discussions have come up with something like the following list, but what else should be added?

* LEDs - Was going to get both a selection single and a couple of RGB ones
* pile of resistors
* capacitors - elecrolytic and ceramic
* Diodes - signal. power, zener
* Voltage regulators
* 2n7000 mosfets
* generic transistors
* couple of atmega chips, crystals etc (core componets of arduinos)
* battery holders
* reset switches
* hookup wire
* breadboard (one decent and one small)

More specific bits I also want are
* rf12 boards
* opto isolator for telemetry input
* moar jeenodes :-)

Tuesday, 21 June 2011

EDF metering and 'Tele-Info'

Just discovered via some google-fu that we have a Sagem C1000 series meter in the house, which includes

* Interface de télé-information client permettant le raccordement à un système de gestion d'énergie

so, with a bit more googling I discovered that it's 1200 baud, 7 bits one stop. and lo - there's even an arduino shield already made for it!

--- update ---
Have discovered that there are many hacks around to parse this teleinfo - some of which need a licence fee (!!!) and do fancy things like export to bdpv.fr

Sample of the data stream is at http://www.planete-domotique.com/blog/2010/03/30/la-teleinformation-edf

Thursday, 16 June 2011

Hardware Hackery

I've just purchased a nanode to be the main part of the energy monitoring in the new house. More details about it are at http://wiki.hackspace.org.uk/wiki/Project:Nanode - I plan to use the nanode as the head unit, perhaps with a somple lcd display, talking to slave nodes (jeenodes or emontx boards) which do the data logging.

more info and construction details when it arrives.

Monday, 23 May 2011

Nasa TV on PS3

Since there's no european satellite stream of Nasa TV it means you have to watch a streamed version over here.

Also I'd like to watch it *on the TV* when there's something interesting, rather than a PC. so, with a bit of hackery http://smudge.elwell.org.uk/nasa.html contains just the swf embed object (no extra junk) scaled to 720p size.

Opening the link in the PS3 web browser and clicking the 'fullscreen' bottom RH corner means you get a nice fullscreen flash stream on your TV :-)

share and enjoy.

Monday, 9 May 2011

email clients

Came across this posting recently. Oh that the following recommendations were actually implemented somewhere...

But let me suggest a few pop-up windows I would like to see
mail-programs implement whenever people send or reply to email
to the lists they want me to subscribe to:
 | Your email is about to be sent to several hundred thousand |
 | people, who will have to spend at least 10 seconds reading |
 | it before they can decide if it is interesting.  At least  |
 | two man-weeks will be spent reading your email.  Many of   |
 | the recipients will have to pay to download your email.    |
 |                                                            |
 | Are you absolutely sure that your email is of sufficient   |
 | importance to bother all these people ?                    |
 |                                                            |
 |                  [YES]  [REVISE]  [CANCEL]                 |

 | Warning:  You have not read all emails in this thread yet. |
 | Somebody else may already have said what you are about to  |
 | say in your reply.  Please read the entire thread before   |
 | replying to any email in it.                               |
 |                                                            |
 |                         [CANCEL]                           |

 | Warning:  Your mail program have not even shown you the    |
 | entire message yet.  Logically it follows that you cannot  |
 | possibly have read it all and understood it.               |
 |                                                            |
 | It is not polite to reply to an email until you have       |
 | read it all and thought about it.                          |
 |                                                            |
 | A cool off timer for this thread will prevent you from     |
 | replying to any email in this thread for the next one hour |
 |                                                            |
 |                         [Cancel]                           |

 | You composed this email at a rate of more than N.NN cps    |
 | It is generally not possible to think and type at a rate   |
 | faster than A.AA cps, and therefore you reply is likely to |
 | incoherent, badly thought out and/or emotional.            |
 |                                                            |
 | A cool off timer will prevent you from sending any email   |
 | for the next one hour.                                     |
 |                                                            |
 |                         [Cancel]                           |

Friday, 15 April 2011

git import

I had a set of old files with the correct timestamp on, relating to separate versions of a file, ie, foo_16.c, foo_17.c, ... foo_22.c which I wanted to import into a new git repo while preserving the author history

so, this little snippet of code worked - may be useful for others

$ git init
$ git add -N foo.c
$ for i in `seq 16 22` ; do
cp -p hist/foo_$i.c foo.c;
GIT_COMMITTER_DATE="`date -R -r foo.c`" git commit \
--author "Fred Bloggs <fred.bloggs@example.com>" \
--date="`date -R -r foo.c`" -m "Version $i" foo.c

which you can then branch and commit as normal with current changes

Yes I could probably have done GIT_AUTHOR_DATE=$GIT_COMMITTER_DATE but well, 2 calls to date wasn't that much of an overhead in this case.

anyway, for those that care, the result is up on github

Monday, 4 April 2011

Bash, PS1, PROMPT_COMMAND and other fun

I've just spent 30 mins trying to understand the flow between the various files that set a bash prompt on fedora to do the following: (assumption is here that you're in a colour xterm)

I want:
* my username to change colour depending if I still have a valid kerberos token
* the hostname of the machine I'm on to be in RED if I'm root
* displayed path to be as simple as possible
* $ if I'm a minion, # if root as mormal
* command line editing to work sensibly, no wierdisms on wrapping long lines

so - I used to have on my machine something like the following:
if [ "$PS1" != "" ] ; then
klist -s
if [ $? -eq 0 ] ; then
PS1='\[\033[32m\]\u@\h\[\033[0m\]:\w\$ '
PS1='\[\033[36m\]\u\[\033[32m\]@\h\[\033[0m\]:\w\$ '

and something similar for root.

But on my laptop (F14) I wanted it system wide, so went down the approach of customising /etc/bashrc where you find calls to

1) /etc/sysconfig/bash-prompt-* aren't included, so you're on your own
2) It must point to an executable script that is run every time before displaying the prompt
3) PS1 is still displayed *AND* if you use tab completion / ctrl-l, its *only* PS1 thats displayed on your screen, not the output from PROMPT_COMMAND

so: DON'T do the following:

cat /etc/sysconfig/bash-prompt-xterm
#!/usr/bin/env bash
# set green username if we have a valid kerberos token, else cyan
klist -s
if [ $? -eq 0 ] ; then
# set hostname in red if we're root, green otherwise
if [ ${USER} = 'root' ] ; then

printf "^[%s%s^[[37m@^[%s%s^[[0m:%s " ${K} ${USER} ${U} ${HOSTNAME%%.*} "${PWD/#$HOME/~}"
#echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}\007"
(where ^[ is 'ctrl-v, esc' in vim)
because you end up with stuff like

aelwell@pcitgtelwell:~[aelwell@pcitgtelwell ~]$

until you press ctrl-l and end up with just
[aelwell@pcitgtelwell ~]$ (ie, $PS1)

but *DO* make the call to see if you have a valid token and set the xterm titlebar in /etc/sysconfig/bash-prompt-xterm, but if you're altering PS1, then do so in the traditional places of /etc/bashrc and (as suggested in that file) a custom modification shell script in /etc/profile.d/ directory.

Ho Hum. Hope this clears up for anyone else trying to work out what the sysconfig/bash-prompt-* files do.

oh, and does anyone know a lighter call to see if a token is still valid than 'klist -s'?

Friday, 1 April 2011

Daily WTF Candiate

(Credit for spotting this one goes over to the fine folks at scotgrid who were bitten by the fallout.

Anyway, Useless Use of Cat^H^H^HMore award goes to http://bit.ly/dI2W3c

Wednesday, 23 March 2011

Garbage in, Garbage out

Why you should not accept data from users into a DB without checking it.

Exhibit A: "select manufacturer"







Monday, 21 March 2011

The saga of SAGA

for anyone who wishes to install a glite-WN without the overhead of SAGA, the magic voodoo on the command line is

yum --enablerepo dag groupinstall glite-WN --exclude \*saga\*

Friday, 18 March 2011

Makefile Faffage

I've inherited a piece of legacy code (an inirscript that needed bringing up to FHS and Fedora packaging guidelines) -- as part of the testing I realised I needed a noddy way to generate the tar.gz sources. There was already a Makefile in the package (for ETICS) but I hacked in the following to quickly build up a NVR-tarfile.

Not pretty, but if anyone fancies some Makefile golf, I'm open to suggestions:

echo ${package}-`sed \
-e '/^Version:/!d' \
-e 's/[^0-9.]*\([0-9.]*\).*/\1/' \
-e q \
${package}.spec` > .fname
-rm -rf `cat .fname`
cp -lvr src/ `cat .fname`
tar chzf `cat .fname`.tar.gz `cat .fname`
-rm -rf `cat .fname` .fname

and yes, it bears a striking resemblance to the GNU Complex Makefile Example

Saturday, 29 January 2011

QSL Cards

At the shack there are thousands of QSL cards stuffed into boxes. As an experiment I decided to see if there was a quick way of scanning these - so using a webcam to capture a still image, followed by a python script to stitch the 2 adjacent images together (as the front and back will be on 2 separate images) I managed 400 or so in a session.

stuffed up on flickr for now till I get round to finding a better place for em.

oh the script? it's my 1st adventure into the Python Imaging Library -- and its rather nice.


# Script to generate a single image of a QSL card from 2 adjacent
# scanned images
# Andrew Elwell for F6KAR
# This script may be copied or modified under the terms of the GPL
# We assume that the cards are arranged with the following seq:
# [- 1F] [1R 2F] [2R 3F] .... where FR are Front and Rear of cards

from PIL import Image
import os

indir = "/home/aelwell/Downloads/qsl/batch2"
outdir = "out/"

#leftbox = (100,100,900,1200)
leftbox = (0,0,750,1000)
rightbox = (850,0,1600,1000)

#todo = os.listdir(indir)
#todo = list(todo)
#for i in todo:

for n in range(1,403):
i = "Image-" + str(n) + ".jpg"
image = Image.open(indir + "/" +i)
print i

merge = Image.new('RGB',(1000,1500),)

print "should skip on 1st iteration"

rear = image.crop(leftbox)
rear = rear.rotate(90)


front = image.crop(rightbox)
front = front.rotate(270)

merge.save(outdir + i,"JPEG")

Sunday, 23 January 2011


Yay. So tibbs has taken up the challenge and become my sponsor for Fedora. So far I've got libfap built in koji, just working out the ins and outs of Bodhi, and we're good for multiple platform / arch builds. Seems rather simple compared to some other buildsystems I'm using :-)

Anyway, lets see if planet.fp.o picks up on the Fedora tag correctly