SSH to headless VM on VirtualBox

Running a (Linux) VM headless and SSH’ing to it (using NAT’ted networking):

  1. Create a port forwarding rule from, say, host port 2022 to VM port 22 (via Settings => Network => Adapter 1 => Advanced => Port Forwarding)
  2. Startup the VM while holding the shift key, this will run the VM without allocating a window to it
  3. SSH to localhost:2022

JSON serialization with Java inner classes and Jackson

Here’s an example of providing a JSON view to (a part of) your data using an inner class and Jackson JSON mapper:

public final class FtpServer {
    public String host;
    public Integer port;
    public String secret;

public final class Environment {
   public String name;
   @JsonIgnore public String username;
   @JsonIgnore public FtpServer ftpServer;
   public FtpInfo ftpInfo() {
     return new FtpInfo();

   @JsonAutoDetect(fieldVisibility = ANY)
   final class FtpInfo {
      String username = Environment.this.username;
      String hostname =;
      Integer port = Environment.this.ftpServer.port;

Which would render something like this:

  "name" : "Example",
  "ftp" : {
    "username" : bob,
    "hostname" : "",
    "port" : 21    

Fairly concise, eh?

DIY: Focus 2005 clutch pedal return spring replacement

Summary: this post describes how to install a new clutch pedal return spring for a Ford Focus 2005. Horrible job, but doable, and saves you approx. 80€ (in Finland).

  1. Buy a new spring from your Ford dealer, should be around 5€.
  2. Buy some washers that have approx. the same diameter as the spring (~1cm).
  3. Fit approx. 23 washers to each coil (on both sides) of the spring, to stretch it.
  4. Move the driver’s seat to its rearmost position to improve working conditions.
  5. Lift the steering wheel column to its upmost position to improve working conditions.
  6. Grab a flashlight, lay on your back, place your head next to the pedals and look up. Twist your arm to an akward position to be able to work.
  7. Fit the shorter hook of the spring to the metal plate on the chassis behind the pedal. The hole is barely visible. See rightmost arrow in Picture 2.
  8. Fit the longer hook of the spring to the top of the pedal (it has a small notch to keep the hook in place). See leftmost arrow in Picture 2.
  9. Depress the clutch pedal all the way down to remove the washers, then pull/push out any remaining ones that did not fall off.

Picture 1: Spring with washers (some have already fallen off at this point):
Picture 2: Spring hooks in place (longer hook on the left, shorter hook on the right):
Picture 3: Finished (with washers removed):