Skip to content

Instantly share code, notes, and snippets.

View TsuyoshiUshio's full-sized avatar
🏠
Working from home

Tsuyoshi Ushio TsuyoshiUshio

🏠
Working from home
  • Microsoft
  • Kirkland
View GitHub Profile
@TsuyoshiUshio
TsuyoshiUshio / Main.java
Created May 26, 2020 01:58
GraalVM sample
import java.lang.reflect.Method;
import java.net.URL;
import java.net.URLClassLoader;
public class Main {
public static void main(String args[]){
try{
String pathToJar = args[0];
System.out.println(pathToJar);
URL[] urls = { new URL("jar:file:" + pathToJar+"!/")};
@TsuyoshiUshio
TsuyoshiUshio / LibrarySample.java
Created May 26, 2020 01:54
GraalVM experiment
package com.simplearchitect.lib;
public class LibrarySample {
public void execute() {
System.out.println("Hello World from Library.");
}
}
@TsuyoshiUshio
TsuyoshiUshio / Orchestrator.cs
Created November 25, 2018 12:43
W3C correlation sample
public static class Orchestration
{
private static TelemetryClient client;
static Orchestration()
{
DependencyTrackingTelemetryModule module = new DependencyTrackingTelemetryModule();
module.ExcludeComponentCorrelationHttpHeadersOnDomains.Add("core.windows.net");
module.Initialize(TelemetryConfiguration.Active);
@TsuyoshiUshio
TsuyoshiUshio / sudoers
Created May 12, 2020 23:30
WSL 18.04, 20.04 Default /etc/sudoers file.
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset
Defaults mail_badpass
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"
@TsuyoshiUshio
TsuyoshiUshio / host.json
Created May 4, 2020 17:28
Distributed Tracing sample
{
"extensions": {
"durableTask": {
"tracing": {
"DistributedTracingProtocol": "W3CTraceContext"
}
}
},
"logging": {
"applicationInsights": {
@TsuyoshiUshio
TsuyoshiUshio / local.settings.json
Created May 4, 2020 17:27
Distributed Tracing sample
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"FUNCTIONS_WORKER_RUNTIME": "dotnet",
"APPINSIGHTS_INSTRUMENTATIONKEY": "<YOUR_APPINSGITHS_INSTRUMENTATIONKEY_HERE>"
}
}
@TsuyoshiUshio
TsuyoshiUshio / FunctionAppCorrelation.csproj
Created May 4, 2020 17:15
Distributed Tracing config
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AzureFunctionsVersion>v3</AzureFunctionsVersion>
<RunAnalyzersDuringLiveAnalysis>true</RunAnalyzersDuringLiveAnalysis>
<RunAnalyzersDuringBuild>true</RunAnalyzersDuringBuild>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.DurableTask.Telemetry" Version="2.2.0-alpha" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.5" />
@TsuyoshiUshio
TsuyoshiUshio / SampleTest.java
Created April 30, 2020 19:00
jMockit sample (Missing Invocation)
public class SampleTest {
@Test
public void executeSample(
@Mocked final TypedData data1,
@Mocked final TypedData data2
) throws Exception {
new Expectations() {{
data1.getName(); result = "foo";
data2.getName(); result = "bar";
}};
@TsuyoshiUshio
TsuyoshiUshio / SampleTest.java
Created April 30, 2020 18:54
jMockit sample
public class SampleTest {
@Test
public void executeSample(
@Mocked final TypedData data1,
@Mocked final TypedData data2
) throws Exception {
new Expectations() {{
data1.getName(); result = "foo";
data2.getName(); result = "bar";
}};
public class InvocationRequestTest {
@Mocked
private ParameterBinding binding;
@Test
public void test(@Mocked final Some some) throws Exception {
new Expectations() {{
binding.getName(); result = "ushio";
some.getName(); result = "mocked";
}