Skip to content

Instantly share code, notes, and snippets.

View danielnegri's full-sized avatar
Coffee first.

Daniel Negri danielnegri

Coffee first.
View GitHub Profile
@danielnegri
danielnegri / ApplicationController.scala
Created February 25, 2015 15:09
Playframework - Authentication + SSO
package controllers
import play.api._
import play.api.mvc._
import play.api.mvc.Results._
import play.api.data._
import play.api.data.Forms._
import play.api.Play.current
import play.api.libs.json._
import play.api.libs.json.Json._
import sbt._
import sbt.Keys._
import play.Project._
import sbtbuildinfo.Plugin._
import com.gu.SbtJasminePlugin._
object ApplicationBuild extends Build {
val appName = "your-app-name"
val appVersion = "1.0-SNAPSHOT"
@danielnegri
danielnegri / Dockerfile
Created March 23, 2015 14:44
Docker - agambiarra.com
FROM ubuntu:14.04
MAINTAINER Daniel Negri <danielnegri@byoc.io>
# Keep upstart from complaining
RUN dpkg-divert --local --rename --add /sbin/initctl
RUN ln -sf /bin/true /sbin/initctl
# Let the conatiner know that there is no tty
ENV DEBIAN_FRONTEND noninteractive

Keybase proof

I hereby claim:

  • I am danielnegri on github.
  • I am danielnegri (https://keybase.io/danielnegri) on keybase.
  • I have a public key whose fingerprint is 3108 6326 4D35 EB6C EFD6 EB59 6ABF FC28 E54A 0CD5

To claim this, I am signing this object:

$ ./bin/spark-shell
14/04/18 15:23:49 INFO spark.HttpServer: Starting HTTP Server
14/04/18 15:23:49 INFO server.Server: jetty-7.x.y-SNAPSHOT
14/04/18 15:23:49 INFO server.AbstractConnector: Started SocketConnector@0.0.0.0:49861
Welcome to
____ __
/ __/__ ___ _____/ /__
_\ \/ _ \/ _ `/ __/ '_/
/___/ .__/\_,_/_/ /_/\_\ version 0.9.1
/_/
import scala.concurrent.Await
import scala.concurrent.ExecutionContext
import scala.concurrent.Future
import scala.concurrent.blocking
import scala.concurrent.duration.Deadline
import scala.concurrent.duration.Duration
import scala.concurrent.duration.DurationInt
import scala.concurrent.duration.DurationLong
import scala.concurrent.future
import scala.concurrent.promise
@danielnegri
danielnegri / ClientGrantRequest.java
Created June 23, 2015 17:44
Example token request with a client credentials grant
import com.nimbusds.oauth2.sdk
import com.nimbusds.oauth2.sdk.auth
import com.nimbusds.oauth2.sdk.http
import com.nimbusds.oauth2.sdk.id
import com.nimbusds.oauth2.sdk.token
// Construct the client credentials grant
AuthorizationGrant clientGrant = new ClientCredentialsGrant();
// The credentials to authenticate the client at the token endpoint
@danielnegri
danielnegri / schema.rb
Created June 30, 2015 05:14
Dookeeper Schema
# encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#!/bin/bash
#
# Bash script to setup headless Selenium (uses Xvfb and Chrome)
# (Tested on Ubuntu 12.04) trying on ubuntu server 14.04
# Add Google Chrome's repo to sources.list
echo "deb http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee -a /etc/apt/sources.list
# Install Google's public key used for signing packages (e.g. Chrome)
# (Source: http://www.google.com/linuxrepositories/)
#!/bin/bash
export BASH_SILENCE_DEPRECATION_WARNING=1
# Set colors
export CLICOLORS=1
export LSCOLORS=gxBxhxDxfxhxhxhxhxcxcx
# Set alias
alias cp="cp -i"