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 / Vagrantfile
Created January 8, 2015 23:53
Vagrant Cluster - Master & Slaves
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
# Require a recent version of vagrant otherwise some have reported errors setting host names on boxes
Vagrant.require_version ">= 1.6.2"
INSTANCE_PREFIX="byoc"
@danielnegri
danielnegri / vpnsetup.sh
Last active August 29, 2015 14:13 — forked from hwdsl2/.MOVED.md
#!/bin/sh
#
# Amazon EC2 user-data file for automatic configuration of IPsec/L2TP VPN
# on a Ubuntu server instance. Tested with 14.04 (Trusty) AND 12.04 (Precise).
# With minor modifications, this script *can also be used* on dedicated servers
# or any KVM- or XEN-based Virtual Private Server (VPS) from other providers.
#
# DO NOT RUN THIS SCRIPT ON YOUR PC OR MAC! THIS IS MEANT TO BE RUN WHEN
# YOUR AMAZON EC2 INSTANCE STARTS!
#
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/)