Tiernan's Comms Closet

Geek, Programmer, Photographer, network egineer…

Git Push DNS

There are now a lot of services that have “git push” options available… you can build websites with
Azure and Github, books using ShareLaTeX and now, DNS using LuaDNS. I have one zone
running at the moment (tiernanotoole.net) and you can see the DNS records on github here. I am
tempted at moving other records over soon… but i am currently on Amazon Route53 and 1: its works, so
dont break it, and 2, not sure how to bulk export records from Route53 to Bind or Lua format.

[update] 2 quick updates: 1) their free account, which is what i am using, allows 3 domains and 30 host
records. they also charge less than Route53:

  • route 53 for 10 domains per year cost 50c per domain (first 25) per month, then query charges. total,
    about $60 + queries (@40c per million).
  • luadns cost $29 a year for 10 domains, 5 million (ish) querys a month and 500 host records…

I think i have nearly 30 domain on AWS… so, their $59 a year package, which include 30 domains, would
probably save me money…

and 2) i forgot about one of those git push services… DeveloperMail is a service, for developers,
for managing email servers. IMAP, SMTP, Git… all supported! just signed up… $2 a month per user. Lets
see how this works…

Bulk compressing images for the Web

Now that all my sites are running Jekyll I am trying to get them optimized for SPEED which meant
looking at all the stuff that takes time to download… There are more tweaks (and possibly posts) coming down
the road, but to start, I needed to look at images.

First things first. I’m running this on a Sabayon Linux box, so some of the install commands will be different… (Also, i do need to explain why I moved from Windows to Linux on the GodboxV2, but that’s a different post…)

First, install OptiPNG (they have a Windows build too…) and JPEGOptim

sudo equo install optipng
sudo equo install jpegoptim

[UPDATE] I tried this on an Ubutnu Box, and to install both of these, the package names are the same. so, to install both:

sudo apt-get install optipng jpegoptim

Next, using the Linux find command (this should work also on OSX…) run OptiPNG and JPEGOptim on all pngs and
jpgs in your given directory:

find . -iname "*.png" -exec optipng {} \;
find . -iname "*.jpe?g" -exec jpegoptim {} \;

depending on how many images (and how fast your machine is) it should take a min or two…

That’s it! I did a git status, which showed me all the changed images, and then deployed the Jekyll sites… All
good! That’s it!

Hubic and Duplicity

I mentioned HubiC in my last post, and in it i said that you could use Duplicity for backups. Well, this is how you get it to work…

First, i am using Ubuntu 14.04 (i think…). I use Ubuntu in house for a few things:

  • its running Tiernan’s Comms Closet, GeekPhotographer and Tiernan’s Podcast all in house, aswell as being used to build this site. The Web Server and MySQL Server are seperated, MySQL running on Windows, web on Ubuntu… but thats a different story…
  • I have a couple of proxy servers running Ubuntu also
  • Other general servers running Ubuntu… dont ask, cause i cant remember what they do half the time…

So, Duplicity is a backup application. From their website:

What is it?

Duplicity backs directories by producing encrypted tar-format volumes and uploading them to a remote or local file server. Because duplicity uses librsync, the incremental archives are space efficient and only record the parts of files that have changed since the last backup. Because duplicity uses GnuPG to encrypt and/or sign these archives, they will be safe from spying and/or modification by the server.

The duplicity package also includes the rdiffdir utility. Rdiffdir is an extension of librsync’s rdiff to directories—it can be used to produce signatures and deltas of directories as well as regular files. These signatures and deltas are in GNU tar format.

So, how do we get it working? Well, givin that i am on Ubuntu, these are the steps i needed to do:

  • first, we need some credentials and API keys… If you havent signed up for HubiC Do so now… That url gets you an extra 5Gb if you sign up for free (usually 25Gb) or if you pay 1EUR a month, you get 110Gb (usually 100Gb) and 5EUR a month gets you a staggering 10TB (yup! Terabytes!).
  • Login to Hubic, and in the menu go to ‘My Account’, ‘Developers’. in here, create a new application (name and URL to redirect to… http://localhost seems to work correctly). Get the Client ID and Secret ID that was given to you.
  • take the contents of the following gist and replace your own details… I know, i am not a fan of sticking my password in a txt file… but it should be your local machine…
  • that file should be in your home directory and should be called .hubic_credentials.
  • add the duplicity PPA project (https://launchpad.net/~duplicity-team/+archive/ubuntu/ppa) to ubuntu using the add-apt-repository command (details on the link above, under the link ‘read about installing’). for me, i just called ‘sudo add-apt-repository ppa:duplicity-team/ppa’
  • install duplicity by doing ‘sudo apt-get install duplicity’. Dont forget (its in the tutorial above!) to do an ‘sudo apt-get update’ first!
  • When i ran that, there where a few extra Python packages to be installed, so i was asked did i want to install them… Say, yes.
  • Now, to run a backup we run the following command:

duplicity ~/ cf+hubic://location

  • cf+hubic is the backend to use, ~/ is the url to backup (my home directory in this case) and location is where on Hubic we want it stored. If this doesent exist, not a problem… it will create it.
  • after we run this we… ahhh… i get an error:

BackendException: This backend requires the pyrax library available from Rackspace.

  • right… pyrax library is from Rackspace and is available to download though pip…
  • I seem to have python and a few other bits installed on this machine, so running ‘sudo pip install pyrax’ works… Your millage may vary… [eg, this is out of scope for this tutorial! your on your own!]
  • Other problem… I got a load of weird and wondering errors like this:

AttributeError: 'Module_six_moves_urllib_parse' object has no attribute 'SplitResult'

  • I fixed these by running:

sudo pip install furl --upgrade

  • FINALLY! ITS ALIVE!!! by default, it asks you for a key for the GnuPG encryption… and its all good! the first backup creates the directories, required files, etc. the next time you run the command, it will only upload changes. it will also ask for your GnuPG code you entered, so remember it!

And thats all folks! Any questions, leave them in the comments!

Hubic, OpenStack Swift and Curl

HubiC is an online storage site, built by the guys at OVH. They are currently offering 30Gb free (if you use the link above) or if you pay, you get 110Gb (insted of the usual 100Gb) for EUR1 a month, or 10.5TB (yup… TERABYTES!) for EUR5 a month… Thats a crazy amount of storage for a not crazy amount of money!

So, while playing around with different things, I found they have an API, so other than the usual apps to play with (like the Hubic Apps for iPhone, Android, Windows Phone, Windows Desktop and OSX, Duplicity for backing up *nix boxes, and a few others) you can build your own…

But first, i needed to figure out how… So, after a lot of arsing around in Linux shells with curl i finally got some stuff working!

First, i used the Hubic sandbox to get the keys… its quite simple to walk though… this gets you your Access Token (see step 3). next, we need to get the Endpoint from Hubic: This GIST shows more:

Quick walkthough:

the first CURL request is to the HubiC API to get the credentials… this gives you a JSON response with a token and a endpoint URL aswell with an expire time…

The next request gets you a list of all files (or at least a load of files in my case) of whats in your folder. the default name here is my folder… I think its what everyone starts out with in HubiC… if you remove it, you will see all your top level folders.

next request i tried was to upload a file… the filename part is where you want it to be stored. this must exist on your local machine.

finally, downloading of a file… pass in the location of the file on the server (listing files will give you the location) and then -o in curl shows the output location…

Simples! now to get this working in c#… Full OpenStack Swift API is available to show how to do more… hopefully it will help in my C# coding…

Mobile Phone as a Service

After my post about the Raspberry Pi acting as a VoIP server, and being able to add a 3G Dongle and allowing it to act as a Mobile Phone gateway, it got me thinking… Why not have something that allows you to rent a mobile phone number in a country, send and recieve text messages, phone calls, etc, all from anywhere in the world? Thats where Mobile Phone as a Service comes in…

The theory behing MPaaS is quite simple: A SIM Card for a mobile phone is placed in a USB Dongle, plugged into a VoIP server (Asterisk box, probably a Raspberry Pi) and shared with the user who requests it.

Its only a theory at the moment… Any interest?

Raspberry Pi as an Asterisk Box

The Raspberry Pi is a pretty amazing peice of kit for its price and size. And now, you can make it even more amazing by using it as a VoIP server for your house!

Check out Raspberry Asterisk for downloads, documentation, etc, on how to setup a Raspberry Pi and Asterisk. I have a couple Pi’s in the house, and plan on setting this up in the next few days. Keep your eyes on the site… more posts coming!

Also, as an added bonus: You can now use a 3G/HSDPA modem to make and recieve calls using Asterisk and your Pi! Carrier Connect has details of how they setup a couple of Raspberry Pi devices in Germany and Cambodia and anyone ringing from Germany got redirected to Cambodia, with no noticable issue. Very cool stuff! Have to try this!

Double Bonous: Chan-Dongle (the software that you use to make and recieve calls with GSM) also allows the device to accept SMS messages!

College Bag Contents

Tomorrow, Monday the 28th January, 2013, will be the start of my final real Semester in College. I have been studying part time for the last 3 and a bit years, and tomorrow marks the begining of the end… Its the final REAL semester, meaning at the end of this i will have exams, but i wont be “finished” as such… I have a final semester from September to December where i hand up my final year project, which i plan on documenting here soon.

Anyway, thats a long way of saying that today, i have been working on the contents of my college bag: What do i bring with me to college…

well, here it is:

There is a lot in this photo, so you may want to click though to see the full size, but lets start, shall we:

  • Laptop: MacBook Pro, Late 2008, 8Gb RAM, 500GB Hybrid HDD
  • Phones: HTC Titan (Windows Phone 7.5, main phone), HTC One X (Android, backup phone), , HTC HD2 (Windows Phone 6.5/Android hack, test phone (VOIP Stuff)), iPhone 4 (iOS, Data Phone)
  • USB Keys: Multiple USB Keys ranging from small 4Gb sticks to fast 32Gb USB 3.0 Keys… total space: 140GB
  • HotSpot: Zoom Travle Router with Wireless-N connected to the iPhone to give me a wireless access point for up to 254 devices…
  • Power: Veho Pebble. enough power to charge both the iPhone and HotSpot at the same time (hotspot powers iPhone while its on, and the Pebble powers the hotspot). May replace it with something more powerfull eventually…
  • Mouse: Microsoft Arc Mouse. Small, light, foldable and works perfect for what i need it for.
  • Memory card Reader: Lexar Dual Slot USB 2.0 Memory Card Reader: this is very fast… Has UDMA support for faster CF and SD cards… Used mainly for reading memory cards from cameras, but given my project uses a Raspberry Pi, and i have 2 of these, one in my main bag is handy.
  • Camera: I carry my a Samsung Galaxy Camera with me at all times. This is my new years resolution and its something that i handy to have with me. Taking photos of notes, videos of lectures, etc, is handy…. and given its a full Android device, i can send and read emails, tweets, facebook, etc.
  • MISC: I have a small USB Hub pictured (no link, dont know where i got it). I also have all the required cables (iPhone, mini and micro usb, power, etc) and what ever else is needed to run the whole show…

I am hoping that if i manage to build the Ultimate Mobile HotSpot with a Raspberry Pi, I can get rid of a few things (mobile hotspot, battery charger, replace the iPhone with an iPod Touch) and maybe a lot of cables… Ideally, the Ultimate Mobile Hotspot should have enough power to charge other devices, and be charged while running also… but thats another post for another day…