Skip to content

Instantly share code, notes, and snippets.

@sffej
sffej / raspberry-pi-edimax-wifi-and-motion-sensor.md
Created May 30, 2016 05:36 — forked from eduardschaeli/raspberry-pi-edimax-wifi-and-motion-sensor.md
My notes on setting up a Raspberry Pi with an Edimax EW-7811UN WiFi Dongle and motion sensors

Raspberry Pi, WiFi and motion sensors

My notes on setting up a Raspberry Pi with an Edimax EW-7811UN WiFi Dongle and motion sensors.

We intend to use a few Raspberry Pis around the office, in order to find out if certain rooms are beeing used or not. For this, we need to get WiFi and a motion sensor working.

@sffej
sffej / Git checkout remote branch
Created June 8, 2016 01:31 — forked from markSci5/Git checkout remote branch
Git checkout remote branch
//To fetch a branch, you simply need to:
git fetch origin
//This will fetch all of the remote branches for you. With the remote branches
//in hand, you now need to check out the branch you are interested in, giving
//you a local working copy:
git checkout -b test origin/test
@sffej
sffej / git-clean
Created June 8, 2016 01:34 — forked from markSci5/git-clean
Delete all untracked files and folders in git
git clean -f
If you want to also remove directories, run git clean -f -d.
If you just want to remove ignored files, run git clean -f -X.
If you want to remove ignored as well as non-ignored files, run git clean -f -x.
Note the case difference on the X for the two latter commands.
If clean.requireForce is set to "true" (the default) in your configuration, then unless you specify -f nothing will actually happen, with a recent enough version of git.
@sffej
sffej / install-gradle-centos.sh
Created June 8, 2016 21:22 — forked from parzonka/install-gradle-centos.sh
Install gradle on redhat/centos linux
# installs to /opt/gradle
# existing versions are not overwritten/deleted
# seamless upgrades/downgrades
# $GRADLE_HOME points to latest *installed* (not released)
gradle_version=2.9
wget -N https://services.gradle.org/distributions/gradle-${gradle_version}-all.zip
sudo unzip -foq gradle-${gradle_version}-all.zip -d /opt/gradle
sudo ln -sfn gradle-${gradle_version} /opt/gradle/latest
sudo printf "export GRADLE_HOME=/opt/gradle/latest\nexport PATH=\$PATH:\$GRADLE_HOME/bin" > /etc/profile.d/gradle.sh
. /etc/profile.d/gradle.sh
@sffej
sffej / build.gradle
Created July 7, 2016 21:01 — forked from yusuke2255/build.gradle
Jmockit + gradle test
configurations { jmockit }
dependencies {
jmockit ('com.googlecode.jmockit:jmockit:1.7')
testCompile ('junit:junit:4.11')
}
test {
// jmockitがjunitよりも前にclasspathが通ってる必要があるので下記の対応を行っています
@sffej
sffej / simpleWsdlToJava.groovy
Created July 14, 2016 02:21 — forked from nilsmagnus/simpleWsdlToJava.groovy
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
]
@sffej
sffej / markov.java
Created July 27, 2016 23:23 — forked from veryphatic/markov.java
Simple Markov chain text generator
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Hashtable;
import java.util.Random;
import java.util.Vector;
public class Markov {
@sffej
sffej / RestProxyTemplate.java
Created July 28, 2016 00:18 — forked from davidtimmerman/RestProxyTemplate.java
Spring RestTemplate with proxy settings
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
import javax.annotation.PostConstruct;
@sffej
sffej / log4j.properties
Created August 20, 2016 04:08 — forked from kdabir/log4j.properties
a minimal log4j config file
log4j.rootLogger=INFO, CONSOLE
# CONSOLE is set to be a ConsoleAppender using a PatternLayout
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=[%-5p] %m%n
# a more detailed PatternLayout: %d [%t] %-5p %c - %m%n
# adjust specific logger levels as per the need to control the verbosity of logs
@sffej
sffej / README.rst
Created October 21, 2016 01:23 — forked from dupuy/README.rst
Common markup for Markdown and reStructuredText

Markdown and reStructuredText

GitHub supports several lightweight markup languages for documentation; the most popular ones (generally, not just at GitHub) are Markdown and reStructuredText. Markdown is sometimes considered easier to use, and is often preferred when the purpose is simply to generate HTML. On the other hand, reStructuredText is more extensible and powerful, with native support (not just embedded HTML) for tables, as well as things like automatic generation of tables of contents.