Tiernan's Comms Closet

Geek, Programmer, Photographer, network egineer…

Monthly Archives September 2012

PowerShell + HandBrake + AppleTV + iTunes = Automatic TV… Ish…

I have an AppleTV in the house (3, actually) and I am very happy with its ease of use, size and cost… You can’t argue with the small price!

I also have a lot of content that works great with the AppleTV in iTunes, but I have content which does not work so great with the AppleTV… So, I needed to find a way to convert files quickly and easily… that’s where PowerShell and Handbrake come in…

  • in the code above, you need to set the path of where your files live. in my case, they live on a NAS.
  • next, set the location of HandBrake… I have a 64-bit copy of Windows and a 64-bit copy of HandBrake.
  • set the new file name to where you want the file to go. in my case I have it set to my “Automatically Add to iTunes” folder, which is a magic folder for iTunes that copies any files dropped in there to your iTunes library.
  • finally, conversion is run…

This may take a few min, depending on a few factors:

  • how many files you are converting
  • how fast your machine in
  • how fast your machine can read and write the files…
  • etc…

I have set files to convert on 3 different machines (the GodBox and 2 other servers) and I am getting speeds of anywhere between 250FPS (on the GodBox running 2 instances of HandBrake CLI) and 40 – 60 FPS on the older servers… on the remote machines, they are sending files to the GodBox folder also, so once everything completes, it’s just a matter of opening iTunes and we are good to go… Now to figure out how to automate the Metadata import…

Crashplan Backups

I have been running CrashPlan for a while now, and, other than some minor issues (backup speed to their central location is the big one), everything has been going grand. I use it to backup about 600GB of photos and videos, 500GB+ of VMs, documents, source code and a fair whack of other stuff… In total, about 2TB of data.

Anyway, here are some tips i have figured out over the last while for making Crashplan work a little better…

I am also in the process of doing some further tests with iSCSI drives linked to the Cloud, and other weird and wonderful things… once I have finished, i will upload extra stuff here.

More VoIP Stuff

As part of my ongoing plan to upgrade the house to VoIP, and as a follow up to my first VoIP stuff post, here are some more things i have found…

  • I have added SipDiscount and SipGate for making and recieving calls.
  • SipDiscount allows me to set pretty much any number as my Caller ID, as long as i “own” that number (they either text or call you with a code, and you enter it on their site). They also allow me to make cheap calls to Irish Mobiles (check their rates here)
  • SipGate gave me a incoming UK phone number. Its an 0845 number, which I dont know what that means… but it was free, so its all good. Not sure if i can recieve text messages on it though…
  • I have a Blueface account, which gives me an Irish 076 VoIP number. 076 is the standard VoIP number here in Ireland…
  • I have a IpKall number, which is based in Washington State. You need to recieve a call on this line at least once every 30 days to keep it active.
  • My Google Voice accepts calls and forwards them to my IpKall number, which then rings my BlueFace SIP account (since i know they will be up all the time, by my home server may be offline since i am only testing) which, if a SIP device is connected, will forward it again… if i am offline, or no sip devices are active, that call is redirected to voice mail…

Its all very complicated at the moment, but the plan will be that any incoming calls should go directly to the machine in house, which will ring the desk phone and any other SIP clients. Any incoming PSTN calls will also do the same. Outgoing calls will depend on the dialing plan, which i still need to figure out, but the theory goes as follows:

  • Irish landline calls at certin times should go though the PSTN (since we get some free calls with our line). Other times they should go though SipDiscount or BlueFace.
  • if the PSTN is busy, fall over to one of the other providers…
  • Irish Mobile calls should go though SipDiscount and then fall back to land line, or if i ever get the BlueTooth setup working, SipDiscount, then bluetooth, then landline…
  • International calls should be sent though SipDiscount or Blueface, whichever is cheaper…

Its going to be an interesting setup… 🙂

Building a Cross Compiler for your Raspberry Pi

My main machine at home, known as “The GodBox” is a Dual Processor, Quad Core Xeon 5520 with 60Gb RAM, 2 300Gb 10,000 RPM Western Digital Velociraptor in RAID 0 for boot, 4X1Tb 7200RPM drives for storage, 2 more 300Gb 10,000 RPM drives for “scratch disk” and a couple high(ish) end graphics cards with 3 monitors plugged in… Hence the name, GodBox!

