Latest weblog entries

2017-02-21 Linux VPS with TeamViewer

Here are my short notes on creating a Linux VPS (virtual private service) which can be remotely accessed via TeamViewer. I prefer TeamViewer over other ways of remotely accessing a desktop, because it works cross-platform and through NAT and firewalls.

The big problem is often that a Linux VPS doesn't have a virtual graphical card. For remote access to the GUI, most VPS providers advise VNC while I prefer TeamViewer.

I've tried a number of Linux distributions on a number of VPS providers. The instructions below fail on VPSes at Scaleway or DigitalOcean, but the combination of Fedora 25 and Linode or Vultr made this all very easy.

First of all, register or log in at Linode or Vultr, and create a VPS. You'll need at least 1 GB of memory.

After it's started, log in via SSH as root and do the following:

  # yum -y groupinstall "Fedora Workstation"

Then get the TeamViewer download URL and install the package:

  # wget ""
  # yum -y install ./teamviewer.i686.rpm

Next reboot, make sure the GUI starts:

  # systemctl set-default

If your VPS runs at Vultr, disable Wayland. Edit the file /etc/gdm/custom.conf and remove the comment for the line WaylandEnable=false so GDM uses Linode already has this correctly set.

Then, add a user for yourself:

  # useradd -m -U mynewusername
  # passwd mynewusername

Add the new user to the sudoers, and reboot:

  # visudo
  # reboot

If you're on Linode, open remote access via glish, which is Linode's way of giving you graphical access to your VPS, through your browser. Log into the Linode management console, click on the node, then in the tab Remote Access, click the link "Launch Graphical Web Console".

If you're on Vultr, open remote access by navigating to the Instances tab in the management console, then click the three dots at the right of your server and in the menu, click "View Console":

vultr 2017-02-21.png

You should see the graphical Linux login screen. In the top left corner, set shell to "Gnome Xorg" (this is important!) and then continue to log into Gnome.

Linode login 2017-02-21.png

In Gnome, start TeamViewer. Check the three boxes to enable remote access. You'll need to provide TeamViewer username/password, as well as click the link in the email you'll get, to confirm adding this VPS to your TeamViewer device list.


Note: a current disadvantage is that you're constricted to pretty low resolutions. On Linode, you can't set the resolution to something bigger than 1280x768. On Vultr, the maximum is 1280x1024.

2017-02-03 Create your own laptop battery test

Recently I wanted to test how long the battery of my 2013 MacBook Air lasts. The quickest solution I found, is as follows:

  • Download Firefox.
  • Get the iMacros for Firefox extension.
  • Make a list of, say, ten websites.
  • After installation, click the iMacros button so the sidebar appears.
  • Open a new tab for the purpose of recording the macro.
  • Click record.
  • Type in these ten sites. Just type the URL in the address bar. Clicking anywhere will often result in failed playback. Searching for a keyword in Google is fine, though.
  • Stop recording and edit the macro. Add the line "WAIT SECONDS=5" a couple of times, to simulate the time spent reading.
  • Play the macro once to make sure you won't have errors occuring during playback.
  • In the settings of iMacros, set playback speed to slow.

Now to test the battery:

  • Click on the battery icon in the menubar and click "show percentage". It should obviously show 100% at this point because we want to start fully charged.
  • In System Preferences, turn off the screensaver. Under Energy Saver, set "turn display off after..." to "Never".
  • Note the current time somewhere, then remove power cord.
  • Set the screen brightness to something reasonable, like 75%.
  • Set the loop field to 10000 or some other high number.
  • Click the Play Loop button.
  • Every half hour, have a look at the battery level and write it down.

So this is my ghetto battery test. It's a bit rough around the edges, but should give you an idea of how many hours the battery lasts. Don't take the results too serious, this is meant to get a ballpark figure.

2017-02-02 Swift app without Interface Builder

Here's an example of an AppDelegate.swift, for those who don't like Interface Builder:

    import UIKit
    class AppDelegate: UIResponder, UIApplicationDelegate {
        var window: UIWindow?
        func application(_ application: UIApplication,
            didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
            self.window = UIWindow(frame: UIScreen.main.bounds)
            let vc = ViewController()
            let nc = UINavigationController(rootViewController: vc)
            self.window?.rootViewController = nc
            return true

Remove the Main.storyboard file from the project. And in the Info.plist of your project, remove the entry called "Main storyboard file base name:

main storyboard file base name 2017-02-03.png

2017-01-12 Finder shortcuts

I couldn't find a one-page PDF with all macOS Finder shortcut keys. So I made one: Finder shortcuts.pdf. Here is the original, so you can adjust to your liking: Finder shortcuts.xlsx. Both are licensed under the Creative Commons Attribution 4.0 International License.

2016-12-25 Firefox crashes on late 2016 MacBook Pro

I've been using Firefox on a late 2016 MacBook Pro, running macOS 10.12.2. Every time the laptop wakes from sleep, Firefox has crashed. To remedy this situation, I've created a Hammerspoon script to kill Firefox when the system goes to sleep, and start it upon waking. In Firefox Preferences -> General, you can configure a setting called "When Firefox starts". Set this to "Show my windows and tabs from last time". Then install Hammerspoon, create the folder .hammerspoon in your home directory and create the file init.lua in that new folder. Then paste the following code and in Hammerspoon, reload the configuration.

    local log ='mywatcher','debug')
    function callback(eventType)
        if (eventType == hs.caffeinate.watcher.systemWillSleep) then
            local firefox = hs.application.find('Firefox')
            if not (firefox == nil) then
        elseif (eventType == hs.caffeinate.watcher.systemDidWake) then
            local firefox = hs.application.find('Firefox')
            if (firefox == nil) then
                firefox ="/Applications/")
    local mywatcher =


Weblog Archive

Weblog entries 2016

Weblog entries 2015

Weblog entries 2014

Weblog entries 2013

Weblog entries 2012

Weblog entries 2011

Weblog entries 2010

Weblog entries 2009

Weblog entries 2008

Weblog entries 2007

Weblog entries 2006

Weblog entries 2005

Weblog entries 2004

All weblog entries


Articles, chronologically (latest first). This is pretty old stuff.


Not yet finished. Maybe will never be finished. Maybe they'll get deleted. Who knows?


System administration: