Train of Lights

Photo of the Train of Lights on the Niles Canyon Railway.
Tam Pan

Time-lapse panning over the San Francisco bay area from the Gardner Lookout at the east peak of Mount Tamalpais.
Book reviews for December 2016
Rio Vista Bridge

Photo of The Helen Madere Memorial Rio Vista Bridge spanning The Sacramento River.
Pitcher Plant

A picture of a pitcher at the Conservatory of Flowers, Golden Gate Park, San Francisco.
Unidentified Butterfly

Could be anything... (seen at the Conservatory of Flowers in San Francisco's Golden Gate Park, do please leave a comment if you know what it is.)
ASCII Sunset

A sunset timelapse rendered as ASCII art. Music from JukeDeck.
Expert

I haven't checked Klout for a long time - while I was away they've decided I'm a expert in Indian politics. Explains a lot...
Enable GZIP compression for Amazon S3 hosted website in CloudFront

By default compression doesn't work in CloudFront for a website backed by an Amaxon S3 bucket.
The first step is pretty obvious - switch on compression in CloudFront:

To get to this setting open you distribution, go to the Behaviors tab and edit your behavior(s). Scroll down to the bottom and toggle Compress Objects Automatically to On. Save and drum your fingers while the distribution updates.
The less obvious piece is that CloudFront will only compress files between 1,000 and 10,000,000 bytes (as of writing this post) and it detects the filesize from the Content-Length header. What the documentation doesn't mention is that S3 does not send the Content-Length header by default and so no compression is applied.
Go to S3 and open the properties for your bucket (not for individual files). Expand Permissions and then click Edit CORS Configuration. You need to add Content-Length as an allowed header like this:



