Skip to content

Instantly share code, notes, and snippets.

View TsuyoshiUshio's full-sized avatar
:octocat:
Enjoy coding

Tsuyoshi Ushio TsuyoshiUshio

:octocat:
Enjoy coding
  • Microsoft
  • Kirkland
View GitHub Profile
@TsuyoshiUshio
TsuyoshiUshio / Program.cs
Created September 13, 2024 04:29
Custom ActivityTracker for Custom ActivityId
using System.Diagnostics.Tracing;
class Program
{
static void Main(string[] args)
{
HandleRequest(Guid.NewGuid());
}
static void HandleRequest(Guid activityId)
class PluginLoadContext : AssemblyLoadContext
{
private AssemblyDependencyResolver _resolver;
public PluginLoadContext(string pluginPath)
{
_resolver = new AssemblyDependencyResolver(pluginPath);
}
protected override Assembly? Load(AssemblyName assemblyName)
@TsuyoshiUshio
TsuyoshiUshio / SimpleKafkaTriggers.cs
Created December 4, 2020 08:36
Kafka Extension Example
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 June 28, 2020 03:27
EnvironmentVariables for DevContainer
// 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 June 28, 2020 03:20
The LD_LIBRARY_PATH is ignored
{
"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"}],
},
@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 / 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>"
}
}