How do you scale along a non canonical direction? Silly question but I am not figuring it out on my own.
In 3D you can scale a point / shape / field along a canonical direction quite easily:
$p = (x_0, x_1, x_2)$ becomes $p = (ax_0, x_1, x_2)$ for example if we wanted to scale along the first axis. This map has the property that distances in any plane parallel to the plane $(x_1, x_2)$ remain unaffected.
Now given an arbitrary vector $N$ I want to induce the same transformation along the direction of $N$.
One possible solution, of course, is to find a rotation that transforms $N$ into one of the canonical directions, scale that direction, then invert the transformation. i.e. $RSR^{-1}$.
However this is inelegant, I am trying to do it in a way that involves only $N$ and requires no change of basis. i.e. I want to scale points along $N$ without changing the coordinate space, and perhaps better, in a coordinate free way.

The way to construct a matrix that does this is as follows:
The component of $P$ parallel to $N$ is $N\cdot P N = (N^TP)N = NN^TP$
Thus $-NN^T P + P = (-NN^T + I)P$ is P minus its component orthogonal to $N$. Thus $(-NN^T + I)P + sNN^TP$ is the scaling of $P$ along the direction $N$ as described in Chris Eagle's answer.
We get:
$$(-NN^T + I)P + sNN^TP = (-NN^T + I + sNN^T)P$$
$$ = (NN^T(-I + sI) + I)P$$
$$ = (NN^T(s - 1) + I)P$$
Thus the matrix $((s - 1)NN^T + I)$ Represents a linear scaling along the direction $N$ for any $P$ in a coordinate free way.
Notice that matrix must be symmetric btw.
