Skip to content

Instantly share code, notes, and snippets.

@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 / 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"
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 / 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"
@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 / fasterWsdlToJava.groovy
Last active September 3, 2024 04:30
Fast wsdl2java with gradle and many wsdl files.
buildscript {
repositories {
mavenCentral()
}
}
project.ext {
wsdlDir = file("wsdl")
generatedWsdlDir = file("build/generated-sources")
@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
]