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:


dist:
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.


#!/usr/bin/python

# 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)
#todo.sort()
#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),)

try:
merge.paste(front,(0,0,1000,750))
except:
print "should skip on 1st iteration"

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

merge.paste(rear,(0,750,1000,1500))

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

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

Sunday, 23 January 2011

Sponsored

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

Friday, 17 December 2010

Wednesday, 15 December 2010

Fedora Packaging

OK, so I needed to get my touchatag reader working under fedora, and RFIDIOt needs pyscard. Much yak-shaving later I've come up with a .spec file for pyscard, and its now ready for review.

spec file - http://dl.dropbox.com/u/6594808/Fedora/pyscard.spec
src rpm - http://dl.dropbox.com/u/6594808/Fedora/pyscard-1.6.12-1.fc14.src.rpm

oh well, lets see who'll pick up my Review Request

Thursday, 7 October 2010

ssh-copy-id

I normally have my ~/.ssh/config so that it only uses my key or gssapi to login to other sites, however this poses a problem when reinstalling a server and don't yet have my key on it

ssh -F /dev/null root@hostname
works, but this wasn't working with ssh-copy-id.

Turns out that the ssh-copy-id script is braindead and only expects one or two (with the 1st beginning with -i) arguments.

lo and behold, some single quotes did the trick:

aelwell@pcitgtelwell:~$ ssh-copy-id '-F /dev/null root@concerto'
Are you sure you want to continue connecting (yes/no)? yes
root@concerto's password:
Now try logging into the machine, with "ssh '-F /dev/null root@concerto'", and check in: ....


tada!

Wednesday, 6 October 2010

upgrade fail


No I'm not hiring an expensive car, but I certianly won't be using carhire3000 if I do...

Ressurection of a WirelessThings OpenPi (from kickstarter)

Many years ago, I was handed one of the openpi kickstarter devices (see https://www.kickstarter.com/projects/wirelessthings/openpi-wireless-...