One click deploy and rollback From shell

Heres how I auto deploy my app, and how i roll back if something goes wrong. sh scripts/deploy.sh deploy sh scripts/deploy.sh deploy rollback It couldnt be easier. #!/bin/bash TARGET=example.com TARGET_BASE=/var/www/p TARGET_ARCHIVE=$TARGET_BASE/analyse.tgz TARGET_LOCATION=$TARGET_BASE/analyse case "$1" in deploy) echo "building" yeoman build if [ ! -d dist ]; then echo "yeoman didnt build" exit 1 fi cd dist tar -czf ../dist.tgz * cd .. echo "backing up" ssh $TARGET << EOF...

January 20, 2013 ¬∑ 1 min ¬∑ Stephen Nancekivell

Dont make me think!

Part of my app requires extracting a date from the line of text. To do this I use a regular expression to pick the substring that has the date, then use a date format to parse it. Heres a screen shot my first version of getting that information. The user inputs both the regex and the date format. After a while it became clear to me that the regex could be derived from the date format....

January 20, 2013 ¬∑ 1 min ¬∑ Stephen Nancekivell

e2e testing in angular.js with a mocked httpBackend

Angular.js is a great framework used to make web apps, by manipulating the DOM and integrating with a rest backend. Edit: You should use ngMockE2E rather than the technique described bellow. They are verry similar. ngMockE2E is the more supported. An Example of using can be found github.com/~~/angular_e2e_http/tree/ngMockE2E An Angular.js app has 3 main parts. *  html where additional markup is used to populate a template with data. * The controller's which control the templates and the services....

September 12, 2012 ¬∑ 2 min ¬∑ Stephen Nancekivell

Earthquake Data

I was in my first big earthquake the other day. Being my first I didn't know if it felt like a big one or not. I jumped on geonet.org.nz looking for the answer. GeoNet have this awesome heat map of earthquakes around NZ I thought it'd be cool to make a video of it. To show how that changed over time. So I did. Unfortunately I've only got the aftermath. But I'm sussed to make cool videos next time....

July 5, 2012 ¬∑ 1 min ¬∑ Stephen Nancekivell

How 2degrees messed up their website

When on a small screen, the 2degrees site puts some of the content to the left of screen where you can‚Äôt see or click it. I noticed this on my smart phone when trying to top up. Here what It looks like on my desktop. Notice the important ‚ÄúTop Up‚ÄĚ button in the navigation menu on the left. This cannot be clicked on my phone. The web page is made with a main div that is the first thing in the body of the html who‚Äôs job is to center the content....

June 9, 2012 ¬∑ 2 min ¬∑ Stephen Nancekivell

Working Hours Graph - Life Logger

I’ve been using Life Logger to track how long I spend at work. It has a pretty rudimentary way to get summaries from it. I wanted to see a graph of how long I’ve spent at work in a graph so I exported the database and made my own. Here’s what I Came Up With. If my boss sees this, its all those public holidays that bring those hours down....

May 23, 2012 ¬∑ 2 min ¬∑ Stephen Nancekivell

Ubuntu updates visualization

I was wondering if there would be lots of updates to Ubuntu leading up to the release of 11/4 and thought I could data mine this to find out. So I made a visualization to see if that was the case, turns out the opposite is true. There has been a distinct lack of updates in the last couple of months. At least in the main repository. Heres the visualization I made....

May 6, 2012 ¬∑ 2 min ¬∑ Stephen Nancekivell

Problem with corrupt files and eCrypt

