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
### R functions to consume the KeyPathwayMinerWeb RESTful API ### | |
### Authors: Markus List and Martin Dissing-Hansen ### | |
# Package dependencies. Make sure those are installed | |
library(RCurl) | |
library(rjson) | |
library(foreach) | |
# Helper method for base64 encoding. Needed to transfer network and dataset files # | |
base64EncFile <- function(fileName){ |
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
cd /tmp/somefiles | |
tar -cv * | docker exec -i elated_hodgkin tar x -C /var/www |
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
#!/bin/bash | |
EXPECTED_ARGS=3 | |
E_BADARGS=65 | |
MYSQL=`which mysql` | |
Q1="CREATE DATABASE IF NOT EXISTS $1;" | |
Q2="GRANT USAGE ON *.* TO $2@localhost IDENTIFIED BY '$3';" | |
Q3="GRANT ALL PRIVILEGES ON $1.* TO $2@localhost;" | |
Q4="FLUSH PRIVILEGES;" |
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
awk -F, '$1 !~ /(^CDS|^UTR3)/' microT_CDS_data.csv > microT_CDS_data.filtered.csv |
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
dataSource { | |
driverClassName = 'com.mysql.jdbc.Driver' | |
url = 'jdbc:mysql://localhost/miracle' | |
username = 'miracle' | |
password = 'rppa4ever' | |
dbCreate = 'update' | |
pooled = true | |
properties { | |
maxActive = -1 | |
minEvictableIdleTimeMillis=1800000 |
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
authenticate <- function(baseUrl="http://localhost:8080/GrailsApp/", user, password, verbose=F){ | |
require(RCurl) | |
loginUrl = paste(baseUrl, "login/auth", sep="") | |
authenticateUrl = paste(baseUrl, "j_spring_security_check", sep="") | |
cat(paste("trying to authenticate user", user)) | |
agent="Mozilla/5.0" | |
#Set RCurl pars | |
curl = getCurlHandle() |
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
private def accessAllowed = { securityToken, uuid -> | |
//check if user is authenticated | |
if(!springSecurityService.isLoggedIn()){ | |
//alternatively check if a security token is provided | |
if(!securityToken || securityToken != uuid){ | |
return(false) | |
} | |
} | |
return(true) |
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
class SecurityTokenService { | |
def getSecurityToken(SomeDomainClass sdc) { | |
if(!sdc?.uuid){ | |
sdc.uuid = UUID.randomUUID().toString() | |
sdc.save(flush:true) | |
} | |
return sdc.uuid | |
} |
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 criteria = SomeDomainClass.createCriteria() | |
def result = criteria.list { | |
... | |
} | |
ObjectMapper mapper = new ObjectMapper() | |
def jsonResult = mapper.writeValueAsString(result) | |
response.contentType = "text/json" | |
render jsonResult |
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 criteria = Spot.createCriteria() | |
def result = criteria.list { | |
eq("slide.id", params.long("id")) | |
createAlias('layoutSpot', 'lSpot', CriteriaSpecification.LEFT_JOIN) | |
createAlias('lSpot.sample', 'smpl', CriteriaSpecification.LEFT_JOIN) | |
projections { | |
property "id" | |
property "signal" | |
property "block" | |
property "row" |