Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Tsuyoshi Ushio TsuyoshiUshio

🏠
Working from home
View GitHub Profile
View SimpleKafkaTriggers.cs
using Avro;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Kafka;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
@TsuyoshiUshio
TsuyoshiUshio / devcontainer.json
Last active Jun 28, 2020
EnvironmentVariables for DevContainer
View devcontainer.json
// For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.106.0/containers/azure-functions-node-10
{
"name": "Azure Functions & Python 3 & Confluent Kafka",
"dockerComposeFile": "docker-compose.yml",
"service": "myfunction",
"workspaceFolder": "/workspace",
"remoteEnv": {"LD_LIBRARY_PATH": "/workspace/bin/runtimes/linux-x64/native"},
"containerEnv": {"LD_LIBRARY_PATH": "/workspace/bin/runtimes/linux-x64/native"},
"forwardPorts": [ 7071, 9021 ],
@TsuyoshiUshio
TsuyoshiUshio / launch.json
Created Jun 28, 2020
The LD_LIBRARY_PATH is ignored
View launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Attach to Python Functions",
"type": "python",
"request": "attach",
"linux": {
"env": [{ "name": "LD_LIBRARY_PATH"}, {"value": "/workspace/bin/runtimes/linux-x64/native"}],
},
View Main.java
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+"!/")};
View LibrarySample.java
package com.simplearchitect.lib;
public class LibrarySample {
public void execute() {
System.out.println("Hello World from Library.");
}
}
@TsuyoshiUshio
TsuyoshiUshio / sudoers
Created May 12, 2020
WSL 18.04, 20.04 Default /etc/sudoers file.
View sudoers
# 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
Distributed Tracing sample
View host.json
{
"extensions": {
"durableTask": {
"tracing": {
"DistributedTracingProtocol": "W3CTraceContext"
}
}
},
"logging": {
"applicationInsights": {
@TsuyoshiUshio
TsuyoshiUshio / local.settings.json
Created May 4, 2020
Distributed Tracing sample
View local.settings.json
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"FUNCTIONS_WORKER_RUNTIME": "dotnet",
"APPINSIGHTS_INSTRUMENTATIONKEY": "<YOUR_APPINSGITHS_INSTRUMENTATIONKEY_HERE>"
}
}
View FunctionAppCorrelation.csproj
<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 Apr 30, 2020
jMockit sample (Missing Invocation)
View SampleTest.java
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";
}};