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
var app = { | |
build: 'build', | |
root: '', | |
dist: 'build/dist' | |
}; | |
grunt.initConfig({ | |
app: app, | |
//create a war file in zip format. compress does not support it currently. | |
compress: { |
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
"under_to_camel".replace(/(_)([a-z])/g, function(a, b,c){return c.toUpperCase()}); | |
"underToCamel".replace(/([A-Z])/g, function(a,b){return "_"+b.toLowerCase();}) |
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 byte[] readResource(final String resource) throws Exception { | |
LoadingCache<String, byte[]> cache = CacheBuilder.newBuilder() | |
.expireAfterAccess(2L, TimeUnit.MINUTES) | |
.ticker(Ticker.systemTicker()) | |
.build(new CacheLoader<String, byte[]>() { | |
@Override | |
public byte[] load(String key) throws Exception { | |
return ByteStreams.toByteArray(new ClassPathResource(resource).getInputStream()); |
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
@echo off | |
if "%1" == "" goto v1 | |
set JAVA_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=%1,suspend=n %JAVA_OPTS% | |
goto end | |
:v1 | |
set JAVA_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8199,suspend=n %JAVA_OPTS% |
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 class HashStressCalculation { | |
public static final Logger LOGGER = LoggerFactory.getLogger(HashStressCalculation.class); | |
private void hashRun(String name, HashFunction hash) { | |
long timeNow = System.nanoTime(); | |
for (int i = 0; i < 1000000; i++) { | |
StringBuilder builder = new StringBuilder() | |
.append(UUID.randomUUID().toString()) | |
.append(UUID.randomUUID().toString()) |
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
#remove if exist | |
if (outcome == "success") of /subsystem=datasources/data-source=myDB:read-resource() | |
data-source remove --name=myDB | |
end-if | |
#security domain | |
if (result == "default") of /subsystem=security/security-domain=myDBDomain:read-attribute(name=cache-type) | |
/subsystem=security/security-domain=myDBDomain:remove | |
end-if |
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
apply plugin:'idea' | |
apply plugin:'scala' | |
apply plugin:'application' | |
project.ext{ | |
scalaVersion = '2.10.4' | |
} | |
dependencies { | |
compile 'org.slf4j:slf4j-api:1.7.5' | |
compile "org.scala-lang:scala-library:$scalaVersion" | |
compile "org.scala-lang:scala-compiler:$scalaVersion" |
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 = LOAD 'nyse_stocks' USING org.apache.hcatalog.pig.HCatLoader(); | |
b = FILTER a BY stock_symbol == 'IBM'; | |
c = GROUP b all; | |
d = FOREACH c GENERATE AVG(b.stock_volume); | |
dump d; |
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
batting = LOAD 'Batting.csv' USING PigStorage(','); | |
raw_runs = FILTER batting BY $1>0; | |
runs = FOREACH raw_runs GENERATE $0 AS playerId, $1 AS year, $8 AS runs; | |
grp_data = GROUP runs BY (year); | |
max_runs = FOREACH grp_data GENERATE group as grp, MAX(runs.runs) as max_runs; | |
join_max_runs = JOIN max_runs BY ($0, max_runs), runs BY (year, runs); | |
join_data = FOREACH join_max_runs GENERATE $0 AS year, $2 AS playerId, $1 AS runs; | |
DUMP join_data; |
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
#run in detached mode | |
docker run -d -p 8888:8888 opscenter | |
#run cassandra manually | |
docker run -p 9160:9160 -i -t cassandra | |
. /opt/local/datastax/dse-4.5.1/resources/cassandra/conf/addip.sh | |
#Ctrl C-> | |
rerun using "dse cassandra" | |
OlderNewer