Skip to content

Instantly share code, notes, and snippets.

View CESARDELATORRE's full-sized avatar

Cesar De la Torre CESARDELATORRE

  • Microsoft Corp
  • Redmond, WA, U.S.
View GitHub Profile
{
"ReRoutes": [
{
"DownstreamPathTemplate": "/api/{version}/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "catalog.api",
"Port": 80
}
@CESARDELATORRE
CESARDELATORRE / ApiGateways-Web.Bff.Shopping-apigw-configuration-basket-specific.json
Created May 15, 2018 18:49
ApiGateways-Web.Bff.Shopping-apigw-configuration-basket-specific.json
{
"DownstreamPathTemplate": "/api/{version}/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "basket.api",
"Port": 80
}
],
"UpstreamPathTemplate": "/api/{version}/b/{everything}",
@CESARDELATORRE
CESARDELATORRE / Partial-eShopOnContainers-docker-compose.yml
Created May 15, 2018 18:52
Partial-eShopOnContainers-docker-compose.yml
mobileshoppingapigw:
image: eshop/ocelotapigw:${TAG:-latest}
build:
context: .
dockerfile: src/ApiGateways/ApiGw-Base/Dockerfile
mobilemarketingapigw:
image: eshop/ocelotapigw:${TAG:-latest}
build:
context: .
@CESARDELATORRE
CESARDELATORRE / Partial-eShopOnContainers-docker-compose.override.yml
Created May 15, 2018 18:54
Partial-eShopOnContainers-docker-compose.override.yml
mobileshoppingapigw:
environment:
- ASPNETCORE_ENVIRONMENT=Development
- IdentityUrl=http://identity.api
ports:
- "5200:80"
volumes:
- ./src/ApiGateways/Mobile.Bff.Shopping/apigw:/app/configuration
mobilemarketingapigw:
{
"DownstreamPathTemplate": "/api/{version}/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "basket.api",
"Port": 80
}
],
"UpstreamPathTemplate": "/api/{version}/b/{everything}",
@CESARDELATORRE
CESARDELATORRE / Sample-Authorize-Controller-Class.cs
Created May 15, 2018 18:58
Sample-Authorize-Controller-Class.cs
namespace Microsoft.eShopOnContainers.Services.Basket.API.Controllers
{
[Route("api/v1/[controller]")]
[Authorize]
public class BasketController : Controller
{ //...
@CESARDELATORRE
CESARDELATORRE / AddJwtBearer-ConfigureServices.cs
Created May 15, 2018 19:01
AddJwtBearer-ConfigureServices.cs
// prevent from mapping "sub" claim to nameidentifier.
JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Clear();
var identityUrl = Configuration.GetValue<string>("IdentityUrl");
services.AddAuthentication(options =>
{
options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
catalog.api:
environment:
- ASPNETCORE_ENVIRONMENT=Development
- ASPNETCORE_URLS=http://0.0.0.0:80
- ConnectionString=YOUR_VALUE
- ... Other Environment Variables
ports:
- "5101:80" # Important: In a production environment you should remove the external port (5101) kept here for microservice debugging purposes.
# The API Gateway redirects and access through the internal port (80).
@CESARDELATORRE
CESARDELATORRE / export-onnx-model-from-mlnet-model.cs
Last active July 8, 2018 21:08
export-onnx-model-from-mlnet-model
var onnxPath = GetOutputPath(subDir, "SaveModelToOnnxTest.onnx");
var onnxAsJsonPath = GetOutputPath(subDir, "SaveModelToOnnxTest.json");
OnnxConverter converter = new OnnxConverter()
{
InputsToDrop = new[] { "Label" },
OutputsToDrop = new[] { "Label", "Features" },
Onnx = onnxPath,
Json = onnxAsJsonPath,
Domain = "com.mydomain"
@CESARDELATORRE
CESARDELATORRE / FFM.cs
Last active July 7, 2018 18:40
Adding FFM (FieldAwareFactorizationMachineBinaryClassifier) to ML.NET pipeline
pipeline.Add(new FieldAwareFactorizationMachineBinaryClassifier(){ LearningRate = 0.5f, Iter=2 });