Skip to content

Instantly share code, notes, and snippets.

@nilsmagnus
nilsmagnus / simpleWsdlToJava.groovy
Last active July 14, 2016 02:21
WsdlToJava for simple projects. Time consuming if you have many wsdls, but good enough.
project.ext{
cxfVersion = '2.5.1'
generatedWsdlDir = file("build/generated-sources")
wsdlDir = file("wsdl")
wsdlsToGenerate =[
['-xjc', '-b', "$wsdlDir/serializable_binding.xml", "$wsdlDir/mywsdl1.wsdl.xml"],
['-xjc', '-b', "$wsdlDir/some_binding.xml", "$wsdlDir/mywsdl2.xml"],
['-xjc', '-b', "$wsdlDir/joda_binding.xml", "$wsdlDir/mywsdl3.wsdl.xml"],
// 55 more wsdls
]
@nilsmagnus
nilsmagnus / fasterWsdlToJava.groovy
Last active January 18, 2019 02:01
Fast wsdl2java with gradle and many wsdl files.
buildscript {
repositories {
mavenCentral()
}
}
project.ext {
wsdlDir = file("wsdl")
generatedWsdlDir = file("build/generated-sources")
@nilsmagnus
nilsmagnus / FindJarOfClass.java
Created February 16, 2013 09:40
Finding the jar of a specific class.
private String getPath(Class cls) {
String cn = cls.getName();
String rn = cn.replace('.', '/') + ".class";
String path = getClass().getClassLoader().getResource(rn).getPath();
int ix = path.indexOf("!");
if(ix >= 0) {
return path.substring(0, ix);
} else {
return path;
}
@nilsmagnus
nilsmagnus / interfaces
Last active December 16, 2015 18:19
raspberry pi wpa / wifi config, /etc/networking/interfaces
auto lo
iface lo inet loopback
iface eth0 inet dhcp
allow-hotplug wlan0
#iface wlan0 inet manual
iface wlan0 inet dhcp
wpa-ssid "my_network_name"
wpa-psk "my_password"
import time
import subprocess
import RPi.GPIO as io
io.setmode(io.BCM)
pir_pin = 18
io.setup(pir_pin, io.IN) # activate input
@nilsmagnus
nilsmagnus / takeapic.sh
Created August 8, 2013 18:37
take a picture from raspicam and upload to temploggerweb
#!/bin/bash
TIMESTAMP=`date`
raspistill -t 0 -w 640 -h 480 -q 70 -ex sports -o "image.jpg"
url=`curl http://temploggerweb.appspot.com/imageapi?url=get`
curl $url -X POST -F imageFile=@"image.jpg" -o imageuploadresult.txt
#curl http://temploggerweb.appspot.com/imageapi -X POST -F myFile=@"image.jpg"
@nilsmagnus
nilsmagnus / readtemp_loop.sh
Created August 8, 2013 18:38
reading temp from temp sensor on rapsi pi
#!/bin/bash
while true; do
TIME=`date +%Y:%m:%d:%H:%S`
TEMP=`cat /sys/bus/w1/devices/28-000004b57f7c/w1_slave | grep t= | cut -c30-34 `
echo $TIME $TEMP
sleep 30
done
@nilsmagnus
nilsmagnus / gist:7659424
Created November 26, 2013 14:40
Privacy policy
Do we use cookies?
We do not use cookies.
Do we disclose any information to outside parties?
We do not sell, trade, or otherwise transfer to outside parties your personally identifiable information. This does not include trusted third parties who assist us in operating our website, conducting our business, or servicing you, so long as those parties agree to keep this information confidential. We may also release your information when we believe release is appropriate to comply with the law, enforce our site policies, or protect ours or others rights, property, or safety. However, non-personally identifiable visitor information may be provided to other parties for marketing, advertising, or other uses.
@nilsmagnus
nilsmagnus / AppengineExecutor.java
Last active August 31, 2019 20:45
Appengine executorservice usage
package no.nilsapp.someapp.cronjobs;
import com.google.appengine.api.ThreadManager;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
@nilsmagnus
nilsmagnus / bindings.xml
Created April 28, 2014 06:30
Wsdl2Java Cxf Binding File to Rename Complextype
<?xml version="1.0" encoding="UTF-8"?>
<jaxws:bindings xmlns:jaxws="http://java.sun.com/xml/ns/jaxws" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:jxb="http://java.sun.com/xml/ns/jaxb" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<jaxws:bindings node="wsdl:definitions/wsdl:types/xsd:schema[1]">
<jxb:bindings node="//xs:complexType[@name='VatNumber_exception']">
<jxb:class name="VatNumException"/>
</jxb:bindings>
</jaxws:bindings>
</jaxws:bindings>