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"?> | |
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>asgard</groupId> | |
<artifactId>asgard</artifactId> | |
<version>1.0.0-SNAPSHOT</version> | |
<inceptionYear>2008</inceptionYear> | |
<licenses> | |
<license> |
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.apache.commons.lang3.builder.ToStringBuilder; | |
import org.apache.commons.lang3.builder.ToStringStyle; | |
import org.deeplearning4j.nn.api.OptimizationAlgorithm; | |
import org.deeplearning4j.nn.conf.NeuralNetConfiguration; | |
import org.deeplearning4j.nn.conf.layers.DenseLayer; | |
import org.deeplearning4j.nn.gradient.Gradient; | |
import org.deeplearning4j.nn.graph.ComputationGraph; | |
import org.deeplearning4j.nn.weights.WeightInit; | |
import org.deeplearning4j.nn.workspace.LayerWorkspaceMgr; | |
import org.deeplearning4j.optimize.listeners.ScoreIterationListener; |
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.deeplearning4j.nn.conf.ComputationGraphConfiguration; | |
import org.deeplearning4j.nn.conf.NeuralNetConfiguration; | |
import org.deeplearning4j.nn.conf.layers.DenseLayer; | |
import org.deeplearning4j.nn.gradient.Gradient; | |
import org.deeplearning4j.nn.graph.ComputationGraph; | |
import org.deeplearning4j.nn.weights.WeightInit; | |
import org.deeplearning4j.nn.workspace.LayerWorkspaceMgr; | |
import org.deeplearning4j.optimize.listeners.ScoreIterationListener; | |
import org.nd4j.linalg.activations.Activation; | |
import org.nd4j.linalg.api.ndarray.INDArray; |
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
/** | |
* > arr = {1, 2, 3}, size = 5 | |
* < [1.0, 1.5, 2.0, 2.5, 3.0] | |
* @param arr | |
* @param newSize | |
* @return | |
*/ | |
public static double[] growIntermediate(double[] arr, int newSize) { | |
if (newSize < arr.length) { | |
throw new IllegalArgumentException("newSize lower than array length"); |
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
int __main__ (int var0) | |
vars: int var1, int var2, int var3 | |
var2 = 2 | |
if (((var0 - 2) % 3) == 0) | |
var1 = 1 | |
else | |
var1 = 0 | |
var3 = 1 | |
for(; (var3<var0); var3 = (var3 + 1)) | |
if (var2<var0) |
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
static class CacheOp implements Op<Double> { | |
private final AtomicDouble ref; | |
public CacheOp(int i) { | |
ref = new AtomicDouble(i); | |
} | |
public CacheOp() { | |
this(0); | |
} |
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 static java.util.stream.IntStream.range; | |
import static java.util.stream.IntStream.rangeClosed; | |
private List<String> possibleNgrams(String[] words) { | |
return rangeClosed(1, words.length) | |
.mapToObj( | |
window -> | |
rangeClosed(0, words.length - window) | |
.mapToObj( | |
i -> |
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
Groovy also has a Time Category class which gives you DSL style syntax for manipulating dates. Here is an example: | |
import org.codehaus.groovy.runtime.TimeCategory | |
now = new Date() | |
println now | |
use(TimeCategory) { | |
footballPractice = now + 1.week - 4.days + 2.hours - 3.seconds | |
} | |
println footballPractice | |
which will produce output like this: |
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 Observable<Long> write(Path target, InputStream inputStream) { | |
return Observable.create(subscriber -> { | |
try { | |
final AtomicLong offset = new AtomicLong(0); | |
AsynchronousFileChannel afc = AsynchronousFileChannel.open(Utils.home.resolve(target), StandardOpenOption.WRITE, | |
StandardOpenOption.CREATE); | |
afc.lock(new Object(), new CompletionHandler<FileLock, Object>() { | |
@Override | |
public void completed(final FileLock lock, final Object attachment) { | |
log.debug("write:{} acquired lock", target); |
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 vertx = require("vertx.js") | |
var console = require('vertx/console'); | |
console.log('module ' + JSON.stringify(module)); | |
var dust; | |
var x = function(){ | |
var module = undefined; |
NewerOlder