I've been noticing some strange behaviour on my Ubuntu laptop lately. In Google Chrome I get logged out whenever I close the browser, even though set it to remember me. I've also seen a lot of these log messages from eCryptfs which encrypts my home directory. Apr 14 10:29:41 stephen-ThinkPad-T520 kernel: [170037.012495] Valid eCryptfs headers not found in file header region or xattr region, inode 524280 Apr 14 10:29:41 stephen-ThinkPad-T520 kernel: [170037....

April 14, 2012 ¬∑ 2 min ¬∑ Stephen Nancekivell

How to find an open source project to work on using github search.

You can search for popular projects that have TODO notes in the source code To search for popular projects execute this search query for repositories. followers:[1 TO *] followers:[1 TO *] If you judge popularity by the number of followers. To search for the TODO notes in that repo execute this search query for code. TODO repo:django/django Because the code is indexed differently to the repository there is no direct relationship from the code to the repositories followers....

March 8, 2012 ¬∑ 1 min ¬∑ Stephen Nancekivell

Router bandwidth usage monitoring per user

My flat has a shared internet connection, and we have a bandwidth cap, If we go over our cap it costs us all extra money. There's this great little script wrtbwmon for DD-WRT that shows total bandwidth usage. There are other projects that do a nicer job but they require different router firmware, that doesn't support my router. The main imitation of Wrtbwmon is that it doesn't show how usage is changing over time. If someone suddenly uses lots of our bandwidth cap I need to be able to tell them when it was....

January 21, 2012 ¬∑ 1 min ¬∑ Stephen Nancekivell

Concordion acceptance tests from Scala

Concordion is a great test automation framework written in Java. Scala is a great functional programming language which runs on the JVM. Scala can easily use Java code, which makes using Concordion from Scala very simple. However there was one feature of Concordion that gave us some trouble. Java Concordion fixtures can return objects with public variables that Concordion can use to make assertions. But in Scala you cant really create public class variables. Scala creates public getter and setter methods with the name of the variable and keeps the variable private....

January 18, 2012 ¬∑ 2 min ¬∑ Stephen Nancekivell

What should a Distributed Operating System should look like and how close are we to making one

Overview - A Distributed Operating SystemA Distributed operating system is a system that operates a distributed collection of computers, a cluster. Some require a single controller, but that shouldn't be necessary and isn't an interesting part of the problem. The system runs programmes and manages resources. The system should completely abstract the view of the hardware away from the software. Fault tolerance, scalability and redundancyThe cluster may be heterogeneous, nodes may go offline, new nodes may come online....

September 19, 2011 ¬∑ 9 min ¬∑ Stephen Nancekivell

Server updates: Automate it!

A Ubuntu automatic update script with email notifications. We all know that we should keep our systems up to date with security patches and whatnot. This is something that we don't thing about on desktop computers, our operating systems (windows/ubuntu) do it automatically for us, giving us popup notifications when these are ready. But on servers we never log in to get those notifications, as long as things keep running we don't care. You may get hacked one day and become extra vigilant for a while, but that's not going to last, were all lazy....

July 28, 2011 ¬∑ 1 min ¬∑ Stephen Nancekivell

Document Browsing and Comparison

I've been looking at ways to organize a document set. Im particularly interested in comparing and clustering documents based on their content. In these experiments a test set of Wikipedia documents, most of the documents come from a keyword search about fish with some random ones to mix it up. For comparing these documents I’ve used the categories taken from wikipedia and mined the important words. Each document can belong to multiple categories....

June 21, 2011 ¬∑ 5 min ¬∑ Stephen Nancekivell

Bike Pics Wallpaper Android app

Well i did it again, i made another android app. Check it out in the market "Bike Pics Wallpaper".I should probably come up with better names :( oh well, no surprises as to what it does. It gets a wallpaper from bikepics.com and automatically sets it as the phone wallpaper. Should be kinda fun. I'm hoping that because motorbikes are cool all over the world this will be more popular than my other apps :)I timed how long it took me to code, 10....

November 28, 2010 ¬∑ 2 min ¬∑ Stephen Nancekivell

TM Watcher Android app

TM Watcher for Trademe.co.nzTM Watcher checks auctions in your Trademe watchlist to see when any of their attributes change, then notify the user. This includes attributes like bid price, end date.--I've put alot more polish into this than ODW, it feels good. I figured out how to have it run something at boot, which has the effect of greatly simplifying the user controls improving the user experience, compared to that of ODW....

November 14, 2010 ¬∑ 1 min ¬∑ Stephen Nancekivell

One Day Watcher Android app

I finished/published version 1.0 of my first android app today. One Day Watcher.This app automatically checks 1-day.co.nz for you, so you dont have to. It checks for keywords that you set, and gives you notification with the results.Check it out at http://code.google.com/p/one-day-watcher/or search for it on the Android Market.It'll be interesting to see if many people find it useful.

October 8, 2010 ¬∑ 1 min ¬∑ Stephen Nancekivell

mv with progress bar!

Well not quite use rsync with a quick alias. Countless times have i thought this would be nice, and now i have it :) alias rsynccopy="rsync --partial --progress --append -r"alias rsyncmove="rsync --partial --progress --append --remove-sent-files -r"

September 28, 2010 ¬∑ 1 min ¬∑ Stephen Nancekivell

How to restore your nexus one with the original shipping roms then update to 2.2.1

This will remove everything off your device, except stuff on the sd-card. I take no responsibility if you somehow brick the it ;). You will end up running 2.2.1 unrooted. This was written for the at&t nexus one. Im not sure if there are any differences for the other one. You should be able to give this a go, and if the radio doesnt work with this stuff, you can always find the right stuff and re flash it....

September 28, 2010 ¬∑ 2 min ¬∑ Stephen Nancekivell

Ext3 file fragmentation on my server

So I've got this file server/torrent box running raid 5 with 5 discs ATM, but i  can add more disks to it when it gets full and have been doing so for the last year. Lately we've been noticing terrible performance from it, like browsing a folder (over samba) could take about 30 seconds to load. Looking into this i found that the files being downloaded slowly by the torrents are getting terribly fragmented,  like, from filefrag...

June 27, 2010 ¬∑ 4 min ¬∑ Stephen Nancekivell