Check if SSL certificate is SHA1 or SHA2

I recently needed to check if the certificate I'd been provided with was SHA1 or SHA2. Stack Overflow helped, but here's a copy for posterity:

curl: (35) error:14094418:SSL routines:SSL3_READ_BYTES:tlsv1 alert unknown ca

Another fun SSL issue today. We managed to get request signing working with a self signed certificate (see this post) but once we bought a real certificate from Gandi things stopped working.