Skip to content

Instantly share code, notes, and snippets.

View simonharrer's full-sized avatar
🏠
Mob Programming from my Home Office

Dr. Simon Harrer simonharrer

🏠
Mob Programming from my Home Office
View GitHub Profile
@simonharrer
simonharrer / gist:1006407
Created June 3, 2011 14:18
jruby on rails with sqlite3 on windows config
# Use simple JRuby 1.6.3 and Rails 3.0.7 to work on windows with sqlite3
# Add these gems to enable using jruby with sqlite3
gem 'activerecord-jdbcsqlite3-adapter'
gem 'jdbc-sqlite3'
gem 'jruby-openssl'
# Use old rake to let it work
gem 'rake', '0.8.7'
@simonharrer
simonharrer / gist:1173228
Created August 26, 2011 11:29
Use JRuby to create a Java Soap Web Service
require 'java'
require 'jruby/core_ext'
module WS
class WebService
def test()
puts "Call received at #{Time.new}"
# x = Result.new
# x.name = "asdf"
# return x
@simonharrer
simonharrer / gist:1322165
Created October 28, 2011 12:33
Calculation of the possibilities having three processes with 3, 3 and 2 steps being interleaved.
import groovy.util.PermutationGenerator;
import java.util.LinkedList;
import java.util.List;
import com.google.common.collect.Ordering;
public class Choice {
public static void main(String[] args) {
@simonharrer
simonharrer / gist:1525101
Created December 27, 2011 21:04
Reading Image Metadata from an image file
package de.feki.layout.timeinserter;
import java.io.File;
import java.io.IOException;
import java.io.StringWriter;
import javax.imageio.ImageIO;
import javax.imageio.ImageReader;
import javax.imageio.metadata.IIOMetadata;
import javax.xml.transform.OutputKeys;
@simonharrer
simonharrer / clean.bat
Created March 5, 2012 10:05
Latex cleanup file
rm *.aux
rm *.bbl
rm *.log
rm *.pdf
rm *.pgf
rm *.dvi
rm *.synctex*
rm *.toc
rm *.blg
@simonharrer
simonharrer / RecursiveUnzipper.groovy
Created June 20, 2012 11:43
Extracts zip files recursively to enable deep comparison of zips within zip files.
/**
* Extracts zip files recursively (zips within zip files too).
*/
class RecursiveUnzipper {
public static void main(String[] args) {
if(args != 3){
println "Usage: TARGET LEFT RIGHT"
}
@simonharrer
simonharrer / XmlAnalyzer.groovy
Created June 21, 2012 14:13
Counting the nodes in an xml file
class XmlAnalyzer {
public static final String[] commonNodes = ["process", "partnerLinks", "partnerLink", "variable", "variables", "import"]
public static void main(String[] args) {
if(args.length != 2){
throw new IllegalArgumentException("Usage: PATH EXTENSION")
}
analyzeFilesInDirectory(new File(args[0]),args[1])
@simonharrer
simonharrer / gist:3163807
Created July 23, 2012 14:10
Array to latex itemize items.
["array","of","elems"].sort().each {
elem -> println "\\item \\tr{" + elem + "}"
}
@simonharrer
simonharrer / gist:3878494
Created October 12, 2012 10:01
comparing xml files with xmllint and diff for specific use case
# requires xmllint and diff to be in the PATH
class Test
BPELVAL_DIR = "c:/projects/bpelval-proj/tool/Testcases"
BETSY_DIR = "c:/projects/betsy/src/main/tests/language-features"
def self.compute_wsdl_diffs
main_wsdl = "#{BETSY_DIR}/TestInterface.wsdl"
partner_wsdl = "#{BETSY_DIR}/TestPartner.wsdl"
@simonharrer
simonharrer / Calculator.java
Created October 31, 2012 09:32
Simple Calculator as a Java Webservice
import javax.jws.WebService;
import javax.xml.ws.Endpoint;
@WebService
public class Calculator {
public static void main(String[] args) {
Calculator.calculate(1, 1, "ADD");
Calculator.calculate(2, 3, "MULT");
Calculator.calculate(5, 2, "asdf");