The Best of Go

Aggregators Pocket Gophers GopherAcademy Articles Exposing Go on the Internet [Dec 2016] - configure a Go Web server for security and performance

Create a localhost alias

It is often helpful to be able associate a private IP address with the local loopback. This may be required to allow references to host services from within the private network space of a Docker container for example. Configure a Local Network Interface in Mac OSX We will associate a private IP address with the lo0 ( network interface of our Mac. Create /Library/LaunchDaemons/ca.epbc.loopback-dev.plist: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.

Create an SSH Tunnel to a Remote Service

Let’s say there is a remote service – maybe a Postgres or MySQL database server – running on a network that doesn’t expose the service port. If you have SSH access to a host on that network – let’s call it jump – and jump can access the service, it is possible to create what is called an SSH tunnel through jump to the remote service. Here’s how. Let’s use the example of accessing Postgres on its usual port 5432 on host pgsrv on the same network as jump.

Find Missing IDs in a Table

Ref: Suppose you have database table with a unique auto-increment primary key. Over time, entries may be deleted from the table, so there are “holes” in the primary key’s values. Find the missing IDs as follows: SELECT DISTINCT id + 1 FROM mytable WHERE id + 1 NOT IN (SELECT DISTINCT id FROM mytable);

What's My IP?

A quick way to get the public facing IP address of a system: $ curl