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.

Enabling WOL (Wake on Lan) in Ubuntu 16.10

To enable WOL support, first restart your system and enter the EFI firmware (also called the EFI "BIOS" as a misnomer!). I'm running Asus systems at home, and quite honestly, their new EFI UIs are pretty slick.

In any case, head over to Advanced > APM. In this view, Power On By PCI-E/PCI should be set to enabled. Couple examples of this view are shown below

Now restart your system once more and boot into Ubuntu.

In a terminal run sudo ethtool <interface> where you can find the correct interface via ifconfig -a — obviously pick the one showing the correct IP. At the bottom, you want this output to show Wake-on: g since this indicates wake on Magic Packet is enabled.

mdesilva@skylake:~ sudo ethtool enp0s31f6
[sudo] password for mdesilva:
Settings ...(continued)

Your Company’s Culture is Who You Hire, Fire, and Promote

I just stumbled on 'Your Company’s Culture is Who You Hire, Fire, and Promote' by Dr. Cameron Sepah, and found his thoughts and advice on values to assess during an interview to be excellent!

Not only that, but he also links to a fantastic spreadsheet for download covering Traits to Assess During an Interview.

The moment that leaders start weighing values-congruent against values-incongruent behavior, as if they balance out, is the moment when they have compromised their values.

This is most certainly a must read!

HOWTO Secure Docker & Prevent Leaking Access to Hackers

Docker needs to be configured to prevent leaking container ports to the outside world and there are two approaches, depending on your version of Ubuntu installed.

For sysvinit and upstart based systems, you can edit /etc/default/docker and change the docker options ENV var to DOCKER_OPTS="-r=false --iptables=false".

Since I'm using Ubuntu v16.x LTS running systemd I performed the following

$ mkdir /etc/systemd/system/docker.service.d
$ cat << EOF > /etc/systemd/system/docker.service.d/noiptables.conf
ExecStart=/usr/bin/docker daemon -H fd:// --iptables=false

$ service docker restart

Initially, nmap reported this port as open 6379/tcp open unknown, however, with the above service drop-in activated by restarting the docker service and ensuring ufw is active, this port is now shown as filtered (since ufw blocks all non-whitelisted inbound access) — ...(continued)

Twitter's Service Worker code, I just stumbled on it

Screen shot 2017 01 17 at 23.39.53

Well, twitter died on me and I was interested in some parts of the UI and went spelunking with Chrome dev tools.

Realised they were running service workers and here's the code in all its glory. I've linked to a Gist that also has the .coffee Coffeescript version.

Cookies and Session Management in NodeJS

Here's a snippet from a recent NodeJS app with Express



var session_secret = process.env.SESSION_SECRET;
  secret: session_secret,
  store: new RedisStore({
    port: 6379
  resave: true,
  saveUninitialized: true

 * Load current user from session.
app.use(function (req, res, next) {
  req.user = req.session.user;

   * Help troubleshoot cookies
  // if (app.get('env') === 'development') {
  //   console.log('Session ID: ', req.sessionID);
  //   console.log('Cookies: ', req.cookies);
  //   console.log(req.session.cookie);
  // }

  // if (app.get('env') === 'development') {
  //   console.log('Logged in user set as ', req.user);
  // }

  return next();

Uncommenting the troubleshooting middleware, yields the following debug info. Notice how the session ID is stored by way as part of the cookie sid. The [format used is `[sid].[signa ...(continued)

Rapid Learning: Google App Engine (GAE) Cloud Apps (in Python)

I like to look at new technologies (at least new to me, in the sense that I haven't tinkered with something directly or long enough — and long enough usually equates to at least one to two years) and YouTube is a fantastic resource, especially channels such as the excellent Google Chrome Developers.

This is a very short series where Paul Lewis provides a walk through on how he goes about to build the Chrome Dev Summit site — what's great is this is full of great advances such as Service Workers a la Polymer and so many other fun stuff.

What's interesting though, is there are some valuable frontend juju that Paul uses, that I haven't seen (or thought of!) before, especially some fantastic use of SVG and clip-path.

For the purposes of this blog post, and for my initial poking about, and given that I haven't had ti ...(continued)

Extending nvie's Successful Git Branching Model

Recently I've been working on a project where certain devs are not privvy to client-specific details, and this aspect has lead to a rather interesting build workflow.

As such, devs are only able to build debug specific Android releases, and release type releases for debugging purposes. However, actual release-builds require certain changes to the specific app Gradle config, and this is why I am maintaining a dedicated release branch alongside dev. It should be noted, that the release branch was infact a fork of dev.

This workflow is based on the excellent Successful Git branching Model by nvie and cutting a release has a couple extra steps.

-> % git co dev
-> % git co -b release-0.1.7
Switched to a new branch 'release-0.1.7'

-> % mvim CHANGELOG.md

-> % git st
## release-0.1.7
M  MyApp/app/build.gradle

-> % git c "Bump version for release"
[release-0.1.7 0 ...(continued)

Instrumenting Android UI with Espresso and AndroidJUnitRunner

August 2016, and I cannot believe the number of hoops I had to jump through, and several hours of Googling just to be able to Setup Espresso in Android Studio.

The bit that I needed was to perform a certain exclusion,

androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support.test:rules:0.5'
androidTestCompile 'com.android.support:support-annotations:24.2.0'
androidTestCompile ('com.android.support.test.espresso:espresso-contrib:2.0') {
    exclude group: 'com.android.support', module: 'support-v4'

Works great with an API 23 app I'm working on for a client. Just make sure that you add testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" into your app/build.gradle's defaultConfig block.

First CryptedIoT Dev Boards (PCBs)

The very first boards have arrived and they are looking rather purdy...

Looking to the Future

Some may wonder as to the drastic drop in blog posts over the past couple months but it's due to my being far more engaged with both work, family, and life in general.

I've been able to take time out from my work as a Consultant and spent a glorious get away at Peace Haven Anantara in Tangalle, Sri Lanka (second time around) availing all the delights of both private butler service and our very own private villa and plunge pool as well as spending around 3-nights at the newly opened Shangri-La resort in Hambantota, as well as catching up with family visiting us from Switzerland.

This time has allowed me to reflect on my past achievements, strengths and weaknesses, areas for improvement and generally where I want to take my career over the next 10 years. It's similar to how in most interviews, you get tossed that eventual question of "Where do you see yourself in the next 10-years?" — well that is what I've been asking myself as well.

My work with global brands s ...(continued)

Post Archive