Skip to content

Instantly share code, notes, and snippets.

View barend's full-sized avatar
☀️

Barend Garvelink barend

☀️
View GitHub Profile
@barend
barend / gist:6791274
Created October 2, 2013 09:34
Find string literals in smali
find . -name '*.smali' \
| grep -vE 'actionbarsherlock|watson|support' \
| xargs grep -F const-string \
| awk '{ print substr($0, index($0, "\"")) }' \
| sort \
| uniq
@barend
barend / gist:1018771
Created June 10, 2011 12:44
Burgerservicenummer Elfproef Validator
/** Validate BSN according to http://nl.wikipedia.org/wiki/Burgerservicenummer */
private boolean isValidBSN(int candidate) {
if (candidate <= 9999999 || candidate > 999999999) {
return false;
}
int sum = -1 * candidate % 10;
for (int multiplier = 2; candidate > 0; multiplier++) {
int val = (candidate /= 10) % 10;
sum += multiplier * val;
@barend
barend / OnlyOnWindowsRunner.java
Created March 10, 2011 17:26
A JUnit Runner that behaves like the default runner on Windows and ignores all tests on other operating systems.
//http://www.apache.org/licenses/LICENSE-2.0
package nl.fnord.junit;
import org.junit.runner.notification.RunNotifier;
import org.junit.runners.BlockJUnit4ClassRunner;
import org.junit.runners.model.FrameworkMethod;
import org.junit.runners.model.InitializationError;
/**
* A JUnit {@code Runner} that behaves like the default runner on Windows and