aws emr create-cluster --name "Scalding test cluster" --ami-version 3.9.0 --use-default-roles --instance-type m1.medium --instance-count 3 --log-uri s3://grajo001out/2 --steps Type=CUSTOM_JAR,Name="EMR Tutorial",ActionOnFailure=TERMINATE_CLUSTER,Jar=s3://grajo001log/emr-scalding-tutorial-assembly-0.1.jar ,Args=["com.softwaremill.AgeCounterJob","--hdfs","--input","s3n://grajo001log/users/*","--output","s3n://grajo001log/output"] --auto-terminate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"Name": "emr-scalding-tutorial", | |
"Args": [ | |
"com.softwaremill.AgeCounterJob", | |
"--input", | |
"s3://grajo001log/users/*", | |
"--output", | |
"s3://grajo001out/scaldingoutput", | |
"--hdfs" |
aws emr add-steps --cluster-id=YOUR-CLUSTER_ID --steps=file://./task.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//-------------------- | |
// GET USER MEDIA CODE | |
//-------------------- | |
navigator.getUserMedia = ( navigator.getUserMedia || | |
navigator.webkitGetUserMedia || | |
navigator.mozGetUserMedia || | |
navigator.msGetUserMedia); | |
var video; | |
var webcamStream; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function uploadSignIn(filename) { | |
var dataURL = canvas.toDataURL(); | |
var blobBin = atob(dataURL.split(',')[1]); | |
var token = $('input[name="csrfToken"]').attr('value'); | |
var array = []; | |
for(var i = 0; i < blobBin.length; i++) { | |
array.push(blobBin.charCodeAt(i)); | |
} | |
var file=new Blob([new Uint8Array(array)], {type: 'image/png'}); | |
var formdata = new FormData(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('#loginForm').one('submit', function(ev) { | |
ev.preventDefault(); | |
var uuid = uuidv4(); | |
snapshot(); | |
uploadSignIn(uuid); | |
stopWebcam(); | |
$(this).submit(); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def submit = silhouette.UnsecuredAction.async { implicit request: Request[AnyContent] => | |
val fileDataOpt: Option[MultipartFormData[TemporaryFile]] = request.body.asMultipartFormData | |
val signInForm = SignInForm.form.bindFromRequest | |
val tempFolderPath = configuration.underlying.getString("facenetTempFolder") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def checkFace(tempFolderPath: String, signInData: Option[MultipartFormData[TemporaryFile]], credentials: Credentials, user: User): Future[Boolean] = { | |
signInData.map { fileData => | |
fileData.file("uploadedImage").map { image => | |
import java.io.File | |
val filename = image.filename | |
image.ref.moveTo(new File(s"$tempFolderPath/signIn-$filename.png")) | |
val bos = new BufferedOutputStream(new FileOutputStream(new File(s"$tempFolderPath/orig-$filename.png"))) | |
bos.write(user.face) | |
bos.close() | |
checkIfFacesMatch(s"$tempFolderPath/signIn-$filename.png", s"$tempFolderPath/orig-$filename.png") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys.process._ | |
import scala.concurrent.ExecutionContext.Implicits.global | |
def checkIfFacesMatch(facePath1: String, facePath2: String): Future[Boolean] = { | |
Future { | |
val result = s"python python/facematch.py --face1=$facePath1 --face2=$facePath2".!! | |
val res = result.split("\n").tail.headOption.exists(r => Try(r.toBoolean).getOrElse(false)) | |
removeFile(facePath1) | |
removeFile(facePath2) | |
res |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker volume create openstreetmap-data | |
docker volume create openstreetmap-rendered-tiles |