This file contains 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
ssh user@host "sh script.sh </dev/null >/dev/null 2>/dev/null &" |
This file contains 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
//a[@class="list"]/@href |
This file contains 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 table configuration(key varchar(50), val varchar(100)); | |
merge INTO configuration t USING --- table name configuration | |
(SELECT | |
substr(keyVal,1, instr(keyVal,'=')-1) key | |
, substr(keyVal,instr(keyVal,'=')+1) val | |
----- add other columns | |
from (select 'key=val' keyVal FROM dual) d ------- replace key=val | |
) s ON ( s.key = t.key ) |
This file contains 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
curl --user username:password -k https://URL 2>&1 | xidel - -e '//a[@class="list"]/b' 2>/dev/null |
This file contains 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
DB_URL=jdbc:h2:mem:datasource;MODE=Oracle;INIT=runscript from 'classpath:/sql/h2.creation.sql' | |
h2.creation.sql | |
------------------------- | |
runscript from 'classpath:/testing/beforeclass/001-init.sql'; -- from class path | |
runscript from '~/001-init.sql'; --from ${user.home} |
This file contains 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
#### http://stackoverflow.com/a/246128/1669145 | |
SOURCE="${BASH_SOURCE[0]}" | |
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink | |
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" | |
SOURCE="$(readlink "$SOURCE")" | |
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located | |
done | |
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" |
This file contains 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 org.testng.annotations.DataProvider; | |
import org.testng.annotations.Test; | |
import static org.testng.Assert.assertEquals; | |
import static org.testng.Assert.assertTrue; | |
public class TestNGParameterisedTest { | |
@Test(dataProvider = "parseIntInputs") | |
public void testInt(String input, Object expected){ |
This file contains 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
public static <T> T testSerialisation(Class<? extends T> type, T expected) { | |
Serializer serializer = new Persister(); | |
StringWriter sw = new StringWriter(); | |
T actual = null; | |
try { | |
serializer.write(expected, sw); | |
} catch (Exception ex) { | |
LOG.error("testing serialisation failed", ex); | |
Assert.fail("testing serialisation failed"); | |
} |
This file contains 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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE log4j:configuration PUBLIC "-//APACHE//DTD LOG4J 1.2//EN" "log4j.dtd"> | |
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> | |
<!-- Appenders --> | |
<appender name="console" class="org.apache.log4j.ConsoleAppender"> | |
<param name="Target" value="System.out" /> | |
<layout class="org.apache.log4j.EnhancedPatternLayout"> | |
<param name="ConversionPattern" value="%-5p: %c{1.} - %.1000m%n" /> | |
</layout> |
This file contains 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 com.google.common.collect.ImmutableList; | |
import com.google.common.collect.Iterables; | |
import java.util.List; | |
public class CollectionUtil { | |
public static <T> List<T> getImmutableNonNullList(List<T> list) { | |
return isEmpty(list) ? ImmutableList.<T>of() : ImmutableList.copyOf(list); | |
} |
OlderNewer