Anyway, The Raspberry Pi, on the other hand, has a 700Mhz processor, 256Mb RAM and not much else… So, if you need to write code for your Pi, and you don’t want to wait a long time to compile, check out this tutorial on how to build a cross compiler for your raspberry pi which will allow you to build your apps on a different machine… I have a college project which the Raspberry Pi will be used for, and i am thinking this will be how i build code.

MicroTik RouterOS VPN Setup

I have been running a MikroTik RouterBoard in the house for a couple of months now (the RB750G) and I am very much loving the thing. But one thing you may need to do is setup VPN connections… Here are some tips on how to create a VPN Server and Client on your RouterBoard.

##Client Setup

to setup a client, you need to do the following:

What does that all do? the first line creates an l2tp-client interface, pointing at “servername” with the username and password set. encryption, etc is enabled… Line 2 then enables the client. Line 3 sets all traffic comming from networkaddress/24 (for example, to be sent though the VPN. any traffic going into networkaddress (same example) is not sent though the VPN. Line 4 creates a gateway, for all addresses ( to use the VPN address. finally, NAT Masquerading is enabled on the VPN interface.

there are more advanced things you can set above… some examples I can think of are as follows:

  • There should be no good reason to limit the amount of VPN connections you have… in theory, you could have multiple…
  • for the mangle rule, set the src-address to a single machine in your network. that way, it gets VPN only connections. Also, you could set the dst-address to a single address or network to send only traffic going to a given server though the VPN… Example would be Netflix US traffic to a US VPN server, BBC iPlayer traffic to a UK VPN, etc.
  • the example above uses L2TP, but PPTP, SSTP and OpenVPN are also available.

Server Setup

As mentioned above, L2TP, PPTP, SSTP and OpenVPN servers are available on RouterOs. Details on setting them up are available on MicroTik’s Wiki at the following locations:

SSH Tunneling made simple

Something I do on a regular basis is use the internet while “out and about”. This could be college, which has a semi open network, or it could be a coffee shop, which also usually has a semi open connection. There is also the possibility of using the a mobile internet connection on my iPhone, which can be slow, but at least its only shared with me… Anyway, over on RevSys.com, there is a post SSH Tunneling made simple which shows you how to open an SSH tunnel to your machine somewhere else (could be at home, as is my case, or a VPS/Dedicated server somewhere, or even on Amazon…) and use that for different things… In the case he shows, its for SMTP access. For my case, i am forwarding my local port 3128 to my Microsoft TMG 2010 Server in house on port 8080. Then my system proxy on my laptop is set to use localhost:3128 for all web and HTTPS requests. Very handy. One other tip: Using the -C flag, so your command may look like:

ssh yourname@remotemachine -L 3128:remoteMachine:8080 -C

will compress data between you and the SSH server, which for basic web browsing (HTML, CSS, JS) will make things faster, but for stuff like images, etc, may not work so well… Your Mileage may Vary…

Also, while on the subject of SSH, Linux Journal has an article on Eleven SSH tricks which mentions compression, Encryption Cyphers, X11 Forwarding, Config files and other interesting bits.

VOIP Stuff

I have been very interested in VOIP stuff for the last while now, and finally started looking at implementing it in the house. Here are some links which may be useful. I will do a full post soon.

The main VOIP hardware I use is:

I also use the 3CX software on both my iPhone and Android.

Raspberry Pi Stuff

A couple of months back, I got my hands on a Raspberry Pi, a tiny development board that can run a full copy of Linux, has an HDMI port, a couple of USB ports, Ethernet and a few other little bits and pieces. The full specs, from the Wikipedia Article, are as follows:

  • Operating system: Linux (Debian GNU/Linux, Fedora, and Arch Linux ARM)
  • Power: 2.5 W (model A), 3.5 W (model B)
  • CPU: ARM1176JZF-S (armv6k) 700 MHz
  • Storage capacity: SD card slot (SD or SDHC card)
  • Memory: 256 MByte
  • Graphics: Broadcom VideoCore IV

There have been a few things i have wanted to play with it for but have not implemented all of them yet… still learning… but some interesting projects have come to my attention… here they are, in no particular order:

In all fairness, the Pi makes a lot of ideas possible. with such a small size, and such a cheap price ($25-35), you are only limited by your imagination… Wonder if could i get Windows 8 installed on one of these…

there are also a few interesting things that may make the Pi work more portable…

  • LiPo Rider Pro: takes input from Batteries and Solar Panels and outputs as USB 5V. should run the Pi off solar and batteries for a while… 🙂