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
class PluginLoadContext : AssemblyLoadContext
{
private AssemblyDependencyResolver _resolver;
public PluginLoadContext(string pluginPath)
{
_resolver = new AssemblyDependencyResolver(pluginPath);
}
protected override Assembly? Load(AssemblyName assemblyName)
@TsuyoshiUshio
TsuyoshiUshio / values.yaml
Created April 9, 2019 02:35
Kafka helm configuration for external client access
# ------------------------------------------------------------------------------
# Kafka:
# ------------------------------------------------------------------------------
## The StatefulSet installs 3 pods by default
replicas: 3
## The kafka image repository
image: "confluentinc/cp-kafka"
@TsuyoshiUshio
TsuyoshiUshio / HttpTrigger.cs
Last active April 21, 2023 10:55
Azure Functions Unit Testing sample
[FunctionName(“HttpTrigger”)]
public async static Task<IActionResult> RunAsync([HttpTrigger(AuthorizationLevel.Function, “get”, “post”, Route = null)]HttpRequest req, TraceWriter log)
{
log.Info(“C# HTTP trigger function processed a request.”);
string name = req.Query[“name”];
string requestBody = new StreamReader(req.Body).ReadToEnd();
dynamic data = JsonConvert.DeserializeObject(requestBody);
name = name ?? data?.name;
return name != null
? (ActionResult)new OkObjectResult($”Hello, {name}”)
@TsuyoshiUshio
TsuyoshiUshio / azure-pipelines.yml
Created September 24, 2018 12:15
Pipeline for Go lang with coverage report
# Go
# Build your Go application.
# Add steps that test, save build artifacts, deploy, and more:
# https://docs.microsoft.com/vsts/pipelines/languages/go
pool:
vmImage: 'Ubuntu 16.04'
variables:
GOBIN: '$(GOPATH)/bin' # Go binaries path
@TsuyoshiUshio
TsuyoshiUshio / terraform.tf
Created March 19, 2018 01:54
local exec sample
# Cosmos DB
resource "azurerm_cosmosdb_account" "test" {
name = "${var.cosmosdb_account_name}"
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
offer_type = "${var.cosmosdb_offer_type}"
consistency_policy {
consistency_level = "${var.cosmosdb_consistency_level}"
@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 / project.json
Last active February 10, 2021 07:56
Storage migration from Google Cloud Storage to Azure with Async/Await
{
"frameworks": {
"net46":{
"dependencies": {
"Google.Cloud.Storage.V1": "1.0.0-beta05"
}
}
}
}
@TsuyoshiUshio
TsuyoshiUshio / launch.json
Last active January 14, 2021 19:27
Acceptance Testing Settings
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch Acceptance test",
"type": "go",
"request": "launch",
"mode": "test",
"program": "${workspaceRoot}/azuredevops/resource_project_test.go",
"args": [
@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"}],
},