Skip to content

Instantly share code, notes, and snippets.

View kryton's full-sized avatar

Kryton kryton

View GitHub Profile
def importFile = Action.async{ implicit request =>
user.isAdmin(LDAPAuth.getUser()).map {
case true =>Ok(views.html.person.importFile())
case false => Unauthorized(views.html.page_403( "You don't have access to import SAP files"))
}
}
def doImport = Action.async(parse.multipartFormData) { implicit request =>
user.isAdmin(LDAPAuth.getUser()).map {
case false => Future.successful(Unauthorized(views.html.page_403("You don't have access to import SAP files")) )
@kryton
kryton / gist:423d5d680eb7cb7dafec6c1a2d8d890b
Created March 31, 2017 16:21
bill of parts/heirarchial queries
// Slick 2.x / play 2.4
final def managementTree()(implicit session:Session):Set[String] = {
managerTreeIter(Set(this.login.toLowerCase))
}
@tailrec
private def managerTreeIter(acc:Set[String])(implicit session:Session):Set[String] = {
this.manager match {
case None => acc
case Some(mgr) => mgr.managerTreeIter( acc ++Set( mgr.login.toLowerCase))
}
package controllers
import javax.inject._
import models.{ProductTrackRepo, ResourcePoolRepository}
import play.api._
import play.api.db.slick.{DatabaseConfigProvider, HasDatabaseConfigProvider}
import play.api.mvc._
import play.db.NamedDatabase
public class DL {
private static Logger log = LoggerFactory.getLogger(DL.class);
public static void main(String[] args) throws Exception {
int batchSize = 10;
File file = new File("/Users/iholsman/dl/data/out/deeplearning.1.csv");
//File file = new File("/Users/iholsman/dl/src/Canova/canova-api/src/test/resources/iris.libsvm");
FileSplit fileSplit = new FileSplit(file);
Configuration conf = new Configuration();
conf.set(FileRecordReader.APPEND_LABEL, "true");
RecordReader libSvmRecordReader = new LibSvmRecordReader();
IMAGE CREATED CREATED BY SIZE
7833f968b4947a1f3afa17310e40a17d5a65efd1d499ee932330926c5f41f440 10 days ago /bin/sh -c #(nop) CMD [apache2 -DFOREGROUND] 0 B
8768d709f4174518805c988c4fc5256286d27a5df9b65649d1da84126f9b1947 10 days ago /bin/sh -c #(nop) EXPOSE map[80/tcp:{}] 0 B
5558d195c659515eb9d205991c17f096ce94a5b1cd7ef4631fc1c66d9f6c17d5 10 days ago /bin/sh -c #(nop) ENTRYPOINT [/usr/src/wordpress/docker-entrypoint.sh] 0 B
622d0a732c5e7b1
@kryton
kryton / PrintFactor.m
Created October 8, 2012 06:22
Print Factor
% Copyright (C) Daphne Koller, Stanford University, 2012
function [] = PrintFactor(F)
% Pretty print the factor F.
% The first row lists the variables and subsequent rows are
% the joint assignment and their associated factor value in
% the last column.
for i=1:length(F.var)
fprintf(1, '%d\t', F.var(i));