Skip to content

Instantly share code, notes, and snippets.

@ern
ern / ReleasingSakai
Last active August 29, 2015 14:02
Sakai Release Process
Releasing sakai involves changing versions and creating tags and deploying artifacts to maven repo's.
* maybe a snippet why maven release plugin is a pain and can't be used see http://axelfontaine.com/blog/final-nail.html
- Versioning the new version
For this task we will leverage the maven versions plugin http://mojo.codehaus.org/versions-maven-plugin/
When a branch is ready to be made a version the first thing is to update versions
In order to ensure all the versions were updated accuratley its important to find out how many versions there currently are with something like:
@ern
ern / gist:c50c534734c2d9cb25fa
Created May 12, 2015 21:51
Shell script for merging from git to subversion
gitmerge() {
#Commands this needs
CURL=`which curl`
GREP="/usr/bin/grep"
AWK=`which awk`
TR=`which tr`
UNIQ=`which uniq`
SVN=`which svn`
MKTEMP=`which mktemp`
CUT=`which cut`
@ern
ern / pom.xml
Created July 23, 2015 19:45
Tomcat Executable War sample POM
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<groupId>com.rsmart</groupId>
<artifactId>dashboard</artifactId>
<version>1.9.3-SNAPSHOT</version>
<packaging>war</packaging>
<name>rSmart Client Dashboard</name>
<dependencies>
<dependency>
@ern
ern / git-mv-with-history
Last active September 1, 2015 13:27 — forked from emiller/git-mv-with-history
git utility to move/rename file or folder and retain history with it.
#!/bin/bash
#
# git-mv-with-history -- move/rename file or folder, with history.
#
# Moving a file in git doesn't track history, so the purpose of this
# utility is best explained from the kernel wiki:
#
# Git has a rename command git mv, but that is just for convenience.
# The effect is indistinguishable from removing the file and adding another
# with different name and the same content.
@ern
ern / WS stack
Created September 10, 2015 20:00
2015-09-10 15:42:50,169 WARN http-nio-8080-exec-8 org.apache.cxf.phase.PhaseInterceptorChain - Application {http://webservices.sakaiproject.org/}SakaiLoginService#{http://webservices.sakaiproject.org/}lo
gin has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Unable to login
at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:162)
at org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.createFault(AbstractJAXWSMethodInvoker.java:213)
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:128)
at org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.invoke(AbstractJAXWSMethodInvoker.java:178)
at org.apache.cxf.jaxws.JAXWSMethodInvoker.invoke(JAXWSMethodInvoker.java:68)
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:75)
at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)
@ern
ern / pom.xml
Created September 14, 2015 20:43
Sakai RPM
<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>master</artifactId>
<groupId>org.sakaiproject</groupId>
<version>10.4</version>
<relativePath>master/pom.xml</relativePath>
</parent>
#!/bin/sh
exec scala "$0" "$@"
!#
import scala.xml.{Elem,XML}
class SoapClient {
private def error(msg: String) = {
println("SoapClient error: " + msg)
}
@ern
ern / SakaiSessionEstimator
Created April 6, 2016 14:49
Estimates the size of attributes in the session
diff --git a/kernel/kernel-impl/pom.xml b/kernel/kernel-impl/pom.xml
index f5e5a64..b0b1d65 100644
--- a/kernel/kernel-impl/pom.xml
+++ b/kernel/kernel-impl/pom.xml
@@ -312,6 +312,11 @@
<scope>compile</scope>
</dependency>
-->
+ <dependency>
+ <groupId>com.carrotsearch</groupId>
@ern
ern / cron.html
Last active June 17, 2016 21:40
Cron Triggers
<h1>CronTrigger Tutorial</h1>
<h2>Introduction</h2>
<p><tt>cron</tt> is a UNIX tool that has been around for a long time, so its scheduling capabilities are powerful
and proven. The <tt>CronTrigger</tt> class is based on the scheduling capabilities of cron.</p>
<p><tt>CronTrigger</tt> uses “cron expressions”, which are able to create firing schedules such as: “At 8:00am every
Monday through Friday” or “At 1:30am every last Friday of the month”.</p>
@ern
ern / gist:34e44b9933a3ff6f31088a91a578ae9f
Created October 5, 2017 20:26
Simulate a slow resource
private void traceSimulateDelay(long delay) {
// log the caller
String thisClassName = this.getClass().getName();
StackTraceElement[] ste = Thread.currentThread().getStackTrace();
StringBuilder callee = new StringBuilder("PERFORMANCE[-{}] called by ");
for (int i = 2; i <= ste.length; i++) {
// 0 is Thread.getStackTrace()
// 1 is this method
String className = ste[i].getClassName();
String shortClassName = className.substring(className.lastIndexOf(".") + 1);