Online TOML to JSON converter

toml2json

A simple tool based on Ricardo Tomasi’s toml.js for converting TOML to JSON in your browser.

Check it out at toml-to-json.matiaskorhonen.fi

TOML (Tom’s Obvious, Minimal Language) aims to be a minimal configuration file format that’s easy to read due to obvious semantics. TOML is designed to map unambiguously to a hash table. TOML should be easy to parse into data structures in a wide variety of languages.

matiaskorhonen.fi redesign

matiaskorhonen.fi redesign

My redesigned homepage

I just published a redesign of my home page, matiaskorhonen.fi

There might still be some issues, especially on mobile browsers, but overall I’m fairly happy with how it turned out.

(geek aside: It’s a static HTML site, but it’s served with Puma running on Rubinius 2)

Speed up Travis CI builds by caching the bundle to S3

When we run our build suites on Travis Pro the bundling step takes the most time by a wide margin (aside from the test script itself).

Inspired by this Coderwall protip by Michał Czyż, I set about attempting to cache our completed gem bundle on S3.

Update: Checkout the bundle_cache gem for an improved version of this technique


How it works

  1. The tarballed bundle and a SHA-2 sum of the Gemfile.lock are downloaded from S3 (if they exist)
  2. Travis runs bundle install as normal (except that the bundle is installed to ~/.bundle). This shouldn’t take more than a few seconds if the bundle hasn’t changed.
  3. Travis executes all the normal build steps, as usual
  4. The bundle is tarballed and uploaded to S3 (us-east is the closest region to the new Travis workers), but only if the SHA-2 hash for the Gemfile.lock has changed

The bundle is uploaded with public-read permissions for easier downloading. This should not be a problem for most people and could be mitigated by using a really obscure filename, like a UUID.

Step by step instruction

  1. Set up a bucket on S3 in the US Standard region (us-east-1) (and possibly a new user via IAM)
  2. Install the travis gem with gem install travis
  3. Log into Travis with travis login --auto (from inside your project respository directory)
  4. Encrypt your S3 credentials with: travis encrypt AWS_S3_KEY="" AWS_S3_SECRET="" --add (be sure to add your actual credentials inside the double quotes)
  5. Add the bundle_cache.rb and bundle_install.sh files from below to the script/travis folder
  6. Modify your .travis.yml file to match the .travis.yml below
  • The BUNDLE_ARCHIVE variable will be used as the base for the uploaded bundle’s name
  • Setting AWS_S3_REGION is optional and defaults to us-east-1
  • Pay special attention to these keys:
    • bundler_args
    • env.global
    • before_install
    • after_script

If you have any questions or comments, you can comment on my gist, or tweet at me on Twitter.

Can't AirPlay from OS X?

Sound preference pane

Sometimes OS X will flatly refuse to change the audio output to an AirPlay outlet, such as an Apple TV or Airport Express (with no visible error message).

When this happens I’ve found that killing the CoreAudio daemon (coreaudiod) helps (OS X will automatically restart it).

Simply run this command in Terminal:

sudo pkill coreaudiod

AirPlay should work again a few moments later.

Extremely thin console.log wrapper

Mostly useful for ensuring that Browsers which don’t have console.log enabled by default (i.e. Internet Explorer) don’t explode if you forget to remove a console.log from your JavaScripts.

How to clear the DNS cache on OS X Mountain Lion

OS X Mountain Lion

In OS X Mountain Lion (10.8) and Lion (10.7) to clear the DNS cache you should run:

sudo killall -HUP mDNSResponder

And not the older command that worked in Leopard (10.5) and Snow Leopard (10.6):

sudo dscacheutil -flushcache

See also: Alfred 2 Workflow: Clear OS X DNS Cache

Alfred 2 Workflow: Toggle Tunlr

Alfred 2 Workflow: Toggle Tunlr

My Toggle Tunlr Alfred extension updated to an Alfed v2 workflow.

This script (still) naïvely assumes that you are using a Wi-Fi network and that you normally don’t have any DNS servers manually set.

There are four command available:

  • tunlr — toggle Tunlr on and off
  • tunlr on — explicitly set the Tunlr servers
  • tunlr off — explicitly unset the Tunlr servers
  • tunlr status — check what the current DNS settings are

Download: Toggle-Tunlr.alfredworkflow

Tunlr lets you stream content from sites like Netflix, Hulu, MTV, CBS, ABC, Pandora and more to your Mac or PC. Want to watch Netflix or HuluPlus on your iPad, AppleTV or XBox 360 even though you’re not in the U.S.? Tunlr lets you do this.

Alfred 2 Workflow: Repair LaunchServices

Alfred 2 Workflow: Send to iPhone

UPDATE (09.05.2013): Instead of using this, you should probably get the official workflow from here.


Send to iPhone

This updates the “old” myPhoneDesktop for Alfred App Extension to work with Alfred v2. The main script is from the Alfred v1 extension, and has not been modified at all.

For a full guide of how to use this extension, read this post about the original Alfred extension: myPhoneDesktop for Alfred App Extension

Note: I am not affiliated with the original author of the extension nor with myPhoneDesktop. I just needed this for myself.

Download: Send-to-iPhone.alfredworkflow

Alfred 2 Workflow: Airplay via Beamer