mths : sdrbrg ;

# checking shell scripts on travis

Whenever I write shell scripts (usually in Bash) I find it a good practice to run shellcheck to make sure that I haven't done any obvious mistakes, such as forgetting to quote variables (which happens every now and then).

When I was tinkering with ddns-route53 I thought that it would be nice if Travis could run shellcheck for me. I had some trouble with getting shellcheck installed, but eventually found a solution after hopping through a bunch of GitHub issues (don't even know where I ended up).

The following .travis.yml should get you up and running in no time:

language: bash
sudo: required
dist: trusty
before_install:
  - echo "deb http://archive.ubuntu.com/ubuntu/ trusty-backports universe" | sudo tee -a /etc/apt/sources.list
  - sudo apt-get update -qq
  - sudo apt-get install shellcheck -y
script:
  - shellcheck <FILENAME>

<FILENAME> could also be replaced with a glob or something like $(find . -maxdepth 1 -type f -executable) if you have several files that needs to be checked.

Speaking of shell scripts, I sometimes find myself returning to Thoughtbot's The Unix Shell's Humble If blog post when I forget the how's and why's of constructing an if statement in Bash.

06 Jan 2016 / bash travis testing shellcheck

# dynamic dns using amazon route53

For the past ten months or so I've been using no-ip.com's Dynamic DNS service for my home server, and while it works just fine, it's rather annoying to have to go through a "confirm" process every 30 days.

Recently I ended up on Will Warren's blog, and more specifically this post and realized that I could do the same as I had moved this blog from GitHub pages to AWS S3 and in the process also moved over to Route53.

I couldn't resist a little hacking, so I extended Will's script and created a GitHub repo for it: ddns-route53. While a repo might be a bit overkill (could've just made the script a gist), I like repos as I usually find them easier to find and I could also add some light testing (running shellcheck on Travis).

Anyhow, If you already have a hosted zone setup using Route53, getting started is just a few commands away:

$ curl -sLO https://github.com/mthssdrbrg/ddns-route53/raw/master/ddns-route53
$ chmod +x ddns-route53
$ ./ddns-route53 --zone-id=<YOUR_ZONE_ID> --record-set=<YOUR_RECORD_SET>

It's also possible to specify an explicit IP with the --ip flag, which is convenient for running the script from another machine (I used it from my laptop during development for example), otherwise it'll look up the IP of your current machine using OpenDNS.

$ ./ddns-route53 --zone-id=<YOUR_ZONE_ID> --record-set=<YOUR_RECORD_SET> --ip=<EXPLICIT_IP>
05 Jan 2016 / aws dns route53

# neat github pages with bourbon and bitters

Several times during this past year I've thought to myself that maybe I should write a little something about problems that I encounter and solve when fiddling with things, or tools that I find useful, but never really got to it.

During the Christmas downtime I decided to make an attempt to create a small blog using Github Pages, as it seemed rather straight forward to get something up 'n running. I also wanted to try my luck (again) with the bourbon, neat, and bitters gems from thoughtbot.

Assuming you've got the github-pages gem installed and the basics already set up, the first step is to add the gems to your Gemfile, or just install them with gem if you're not using Bundler.

gem 'bitters'
gem 'neat'
gem 'bourbon'

Since GitHub runs jekyll with the --safe flag we'll need to install the stylesheets locally, which is done by running the following commands in the configured sass_dir (by default _sass):

$ bourbon install
$ neat install
$ bitters install

The last piece of the puzzle is to add some @import statements to our main SASS stylesheet, for example:

@import "bourbon/bourbon";
@import "base/base"; // bitters needs to be imported before neat
@import "neat/neat";

That's about it, now you should have a jekyll blog set up with bourbon, neat and bitters, ready to be customized to your liking. I'd start with looking into base/variables.scss and base/grid-settings.scss.

Given the "design" of this blog, using a grid framework and whatnot might seem a bit unnecessary, but I like experimenting with new toys and the best way, in my opinion, is to actually get something done.

28 Dec 2014 / github bourbon neat bitters