Skip to content

Instantly share code, notes, and snippets.

Avatar

Jorje Whitelaw gwhitelaw

  • Visii
  • London, UK
View GitHub Profile
@gwhitelaw
gwhitelaw / aws-glue-zepplin.md
Last active Jun 24, 2020
Easily connect to an AWS Glue Dev endpoint
View aws-glue-zepplin.md

This is how I quickly got an Apache Zepplin notebook running against the AWS Glue Dev endpoint. None of the guides out there seemed concise, and I found some custom Docker containers doing what you can do easily. This gives you the power - it sets up port forwarding & runs the official Docker image.

  1. Create your Glue Dev endpoint (this involves creating a keypair, I just used ssh-keygen)
  2. Once READY, select it and copy the "SSH tunnel to remote interpreter"
  • eg: ssh -i <private-key.pem> -vnNT -L :9007:169.254.76.1:9007 glue@..compute.amazonaws.com
  1. Connect to the endpoint in a terminal session, modifying the above to match: ssh -i ~/.ssh/glue-dev -vnNT -L :9007:*127.0.0.1*:9007 glue@<ec2-endpoint>.<region>.compute.amazonaws.com
  2. Run the Apache Zepplin Docker container `docker run -p 8080:8080 --rm -v $PWD/logs:/logs -v $PWD/notebook:/notebook -e ZEPPELIN_LOG_DIR='/l
@gwhitelaw
gwhitelaw / go-go-gadget-sugar.coffee
Last active Dec 25, 2015
Allow sugarjs to parse multiple friendly dates in the format 1 month 1 day ago
View go-go-gadget-sugar.coffee
require 'sugar'
{ compact } = require 'underscore'
parseFriendlyDate = (friendlyDate) ->
date = new Date().getTime()
dateOffset = date
dateSections = compact((friendlyDate.trim()).split(/(\d+\s\w+)\s/))
dateEnding = dateSections.splice(-1)
dateSections.forEach((section) -> dateOffset -= (date - Date.create("#{section} #{dateEnding}").getTime()))
new Date(dateOffset)
View gist:5488195
validateUuid = (text) -> (text || "").match(/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/)
validateUuid(null) # returns null
validateUuid("") # returns null
validateUuid("not-a-valid-uuid") # returns null
validateUuid("73963155-27db-48ad-abee-7afa2dd14af1") # returns regex match array
You can’t perform that action at this time.