Site specific chrome launcher's on OSX

Posted: 2014-04-02 | chrome | osx

I was looking for a chrome based site specific browser (SSB) for mac. This is similar to but chrome based.

I ended up using the shell script - I used the version from this gist - which I’ve also linked locally:

You simply run the script - give it a name (no spaces), a URL and an icon and it will create an app in /Applications.

It seems to create a profile per app too - so I can e.g. have two different yammer app’s that login to different accounts. This is useful but it does mean that you won’t have your normal plugins/extensions installed. It also means that on first start of the app it asks if you want to make chrome the default browser - probably wise to say no - you’ll want to keep your normal chrome profile for that :)

Setting system path for command line on Mac OSX

Posted: 2014-01-28 | mac | osx | homebrew

There’s plenty of information out there on how to set up the PATH variable for your local shell for OSX - it uses the same method as people are used to on linux - settings in your shell config files.

But what if you want/need to set the paths at the system level? How is that handled?

Well - to start with - let’s take a look in /etc/profile. Here you can see that it’s calling /usr/libexec/path_helper.

More information on that can be found on the path_helper manpage

So - paths are being read first from /etc/paths then from any files in /etc/paths.d/

The files in the /etc/paths.d directory will be read in order based on filename.

So - you now have two methods - you can change the default ordering in /etc/paths (and if you wish add paths here) - I use this to move /usr/local/bin before /usr/bin and /bin - since I have my machomebrew files there and some of them overwrite the system files (for example a later version of git). Be aware that this means it’s up to you not to install files there that are not backwards compatible - your system also uses a lot of files from /usr/bin and /bin :)

And if you want to install a set of paths for a given use/package/app then you can also choose to add that as a file under /etc/paths.d/

Note - you’ll need to edit these files as the root user - sudo vi /etc/paths for example - and for that to work you’ll either need to be an administrator of the machine or added to the /etc/sudoers file.

And finally - you’ll need to start a new shell window before seeing the changes.

Deploy from github to heroku via travis-ci

Posted: 2014-01-20 | maven | java | travis-ci | heroku | continuous integration | continuous deployment | github

A small test of using travis-ci to build a github project and auto deploy it to heroku.

Step 1 - A webapp

Create your webapp. For this I created a simple hello world webapp (1 jsp) with a dummy test (just to give travis-ci something to do).

Commit on github for this step

Step 2 - CI

Let’s add that to travis.

  • Head to Travis and log in with github oauth.
  • Click on your logged in account name and choose Accounts
  • Hit the sync now button if the last sync isn’t recent enough
  • Find your project and switch from off to on
  • Click the spanner (takes you to the deploy hooks for the github project), choose travis and enter your username/token (available from your travis profile)
  • Add travis config to the project. This means we need to add a .travis.yml file. This specifies the language as java and what JDK you want to use. See .travis.yml
  • The build should now appear in your list on travis

Commit on github for this step

Step 3 - Let’s get the build status to show at github

Once your build passes - on the travis page you can see an icon - build passing. If you click on that you get a popup of build status links.

Grab the one that uses the same format you want to use for your README.

Create the README file if not already present and include the link to the image. For this test I used markdown

Once pushed - refresh the github project page and you should see the build status icon.

Commit on github for this step

Step 4 - Create heroku app

Heroku’s example uses embedded jetty - so update the app

And initial deploy:

$ heroku create web-hello-world
          Creating web-hello-world... done, stack is cedar
          Git remote heroku added
          $ git push heroku master

And now we can test the deployment

Commit on github for this step

Step 5 - Push builds to heroku

We need to add the heroku information to the travis yaml file. We don’t want to have the auth key in plain text - so grab the travis command line tool and then run

$  travis setup heroku

Make sure you choose to encrypt the key.

Commit on github for this step

Step 6 - Test it

Change the app, commit and wait. Your change should arrive on the heroku site.

Once it’s been tested and deployed - you can see the change

Commit on github for this step

More info:

Puppet service config for ejabberd

Posted: 2013-12-13 | puppet | ejabberd

I have an issue getting a working puppet service config for ejabberd on debian.

The init.d script supports the following options:

Usage: /etc/init.d/ejabberd {start|stop|restart|force-reload|live}

So - it has restart but not status. That means setting hasstatus to false and giving it a status command.

OK - let’s fall back to a ps based status - we want to look for the ejabberd process (beam).

ps -ef | grep beam

We’re not interested in the grep processes

ps -ef | grep beam | grep -v grep

But we also want a return status - not output

ps -ef | grep beam | grep -qv grep

This should set the return status correctly.

In fact I can test too:

$ ps -ef | grep beam | grep -qv grep
          $ echo $?

And if I change to grep after a non-existant process (just to test)

$ ps -ef | grep beamx | grep -qv grep
          $ echo $?

So I created the following service definition:

class ejabberd::service {
            service { 'ejabberd':
              ensure     => running,
              hasstatus  => false,
              hasrestart => true,
              status     => 'ps -ef | grep beam | grep -qv grep',
              enable     => true,
              require    => Class['ejabberd::config'],

This worked to start with - but recently it suddenly started restarting the process every puppet run - here’s the output from logcheck:

--------------------- Puppet Begin ------------------------
          Service starts:
              ejabberd: 143 Time(s)
          ---------------------- Puppet End -------------------------

And I can’t for the life of me see why.

Automated App Compat virtual machines for IE testing

Posted: 2013-10-26 | virtualbox | microsoft | ie | ievms | testing

I very very very rarely need a windows install for anything. However - today I needed to talk to something that only has a windows driver.

This got me looking for ways to get a simple virtualized box running - which led me to this github repo: Automated installation of the Microsoft IE App Compat virtual machines

So - first step was simply to install virtualbox (or in my case update it).

Then - all you have to do is

curl -s | bash

Or if you want specific IE versions (since this is really for IE testing - e.g. IE7 and IE9):

curl -s | env IEVMS_VERSIONS="7 9" bash

More details are on the github page - including info on snapshots (which can help you get around the 30 day limit - just revert to the original snapshot).

Time-based One-Time Password (TOTP) authentication for Google and more on iOS7

Posted: 2013-08-14 | TOTP | google authenticator | duo mobile | two-step authentication | ios7 | dropbox | google

I use two-step authentication for both my GMail and Google Apps accounts as well as dropbox.

Up to now I’ve been using Google’s iOS authenticator app - but this app has issues in iOS7

  1. It forgets accounts when you restart the phone
  2. You can no longer edit the descriptive name for each account so you have no idea which code is which account
  3. Lately it’s stopped scanning barcodes too

The first one is of course the most serious.

After some googling I found that there are other TOTP app’s out there. I settled on Duo Mobile

After following the third-party accounts page I had both my google accounts and my dropbox account in the app and it’s working nicely.

Site converted to use middleman static site generator

Posted: 2013-08-10 | drupal | middleman | site generation

I’ve had this site running drupal since august 2006 but over time I’ve reduced the modules in use to almost nothing. There’s nothing on the site that needs to be dynamic any more.

So I decided to migrate it to a static site generator - which means that the site is a lot easier to serve, requires far less maintenance and can be easily stored under version control :)

I’ve tried nanoc before - it works but I find the documentation on extending it a bit opaque, so for this site I’ve gone with middleman. It seems to work well and I find that writing the few small extensions I need has been easy.

I’ve added apache redirects from the old drupal URLs to the new site - so I hope that google links etc will work. If not - let me know :)

Enabling GPU for Premiere Pro CS6 and After Effects

Posted: 2013-05-25 | mac | adobe | premiere | after effects | nvidia | cuda

Got a modern mac with a good nvidia graphics card but premiere and after effects won’t use your GPU?

All the details -

Short form:

/Applications/Adobe\ Premiere\ Pro\ CS6/Adobe\ Premiere\ Pro\
          /Applications/Adobe\ After\ Effects\ CS6/Adobe\ After\ Effects\
  • Add the card name to both
/Applications/Adobe\ Premiere\ Pro\ CS6/Adobe\ Premiere\ Pro\
          /Applications/Adobe\ After\ Effects\ CS6/Adobe\ After\ Effects\

BankID on Mountain Lion

Posted: 2013-04-16 | java | mac | osx | apple | mountain lion | bankid | oracle | applet

Norwegian BankID (used by most banks in Norway) uses a java applet for login.

The current combination of java, mac osx 10.8.x, applets and BankID is a mess.

Things to note:

  • Java 1.6 from Apple removed support for web applets - so you’ll need Oracle java 7
  • Java 7 from Oracle will work - but - not in Chrome (Chrome doesn’t support 64 bit java - Oracle don’t provide 32 bit)
  • Most BankID pages test to see if java is enabled - and after installing java - it still gives the java not installed or enabled error. The issue seems to be that you have to activate the plugin by loading an applet that doesn’t test for support - for example the one on prior to trying to log in to the bank
  • BankID state that there is an issue in Firefox where the OK button does not get enabled - you can get around this by holding the CMD key in for a few seconds until it enables. This is claimed to be due to a bug between Firefox and java. Note that in my testing this is exactly the same issue in Safari and the same workaround works.

So - install Oracle java, go visit a test page - log in with a workaround to get OK buttons to enable and you might just be allowed to login to your bank.

The BankID applet needs to die.


Generating twitter auth tokens for non-web clients

Posted: 2013-02-25 | ruby | twitter | oauth

I use twitter for various system stuff - and needed a way to get auth tokens for users for twitter oauth based apps.

Twitter provides PIN based authentication for this - you generate a URL based on the consumer token/secret - visit that - log in - get a PIN and use the PIN to generate the auth token/secret.

get_keys.rb is a simple ruby script to do just that.

It takes consumer_token and consumer_secret as command line params (in that order), generates the authorize URL and prints it - then waits for the PIN. Displays consumer and auth token info at the end.