The Whitlam Government’s achievements

In his brief three years the Prime Minister produced profound and lasting changes – reforms which could not have been so broadly conceived and so firmly implemented by a lesser man. The Whitlam Government without doubt was the most creative and innovatory in the nations history. Under Whitlam, Australia’s foreign policy came of age. His Government made education its top priority and poured money into schools and colleges throughout the country. It created Medibank, set up community health centres, gave a new deal to pensioners, took an active role in urban improvement and development, provided funds directly to local government, and gave a healthy boost to sexual equality and aboriginal advancement. It promoted greater Australian ownership and control of resources, legislated against restrictive trade practices, introduced the most civilized and sensible divorce laws in the world, gave encouragement to the arts, and in its final budget implemented some fundamental reforms which made the income tax system considerably more equitable. Whitlam himself dominated both his party and the Parliament, and he commanded respect when he traveled overseas in a way no previous Australian Prime Minister had done.

Laurie Oakes, Crash through or Crash

Frothy

noun.

A quality of a segment of the Venture Capital investment portfolio, where valuations are felt to be so inflated that the only frame of reference available are other, similarly inflated, opportunities in the same market.

How to run godoc under launchd on OS X

godoc is an amazing reference utility. I use launchd to keep it running for me.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
   <key>Label</key>
   <string>org.golang.godoc</string>
   <key>ProgramArguments</key>
   <array>
      <!-- ensure this is the absolute path to your godoc install -->
      <string>/Users/dave/go/bin/godoc</string>
      <string>-http=127.0.0.1:6060</string>
   </array>
   <key>Sockets</key>
   <dict>
      <key>Listeners</key>
      <dict>
         <key>SockServiceName</key>
         <string>6060</string>
      </dict>
   </dict>
   <key>RunAtLoad</key>
   <false/>
   </dict>
</plist>

Place this file in ~/Library/LaunchAgents/org.golang.godoc.plist and edit the absolute path to your godoc binary. Then issue the command

$ launchctl load ~/Library/LaunchAgents/org.golang.godoc.plist

You can then browse to http://127.0.0.1:6060 to view the current documentation for your Go installation.

To stop godoc just issue a killall godoc and launchd will restart it when necessary. You can use the same command after updating to the latest release to ensure you’re viewing the most up to date documentation.

How to dial remote SSL/TLS services in Go

Go has wonderful support for server side TLS, but the client side takes a little bit of massaging to generate a correct Config struct. Check out this thread from Hans Stimer for more details on handling TLS on the server side.

package main

import (
	"crypto/tls"
	"io/ioutil"
	"net"
	"os"
	"time"
)

func loadRootCA(file string) (*tls.CASet, os.Error) {
	pemBytes, err := ioutil.ReadFile(file)
	if err != nil {
		return nil, err
	}

	caset := tls.NewCASet()
	if caset.SetFromPEM(pemBytes) {
		return caset, nil
	}
	return nil, os.NewError("Unable to decode root CA set")
}

func newClientConfig(rootCAPath string) (*tls.Config, os.Error) {
	rootca, err := loadRootCA(rootCAPath)
	if err != nil {
		return nil, err
	}

	urandom, err := os.Open("/dev/urandom", os.O_RDONLY, 0)
	if err != nil {
		return nil, err
	}

	return &tls.Config{
		Rand:    urandom,
		Time:    time.Seconds,
		RootCAs: rootca,
	}, nil
}

func dialTLS(raddr *net.TCPAddr) (c *tls.Conn, err os.Error) {
	config, err := newClientConfig("ca-certificates.crt")
	if err != nil {
		return nil, err
	}

	conn, err := net.DialTCP("tcp", nil, raddr)
	if err != nil {
		return nil, err
	}

	c = tls.Client(conn, config)
	err = c.Handshake()
	if err == nil {
		return c, nil
	}
	c.Close()
	return nil, err
}