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
package org.testcontainers.repro; | |
import com.github.dockerjava.api.command.InspectContainerResponse; | |
import org.testcontainers.Testcontainers; | |
import org.testcontainers.containers.GenericContainer; | |
import org.testcontainers.containers.wait.strategy.LogMessageWaitStrategy; | |
import org.testcontainers.containers.wait.strategy.Wait; | |
import org.testcontainers.images.builder.Transferable; | |
import org.testcontainers.shaded.org.bouncycastle.util.Strings; |
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
package main | |
import ( | |
"context" | |
"fmt" | |
"os" | |
"dagger.io/dagger" | |
) |
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
// Here's the network where both containers will join | |
static final Network NET = Network.newNetwork(); | |
// The database container will join the network under the 'mysql' alias | |
@Container | |
static MySQLContainer dbContainer = | |
new MySQLContainer<>(DockerImageName.parse("mysql:8.0")) | |
.withNetwork(NET) | |
.withNetworkAliases("mysql"); |
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
package com.example; | |
import io.micronaut.http.MediaType; | |
import io.micronaut.http.annotation.Controller; | |
import io.micronaut.http.annotation.Get; | |
import java.util.HashMap; | |
import java.util.Map; | |
@Controller("/") | |
public class FibonacciController { |
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
package com.example; | |
import io.micronaut.http.MediaType; | |
import io.micronaut.http.annotation.Controller; | |
import io.micronaut.http.annotation.Get; | |
@Controller("/") | |
public class FibonacciController { | |
private static final StringBuilder LOG = new StringBuilder(); |
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 double correlate(double[] a, double[] b) { | |
if (a.length != b.length) { | |
return Double.NaN; | |
} | |
double <w,x,y,z> = <0,0,0,0>; | |
int i = 0; | |
for ( ; i + 3 < a.length; i += 4) { | |
<w,x,y,z> += a[<i,i+1,i+2,i+3>] * b[<i,i+1,i+2,i+3>]; | |
} | |
double correlation = w + x + y + z; |
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 double correlate(double[] a, double[] b) { | |
if (a.length != b.length) { | |
return Double.NaN; | |
} | |
double partial[] = new double[4]; | |
int i = 0; | |
for ( ; i + 3 < a.length; i += 4) { | |
partial[0] += a[i+0] * b[i+0]; | |
partial[1] += a[i+1] * b[i+1]; | |
partial[2] += a[i+2] * b[i+2]; |
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
class SignalCorrelation { | |
/** Approximate {@code sin(i / 1000)}. */ | |
public static double sin(int i) { | |
double x = i / 1000.0; | |
double term3 = (x*x*x) / (3 * 2 * 1); | |
double term5 = (x*x*x*x*x) / (5 * 4 * 3 * 2 * 1); | |
return x - term3 + term5; | |
} | |
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
function lowUsage() { | |
for (i = 0; i < COMPILATION_THRESHOLD; i++) { | |
// Do something | |
} | |
} | |
function highUsage() { | |
for (i = 0; i < 100 * COMPILATION_THRESHOLD; i++) { | |
// Do something | |
} |
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 jdk.jfr.Event; | |
import jdk.jfr.Description; | |
import jdk.jfr.Label; | |
public class Example { | |
@Label("Hello World") | |
@Description("Helps programmer getting started") | |
static class HelloWorld extends Event { | |
@Label("Message") |
NewerOlder