Saturday, 15 June 2013

rPi + tvheadend + shepherd

My home TV setup involves a file server (FreeNAS), a Mac Mini running XBMC and a Raspberry Pi running TVHeadend.

In setting up the rPi side of this, I came across a lot of scattered instructions so I thought I'd bring them together. Nothing is particularly difficult but I suspect I'll be doing this again at some stage in the future so for the sake of myself and others...

Sunday, 19 May 2013

The state of 3D printing

The world of 3D printing has intrigued me for years. An industrial designer friend of mine has been tinkering with 3D printed prototypes and objects for a few years now and I've been surveying the state of things for a while. I particularly liked the look of theForm1 on kickstarter although the limited choice of material is a potential issue. Anyway, for whatever reason, after a few hours of trawling shapeways, I feel compelled to rehash my favourites:

8. I have trouble believing the claim that this actually works. The sheer number of components here and the tolerances they must have is incredible.

7. An elegant chopstick holder that would look at home at the most sophisticated dinner table.
With hashi 1

6. A lens cap holder that attaches to your camera strap. Ingeniously simple and useful and it looks so professional it's hard to tell from the picture what the object actually is.

5. A Galaxy S3 case + credit card holder + money clip + bottle opener. Seriously, I wish I had a Galaxy S3 right now.

4. A blast from my childhood past! Evil tentacle!

3. Serious jewellery. Sure, you have to take it to a professional jeweller to get it properly made but the fact the designs like this can be based on a 3D printed base is still very impressive.

2. You can actually get stuff printed in stainless steel now. Awesome!
Size example

1. This mug looks incredible. Printed in ceremic, the detail is amazing. The price is the only reason I've held back and I assume these will drop significantly with time.

Sunday, 24 March 2013

You CAN still get a pre-paid data SIM card in Japan

I read a lot of blogs stating you couldn't get a pre-paid SIM card in Japan. It's true that the big players (NTT Docomo, Softbank, AU) don't sell these anymore but turns out that there is still at least one way to do this.

A company called b-Mobile sells pre-paid SIM cards valid for 1 month (about $USD32) and 3 month (about $USD100) with 1GB of data each. Yes, I wonder if anyone goes with the 3 month option...

The cards don't support calls but they run on NTT Docomo's LTE, HSDPA, 3G networks and data coverage seems very good.

You can only get them from big retailers. In Osaka, that means BIC Camera in Namba or, in my case, Yodobashi Camera in Umeda. You also need to activate them in Japanese - with a Japanese mobile apparently. So it definitely helps if you speak Japanese, have a Japanese friend, or if you're super convincing, maybe you can persuade the sales person to do it for you. From what I could tell, the U300 SIM they used to offer in English, pre-activated 24 hours after mail order purchase is no longer on offer. :(

In my case, I've been running on a 1GB, 1 month MicroSIM for a week now and using SkypeIn for receiving incoming calls. Calls are very high latency (almost unusable) but it has served its purpose so far - if I get a call that isn't working well, I just fall back to contact via email.

Best of luck Japanese travellers!

Friday, 8 March 2013

The worlds ugliest webm streaming webserver?

I was trying to find an easy way to get low latency video from a webcam to a remote browser today. Requirements:

  1. Quick deployment
  2. Runs on Raspberry Pi
  3. Runs with out-of-the-box debs (see quick deployment)
My hacky solution was a Django python app that uses the StreamingHttpResponse class, gstreamer and a pipe. Disguisting, but works well. Sadly, latency is about 10 seconds to localhost so its not exactly live... 

import pygst
import gst
def grab(request):
  """ Return a webm live stream from the first attached webcam. """
  class VideoStreamer():
    def __init__(self):
      self.pipein, self.pipeout = os.pipe()
      self.player = gst.parse_launch ("v4l2src ! video/x-raw-yuv,width=640,height=480,framerate=10/1 ! ffmpegcolorspace ! vp8enc max-latency=1 lag-in-frames=1 ! webmmux name='m' streamable=true ! fdsink fd=%d" % self.pipeout)
    def start(self):
      fd = os.fdopen(self.pipein)
        while True:
      except Exception, e:
        print "Exception was ", e
    def __del__(self):
  return StreamingHttpResponse(VideoStreamer().start(), content_type="video/webm")

Requires pygst and django 1.5 (use pip).

Monday, 4 March 2013

Bricked Netgear Stora? Arduino to the rescue!

My latest attempt at getting offsite backups working for me in the most convenient manner possible involves scattering storage devices around at places I frequently visit such as relatives places, etc. I thought I'd re-purpose a Netgear Stora device I had lying about (P.S. Don't ever buy one of these if you value your privacy) by modding the firmware on it. Turns out, an arduino makes a great TTL serial adapter if you short the reset pin to GND. :) 

I'm also particularly proud of my ghetto MacGyver-like pin connectors. They were created with PVC tape rolled around the leg of a resistor and then cut into thirds and slipped over each pin to hold them in place. (Yes, I need to get myself some more electronics gear...)

Pin outs here in case anyone stumbles across this wanting to do something similar. :)


Saturday, 12 January 2013

DataMule - My first Android app. :)

I've been toying with various backup solutions for months now. I've tried tahoe-lafs. I tried my own hacky scripts and before that I even had the audacious idea of writing my own P2P backup software from scratch, starting at the low-level RPC layer.. My current approach is to use duplicity and throw the files on Google's cloud storage. The biggest problem with this latest approach is that full backups of my 100GB of data take about 12.5 days of maxing out my ADSL uplink. QoS eases some of the frustrations trying to use the internet while this is happening but doesn't completely remove them.

So DataMule is going to be a simple Android app that includes an SFTP/SSH client and configuration for pairs of WIFI SSIDs.

When you come into range of your "source" SSID, the SD card partition on your phone gets filled up with data copied via SFTP from your source server (until full). When you come into range of your "destination" SSID, the process is reversed and data is copied to the destination machine via SFTP. To complete the data migration, rsync is kicked off on the destination host with flag to delete after copying. The rsync will connect directly back to the source and copy (from the source) to the new file. This will just kick off a file hash verification and either delete the file (if its OK) or fix it if its not (with hopefully minimal bandwidth).

A HDD at work, a HDD at my parents place and an Android app and I'm all set. So far I've got a skeleton app working but its very very rough.

More updates to come!