Martin Ström

Add Google Apps MX records to a Loopia domain

Photo Hack Day Berlin 2012

Photo Hack Day brings the most innovative developers and designers to Berlin to hack the future of photography. The goal of the event is to rapidly prototype and build new projects, powering through the night to present a finished product Sunday afternoon.

I was already in Berlin so Erik and Ruben flew here — and brought the whole InstaCRT machine with them from Stockholm on the flight. We set up the machine on site at the hack day so people outside our studio could see it IRL for the first time.

As for the hack, I combined my work with Loopcam and InstaCRT and built an iPhone app called LoopCRT. It uses the soon-to-be-released Loopcam API and lets you filter Loopcam loops through the InstaCRT filter machine — frame by frame.

The judges seem to like my project too and gave me a honorable mention. ヾ(@⌒ー⌒@)ノ


Beforecast by Peter Ström and myself.

Ruby on Rails, UTF-8 & Heroku

I’m in the middle of moving some sites over from a self hosting VPS to Heroku and had some problems with the text encodings. Everything worked fine on the old site and on my local machine, but after a heroku db:push (copying my local MySQL database to Heroku’s Postgres), all special UTF-8 characters were not displaying correctly.

After some googling and some testing I found this solution (that is, make sure Rails and MySQL is all UTF-8), but it wasn’t enough to properly import the old data. After more googling, this worked for me:


OH HAI! go to!

ZOMG Update I
InstaCRT is released in the AppStore (and beeing featured everywhere!) ^__^. Read more!

ZOMG Update II 2012-11-18
InstaCRT with color support was just released! Read more on how it works! ♥‿♥

This project started as an idea to see how a “real world” filter for photos (like the popular Histamatic and Instagram apps) would work, except our filter is actually real and not digitally applied.

When I joined the project, Ruben Broman and Erik Wåhlström were more or less already done connecting all the hardware and had the screen working as a regular external screen connected to his old laptop. The same night I hacked together a funny looking Ruby script that fetched images from a ftp server, downloaded them and showed them in fullscren on the old CRT display while a Canon 7D took the photo. We managed to get it up and running the same night and even had time to throw together a quick iPhone application that uploads the photos to the ftp server. This early version of the project used the Ruby script, Image Capture (built into OS X) and QuickTime 7 to display the photo in fullscreen on the little display. The day after I added a Tumblr uploader so the photos get published on the blog.

This worked but was very instable so all code was rewritten within the first week it was up and running, mostly for stability but also seperated into different smaller scripts to they could run asyncronysly. We replaced QuickTime with a Quartz Composer project that allowed images to be displayed in fullscreen while not beeing the forground application, and replaced Image Capture with the command line tool GPhoto. Everything was still controlled by Ruby scripts but, as written above, seperated into three smaller classes/files so they could work in parallel, with a main deamon file using Forever The ftp server was replaced with a smarter REST based server to handle the uploading, downloading and archiving of the images.

The iPhone app was also rewritten from scratch to be cleaner and smarter. As of today, about 30 people have the beta (distributed using awesome Testflight).

Except for some smaller tweaks, the current version of the project has been up and running for about a month without restart nor crash so I would say it’s pretty stable now. We haven’t really decided exactly what to do with the project right now. We might release the app to the public and keep it going for as long as it’s possible, or just see InstaCRT as a fun hack.

Haxxor night

I’m building a pretty cool little project with Ruben right now. More info soon here!


The TwitterFax is a small project done together with Konst & Teknik. It will watch a given Twitter username for mentions and then print it, together with any twitpics or yimg images attached to it.

The code is pretty simple and uses the Twitter gem for communicating with Twitter and Prawn to genereate the PDF’s. I’ve set it up to run every 15 minute using a Cron job.

Check out the full source code. You’ll need to change what typeface to use or get LucidFaxEFRom.ttf from somewhere else.

So go ahead and mention @konst_teknik to try it out!

Push notifications for Things Touch (iPhone/iOS) using Prowl

While waiting for Things Touch to officially support push notifications I hacked my own solution based on Prowl and my own Ruby library for Things, things-rb.


  1. I’ve setup Dropbox to share my Things database betweeen my laptop and a computer at home which is always online.

  2. Buy and install Prowl on your iOS device.

  3. On the home computer/server, install things-rb:

    $ (sudo) gem update --system # if you're on an older RubyGems version
    $ (sudo) gem install things-rb

  4. ..and the prowl gem to talk to the Prowl API

    $ (sudo) gem install prowl

  5. Save this file somewhere (like ~/bin/prowl_things.rb)

  6. Setup a cronjob to run the script as often as you’d like. Mine runs every weekday at 8:45 am.

    45 8 * * 1-5 /usr/bin/ruby /Users/me/bin/prowl_things.rb

Download torrent files from Twitter DMs

Here’s a simple ruby script to download torrent files in Safari sent to you/an account as URLs in Twitter direct messages.

It could be used on your home server to download torrent files you send to it from something like your iPad.

I’ve set it up to run every fifth minute (using cron) to check for new files, but can of course be adjusted to something that works for you.

Also, make sure to point Safari’s download folder (in Safari’s preferences) to the same folder as you have Transmission automatically watch for .torrent files so the download actually starts.

Paperclip processor to turn images into grayscale

