This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//https://stackoverflow.com/questions/8295100/how-to-re-run-failed-junit-tests-immediately | |
public class RetryTest { | |
public class Retry implements TestRule { | |
private int retryCount; | |
public Retry(int retryCount) { | |
this.retryCount = retryCount; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "my-app", | |
"version": "1.0.0", | |
"description": "My test app", | |
"main": "src/js/index.js", | |
"scripts": { | |
"jshint:dist": "jshint src/js/*.js", | |
"jshint": "npm run jshint:dist", | |
"jscs": "jscs src/*.js", | |
"browserify": "browserify -s Validating -o ./dist/js/build.js ./lib/index.js", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// create file: | |
sudo vim /usr/share/applications/intellij.desktop | |
// add the following | |
[Desktop Entry] | |
Version=13.0 | |
Type=Application | |
Terminal=false | |
Icon[en_US]=/home/rob/.intellij-13/bin/idea.png | |
Name[en_US]=IntelliJ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List all variables in git: | |
git config --list | |
To save the output of a command as variable in bash, use command substitution $(): | |
GIT_NAME="$(git config --global user.name)" | |
GIT_PASSWORD="$(git config --global user.password)" | |
GIT_EMAIL="$(git config --global user.email)" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
redis-cli -h localhost CLIENT LIST | awk {'print $2'} | grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' | sort | uniq -c | sort | |
#Output | |
1 10.11.0.62 | |
1 192.168.171.9 | |
2 192.168.170.28 | |
5 192.168.170.109 | |
9 192.168.171.7 | |
10 10.11.0.220 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.lang.reflect.Field; | |
public static boolean setPrivateFields(Object object, String fieldName, Object fieldValue) { | |
Class<?> clazz = object.getClass(); | |
while (clazz != null) { | |
try { | |
Field field = clazz.getDeclaredField(fieldName); | |
field.setAccessible(true); | |
field.set(object, fieldValue); | |
return true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//<dependency> | |
// <groupId>commons-io</groupId> | |
// <artifactId>commons-io</artifactId> | |
// <version>2.4</version> | |
//</dependency> | |
import org.apache.commons.io.IOUtils; | |
import java.io.InputStream; | |
public String getContentString(String fileName) throws IOException { |