Skip to content

Instantly share code, notes, and snippets.

View ChristopherDavenport's full-sized avatar

Christopher Davenport ChristopherDavenport

View GitHub Profile
@ChristopherDavenport
ChristopherDavenport / example.scala
Last active February 28, 2016 17:33
Scala Problem
def reverse[A](as: List[A]): List[A] = {
foldLeft(as, List[A]())((acc, x) => x::acc)
}
def foldRightFromFoldLeft[A,B](as: List[A], z:B)(f:(B, A) => B):B ={
foldLeft(reverse(as), z)((onlyNil, x) =>f(onlyNil, x) )
}
// The Problem Child
// Type checker has a problem with both x.toString :: onlyNil or as seen below.
@ChristopherDavenport
ChristopherDavenport / Dockerfile
Last active March 7, 2016 02:39
An example of a very small EIS Deploy Utilizing Alpine
FROM gliderlabs/alpine:latest
MAINTAINER Christopher Davenport <ChristopherDavenport@outlook.com>
ENV JAVA_VERSION=7 \
JAVA_UPDATE=79 \
JAVA_BUILD=15 \
JAVA_HOME=/usr/lib/jvm/default-jvm \
PATH=${PATH}:${JAVA_HOME}/bin
RUN apk add --update wget ca-certificates dnsmasq && \
@ChristopherDavenport
ChristopherDavenport / VAGRANTFILE
Created March 10, 2016 04:32
Test Vagrant for Play Environment
#Vagrantfile AP/sytnax version
VAGRANTFILE_API_VERSION = "2"
$script = <<SCRIPT
yum install -y wget
#JAVA
wget --no-check-certificate --no-cookies --head "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u74-b02/jdk-8u74-linux-x64.rpm
yum localinstall -y jdk-8u74-linux-x64.rpm
rm -f jdk-8u74-linux-x64.rpm
@ChristopherDavenport
ChristopherDavenport / application.conf
Created May 27, 2016 16:34
Slick SQL Server Config
sqlserver = {
driver = "com.typesafe.slick.driver.ms.SQLServerDriver$"
db {
driver = "com.microsoft.sqlserver.jdbc.SQLServerDriver"
host = ""
port = ""
databaseName = ""
url = "jdbc:sqlserver://"${sqlserver.db.host}":"${sqlserver.db.port}";databaseName="${sqlserver.db.databaseName}
user = ""
def deleteGroupsExample(currentGoogleGroups: Seq[Group]) = {
val set: Set[String] = currentGoogleGroups.map(_.id.get).toSet
db.run(googleGroups.result).flatMap { groups =>
Future.sequence{
groups.withFilter( group => !set.contains(group.id))
.map{ group =>
db.run(queryGoogleGroupsTableById(group.id).delete)
}
}
}
@ChristopherDavenport
ChristopherDavenport / PcarnBase.sql
Last active July 11, 2016 14:28
A generic schema for the PcarnBase Application
CREATE TABLE NCBI_Annotation
(
UnigeneID VARCHAR(32) PRIMARY KEY NOT NULL,
Description VARCHAR(255) NOT NULL,
ProteinsPID VARCHAR(32) NOT NULL
);
CREATE TABLE Proteins
(
PID VARCHAR(32) PRIMARY KEY NOT NULL,
@ChristopherDavenport
ChristopherDavenport / recompileAll.sh
Created July 15, 2016 19:05
Recompile All Banner Modules Script
#!/bin/bash
# This script moves to recompile all of the Banner Jobsub components.
# This function executes the file if it exists.
function ifFileExistsExecute(){
if [ -f "$1" ]; then
if $1 ; then
echo "$1 compiled"
Saved For Posterity
val futurePidmXor: Future[Xor[MissingPersonContact, BigDecimal]] = convertedContact
.bimap(Future.successful, x => pidmResponder(x.BannerID))
.bisequence
.map(_.flatMap(Xor.fromOption(_, missingPersonContact)))
@ChristopherDavenport
ChristopherDavenport / main.yml
Last active August 18, 2016 12:57
Do different stuff with Yum
- name: Install Something and Uninstall something else
yum:
name={{ item.name }}
state={{ item.state | default(present) }}
with_items:
- { name: 'program1', state: 'latest' }
- { name: 'program2'}
- { name: 'program3', state: 'absent' }
@ChristopherDavenport
ChristopherDavenport / Example.scala
Created September 28, 2016 21:54
Example For Meetup Group
type ID[A] = A