We wanted to automatically create a grayscale version of the uploaded images for a current project. Here’s the Paperclip processor we’re using:


Last week I hacked together a small little project/library called nordea-rb. It’s a Ruby library and a (pretty basic right now) command line tool for getting read-only access to Nordea Bank accounts. I use it for displaying my accounts’ balances so I can see when invoices are paid etc.

Everything you need to know is in the README on GitHub so if you’re interested in this, check it out.

things-rb—command line tool and Ruby library for

Things + GeekTool

I wanted to display my ToDos from Things on the Desktop using GeekTool so I created a command line tool in Ruby (backed by a library) to access the database.

This way you can see what needs to be done but without switching (or even launching Things)

It’s in a pretty early state right now and probably has bugs but I’ve been using it for some days now without problems. I’m planning to add write-support as well (so you can create tasks from the command line if Things isn’t running) but right now it’s read-only.

For more information, check out the README file and source on GitHub or this thread on the Things’ forum

./script/server with automatic port finder

This is the script I’m using when I start my local Rails development server. It will automatically detect the next available port starting at the default port 3000 so I can have multiple servers running without remembering what ports that are already busy.

#!/usr/bin/env ruby


puts (`ps aux | grep [r]uby | grep script/server`.split("\n").map { |l|
  server = l.split(/\s+/)[11..-1]
  (port = server.index('-p')) ? server[].to_i : DEFAULT_PORT
}.max || DEFAULT_PORT - 1).next

I aliased it to ss in .bash_profile like this:

alias ss='./script/server -p `~/bin/available_rails_port`'

(Btw, Happy 2008! I haven’t updated this site for a while)

Modernize Rails (or: get rid of Verdana)


Tired of see the the soooo 1999-ish font “Verdana” every time you get a local error page in Rails?
Now you don’t have to. With this plugin the error pages will use Arial or Helvetica instead—finally!

To install:
./script/plugin install

or as svn:external:

./script/plugin install -x

I’ve moved to git so the new instructions are:

git clone git://

or just braid it

Happy new year!

OmniFocus to iPhone bookmark exporter

Since the iPhone lacks the possibility to export tasks from iCal I made hack/script to export all tasks from OmniFocus to a Safari bookmark and therefore be syncable with Safari.

Read more in the OmniGroup forums and/or download the latest version here.

Update: On request, here are some screenshots of how the todo list looks like:


Konst & Teknik site

Konst & Teknik website

My friends over at Konst & Teknik asked me to code their web site. It’s only one page, that should show the results from Google Image searches for the word in their name, “konst” and “teknik” (“art” and “technology” in swedish). I liked the idea and also got the opportunity to do some ruby scripting and try the Prototype JavaScript library.

Server side

Since Google currently doesn’t offer any API to do other searches than pure web searches and we wanted to use Google Image Search, I had to do my own image fetching script. The script is a ruby script that will pull the images and info from Google Images and store them in a local index file. First, I used Net::HTTP but I found out that it had problem dealing with the swedish characters (used in swedish, ie åäö) so I changed the URL-fetching to use curl instead, witch also was slightly faster. The index is written from ruby using Marshal. It is scheduled to run twice a week using cron.

Client side

My first approach was to make one class that downloads and shows the image for the given keyword. Then create one instance for each word (konst and teknik), controlling the preloading and image-switching every 4th second (meaning; updating one of the images every second second). But I found out it was hard to make the updates smooth and exacly on time.

Instead I split the client side script into of two main classes, the Preloader class and the Switcher class. The Preloader triggers a request using AJAX to a server side ruby script that will return a new random image from the image index and then stores the info received from the server in a local array. After some delay the script will start over again with a new request for another image. When the Preloader is done indexing some images then the Switcher will kick in and start showing them and switch every other second between the images for each word as long as there are images preloaded and ready to be shown. If the Preloader is out of preloaded images then the Switcher will pause and show a loader while the Preloader’s buffering. We wanted the images to be vertical aligned by bottom but I couldn’t make it work with CSS only (nor with vertical-align, float or position). Instead, the script is switching between two <div>s (for each word, totally four divs) and when the “not active” div got a new image loaded into it, it will find its dimensions and set its margins automatically. The next time it’s time to switch image (for this word) this div will be shown instead, the other one becomes invisible and get the next image loaded.

The script should work fine in Safari, Firefox, Camino etc (even WinIE6). It needs some code cleaning (mostly OO-issues; currently I’m referencing the instances from the class, which I think is a bit ugly) but I’m releasing it anyway.

Check it out

Colhour as iChat picture 2.0

This is the second version of the Colhour as iChat picture I posted the other day. The biggest improvment is that it will show both the hours and the minutes.

There’re two versions of the script. The first one uses a Ruby script together with RMagick to create every image on the fly with the current time. But since it requires some installation of Ruby gems and other libraries, I decided to make a version with all 1440 images pregenerated (created with a small Ruby script of course) so you wont need to install the other libraries. The AppleScript still uses some Ruby, but it’s included in OS X, and should (at least) work on a basic OS X 10.4 Tiger installation. Let me know otherwise.

Instructions on how to set up a cron job to run the script every minute is in the previous post. Both the on-the-fly generated version (update-gen.scpt) and the pregenerated version (update-pregen.scpt) are included in the zip file.

CSS is in progress