Michael de Silva's Blog

Software Engineer. Rubyist and Roboticist.

Michael de Silva's Blog

Software Engineer. Rubyist and Roboticist.

Got an app in mind?

Since 2010, I have crafted apps for mobile and web for clients around the world via my consultancy — Inertialbox. My specialities include Rails, client-side Javascript frameworks such as Backbone & Ember.js, TDD/BDD, and DevOps — just to name a few.

We should talk.

Why Constant Learners All Embrace the 5-Hour Rule

Benjamin Franklin did this one hour a day, 5 hours a week. Why you should do it too.

At the age of 10, Benjamin Franklin left formal schooling to become an apprentice to his father. As a teenager, he showed no particular talent or aptitude aside from his love of books.

When he died a little over half a century later, he was America's most respected statesman, its most famous inventor, a prolific author, and a successful entrepreneur.

What happened between these two points to cause such a meteoric rise?

Underlying the answer to this question is a success strategy for life that we can all use, and increasingly must use.

The 5-Hour Rule 

Throughout Ben Franklin's adult life, he consistently invested roughly an hour a day in deliberate learning. I call this Franklin's 5-hour rule; 1 hour a day on every weekday.

Franklin's learning time consisted of:

  • Waking up early to read and write.
  • [Setting personal growth goals](h ...(continued)

CAP and Concurrency with Multiple Worker Processes

Anyone who's played with distributed systems knows the kind of pain one would end up with. There's mutex/transaction locking, pessimistic locking, and then there's the joy of dealing with multiple concurrent workers, running jobs asynchronously

Having played with Searchkick I stumbled on an interesting discussiong on race conditions which ultimately led me to 'Preventing Race Conditions With Fencing Tokens In Rails'.

And if you haven't heard of it before, this falls under CAP theorem.

Thankfully a friend of mine was to the rescue regarding a particular usecase of mine with,

Multiple workers can't get into a split-brain if they're all talking t ...(continued)

You can get US$200 for FREE from Amazon. Cold hard cash.

Here's how you can make some free cash, if you're living in the US.

First, go order an Amazon Fire TV Stick for $39.99 (use free shipping of course!). Now, order 2x units of Amazon Echo Dot = $179.99 outlay.

Sell it sealed on eBay as an auction - look at the past auctions. These go for $160-190 each!

You're set to basically make ~$120 or more if you keep the Fire stick. Otherwise, you can turn a profit of $160-$200 quite easily. Just return that Fire stick.

Using BrowserSync and Gulp with the Rails Asset Pipeline

I have detailed this approach in a simple gist which allows you to run BrowserSync along side a Rails app and its asset pipeline quite nicely — I have tested with a Rails 5 app that I'm currently working on for a client.

A while back I created a Yeoman Foundation Generator that included BrowserSync and getting a similar work-flow for Rails has been on my TODO list. For the longest time, I've relied on Rack::LiveReload and guard-livereload, which has its downsides — as CSS injection doesn't always work, and the browser takes a while reloading.

You simply need to add in the gulpfile.js as detailed below and make sure you install dependencies via npm install -g npm and npm install --save-dev gulp browser-sync. If you're already injecting Rack::LiveReload into your app middleware, stop doing that and you'll be set!

<script ...(continued)

HOWTO: Providing Clients with an IAM Account to Manage Billing & Payment Methods for their Root AWS Account

Pay credit card online

Start by heading to the IAM management console within your AWS console, and head to Policies. Create a policy and name it ViewAndManageBilling.

Use the policy document provided below to configure this policy.

    "Version": "2012-10-17",
    "Statement": [
            "Sid": "Stmt1460354930000",
            "Effect": "Allow",
            "Action": [
            "Resource": [
            "Effect": "Deny",
            "Action": "aws-portal:*Account",
            "Resource": "*"

Create a group called 'Billing' in Groups and now you can create your client IAM accounts and assign them to the Billing group. It's a good idea to log-in and confirm e ...(continued)

Sneak Peak: Building a Ruby Gem to Provision Amazon AWS Services

Here's a quick demo of a Ruby gem that I'm in the process of designing, well at least its internal DSL, wrapping around the excellent aws-sdk gem by AWS.

I wanted to take a dependency based approach rather than resorting to Cloud Formation, which ultimately is a visual 'wrapper' around the AWS APIs — this could easily be achieved in other languages such as Python or even with a bunch of bash scripts.

However, as a Rubyist, I wanted to take the 'gem' approach, as this would allow me to integrate this into other apps, i.e. I could create an inertialbox internal dashboard type app, or even route calls through to an iOS app — potentially far fetched considering the amount of polish and time it would take to go that far, but at least, this serves as the initial groun ...(continued)

Feeling Refreshed, Back from Taking Time Off (April 2016)

I have been coding full-time for the past 6-years, straight with very little 'down time' or gaps in my resume. Everytime I've finished working with a client, I've transitioned into a new project with a new team.

In terms of building experience, it has been great and my newly deployed resume at http://desilva.io shows it. Just this week I had a couple interviews, having gained attention on Twitter that I'm now looking for work — and recognition of my past work is rather rewarding.

Whilst looking forward to the next project I take on, I have some plans for making some improvements to my AWS deployments, and those details will serve for a future blog post.

Cheap SSL & Domain Registration with Amazon AWS Route 53 & Certificate Manager

Screen shot 2016 02 09 at 06.43.10

By the end of July 2015 Amazon made the following announcement — Amazon Route 53 Announces Domain Name Registration, Geo Routing, and Lower Pricing, which at the time didn't really feel like much.

Fast forward to 2016 and consider that I was shopping for a .io domain. Godaddy wanted $59.99 although Gandi were tad cheaper (although I hadn't realised, this was interesting!).

I didn't want to have to manage a second DNS registrar explicitly, and decided to chalk up the extra 2-dollars or thereabouts and register my shiny new desilva.io domain with AWS itself (Amazon Route 53 Pricing for Domain Registration). The process took under 2 minutes, where I had to fill in a form with my registrant details. But oh, was I in for a ...(continued)

How To Set Up A Slack Channel As An AWS SNS Subscriber

I wanted to receive error notification when my ec2 instances CloudWatch metric passes a set threshold and as such was looking for a means to get notification sent to Slack, as a means to avoid the general noise in email notifications.

To this end I discovered "How To Set Up A Slack Channel To Be An AWS SNS Subscriber" which is easily adaptable via SNS itself.

Having tested the Node Lambda function, don't forget to ensure that you subscribe the Lambda function to the SNS topic. When done correctly, within AWS' console > SNS > Subscriptions you should see details of the lambda function specified with a Subscription ID and protocol as lambda.

Recover Hidden Files and Folders with TIme Machine in Mac OS X

Having inadvertently run rm -rf ~/.foo whilst connected in via my laptop, I needed to restore that folder back via Time Machine.

Here are the steps I took to get it back,

  1. Renamed the folder as mv ~/.foo ~/_foo so that it is no longer hidden, and I can delete it manually — this was only needed as some files within this folder were being accessed by my irssi client at the time; so you may not have to do this.

  2. Run defaults write com.apple.finder AppleShowAllFiles YES and killall Finder.

  3. Run Time Machine, pick the folder you want to replace. BOOM!

  4. Run defaults write com.apple.finder AppleShowAllFiles NO and killall Finder.

Note: Notice that finder is explicitly Finder in the commands above!

Easy peasy.

ECMAScript6 Compatible Yeoman Foundation SASS Generator with Browserify & BrowserSync Live Reloading & CSS DOM Injection

Screen shot 2016 01 17 at 22.19.11

At the time of writing, I had stumbled onto the foundation-gulp-browserify Yeoman generator and within a couple hours I had a really slick static page live & hosted on AWS S3.

However, I noticed this generator, like most of the Yeoman generators, has gotten old and doesn't seem to be actively maintained any more.

It has 19 Github stars and the last commit was on 1st December 2015. Interestingly, the last commit reads

reverted to foundation 5.5.2. Foundation scss folder structure has changed and will require more reworking than I initially thought

Having used Gulp before, I really liked how it got the job done; dependencies were fixed with a simple npm install, but what really sold me were two things.


If you've tried to get pixel-perfection in responsive designs without BrowserSync you will understand the level of frustra ...(continued)

Post Archive