Skip to content

Instantly share code, notes, and snippets.

View rherrick's full-sized avatar

Rick Herrick rherrick

  • Flywheel
  • St. Louis, Missouri
View GitHub Profile
@rherrick
rherrick / events.sql
Last active August 29, 2015 14:27
SQL for getting event count
SELECT event_id, event_label, total
FROM (SELECT DISTINCT
CASE pipeline_name
WHEN 'Transfer'::text
THEN 'Archive'::text
ELSE
CASE xs_lastposition('/'::text, pipeline_name::text)
WHEN 0
THEN pipeline_name
ELSE substring(substring(pipeline_name::text, xs_lastposition('/'::text, pipeline_name::text) + 1), 1, xs_lastposition('.'::text, substring(pipeline_name::text, xs_lastposition('/'::text, pipeline_name::text) + 1)) - 1)
@rherrick
rherrick / haiku.7.js
Last active February 5, 2016 19:49 — forked from anonymous/haiku.groovy
haiku script
importClass(org.nrg.xnat.turbine.utils.ArcSpecManager);
importPackage(java.io);
var cache = org.nrg.xnat.turbine.utils.ArcSpecManager.GetInstance().getCachePathForProject(externalId);
var file = new java.io.File(cache, "haiku.txt");
var writer = new java.io.PrintWriter(new FileWriter(file));
writer.println("Into the ancient pond");
writer.println("A frog jumps");
writer.println("Waters sound!");
@rherrick
rherrick / xnatdev
Created June 22, 2015 18:06
nginx configuration for Tomcat application
server {
listen xnatdev.wurstworks.com:80;
server_name xnatdev.wurstworks.com;
location / {
root /var/lib/tomcat7/webapps/xnat;
proxy_pass http://localhost:8080;
proxy_redirect http://localhost:8080 $scheme://xnatdev;
function getNominalType(scan) {
if (!scan.extension && scan.constructor.name === "xnat_imageScanData") {
return getImageScanNominalType(scan);
} else if (scan.extension) {
return getImageScanNominalType(scan.extension);
} else {
return "Unknown";
}
}
@rherrick
rherrick / Filter.java
Created April 10, 2015 17:43
Executing Javascript with ScriptEngine
package org.nrg.sandbox.filter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
import java.util.Map;
rherrick@Aerys:/var/lib/tomcat7/webapps/xnat/logs$ df -k
Filesystem 1024-blocks Used Available Capacity iused ifree %iused Mounted on
/dev/disk1 975429376 597606396 377566980 62% 149465597 94391745 61% /
devfs 189 189 0 100% 655 0 100% /dev
map -hosts 0 0 0 100% 0 0 100% /net
map auto_home 0 0 0 100% 0 0 100% /home
localhost:/glE86G90KqDxJiF-GlQgzv 975429376 975429376 0 100% 0 0 100% /Volumes/MobileBackups
xnatdev:/data 19478204 5779124 12686600 32% 221668 1023516 18% /data
xnatdev:/etc/default 19478204 5779124 12686600 32% 221668 1023516 18% /private/etc/default
xnatdev:/etc/tomcat7 19478204 5779124 12686600 32% 221668 1023
@rherrick
rherrick / xnatdev.conf
Created January 24, 2015 01:30
nginx configuration file for a Tomcat web app at the root of a domain, with a PHP app running under a subfolder
server {
listen xnatdev.wurstworks.com:80;
server_name xnatdev.wurstworks.com;
location / {
root /var/lib/tomcat7/webapps/xnat;
proxy_pass http://localhost:8080;
proxy_redirect http://localhost:8080 $scheme://xnatdev;
@rherrick
rherrick / ldap
Last active August 29, 2015 14:14
nginx conf for ldap php app and xnatdev Tomcat app
server {
listen ldap.wurstworks.com:80;
server_name ldap.wurstworks.com;
root /tmp/test
index index.php index.html index.htm;
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
try_files $uri =404;
@rherrick
rherrick / build.gradle
Last active August 29, 2015 14:10
Pipeline engine Gradle build file
import org.apache.tools.ant.filters.FixCrLfFilter
import org.apache.tools.ant.filters.ReplaceTokens
import org.apache.tools.ant.taskdefs.condition.Os
defaultTasks 'show', 'copyAll'
def isWindows = Os.isFamily(Os.FAMILY_WINDOWS)
def scriptName = isWindows ? "\$1.bat" : "\$1"
def pipelinePath = "${buildFile.parent}" as String
@rherrick
rherrick / .tmux.conf
Created November 23, 2014 20:46
tmux configuration files
unbind C-b
set -g prefix C-\\
bind | split-window -h
bind \ split-window -h
bind - split-window -v
bind _ split-window -v
bind R source-file ~/.tmux.conf \; display-message "tmux.conf reloaded!"
# Initialize session binding
bind s source-file ~/.tmux/logs