Skip to content

Instantly share code, notes, and snippets.

View raphi's full-sized avatar

raphi raphi

View GitHub Profile
@raphi
raphi / groovy_get_age
Created January 16, 2015 14:51
Compute age from an ElasticSearch document date
def now = new Date()
def birthday = new Date(doc["birthdate"].value)
return Integer.parseInt(now.format("Y")) - Integer.parseInt(birthday.format("Y")) - (birthday > now ? 1 : 0)
{"@timestamp":"2015-02-04T09:33:25.873Z","level":"info","message":"Listening on 0.0.0.0:5601","node_env":"production"}
{"@timestamp":"2015-02-04T09:34:28.712Z","level":"info","message":"GET / 200 - 15ms","node_env":"production","request":{"method":"GET","url":"/","headers":{"host":"192.168.59.103:49156","connection":"keep-alive","accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8","user-agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.93 Safari/537.36","dnt":"1","accept-encoding":"gzip, deflate, sdch","accept-language":"en-US,en;q=0.8,fr;q=0.6"},"remoteAddress":"192.168.59.3","remotePort":61336},"response":{"statusCode":200,"responseTime":15,"contentLength":0}}
{"@timestamp":"2015-02-04T09:34:28.785Z","level":"info","message":"GET /images/initial_load.gif 200 - 5ms","node_env":"production","request":{"method":"GET","url":"/images/initial_load.gif","headers":{"host":"192.168.59.103:49156","connection":"keep-alive","
@raphi
raphi / migrate_postgresql_database.md
Created November 3, 2017 10:51 — forked from olivierlacan/migrate_postgresql_database.md
How to migrate a Homebrew-installed PostgreSQL database to a new major version (9.3 to 9.4) on OS X

This guide assumes that you recently run brew upgrade postgresql and discovered to your dismay that you accidentally bumped from one major version to another: say 9.3.x to 9.4.x. Yes, that is a major version bump in PG land.

First let's check something.

brew info postgresql

The top of what gets printed as a result is the most important: