Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Marc Bruins MarcBruins

🏠
Working from home
View GitHub Profile
@MarcBruins
MarcBruins / digitaltransformation.md
Created Feb 5, 2020
Digital transformation, an introduction
View digitaltransformation.md

Digital transformation, an introduction

Digital transformation is on top of the agendas in a lot of companies now a days. They see the digital revolution in which existing companies get crushed by new companies. There close competitors or other companies in there branch are losing to startups with profound new value propositions.

These companies inspire others to do better. But what is it they do? How can they be so successful?

The answer is: they profoundly transform there entire company. They redefine value propositions, processes and working methods. The data and IT is the foundation on which they build. They create blue oceans that rely on there digital resources. These can be existing resources, like the data that they already own or with the help of robotics, sensors, 3D printing, advanced analytics, AI, etc.

View gist:99c1c7c6d77de0aced1db19056f53cb3
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.TeamFoundation.Build.WebApi;
using Microsoft.TeamFoundation.Core.WebApi;
using Microsoft.TeamFoundation.WorkItemTracking.WebApi.Models;
using Microsoft.VisualStudio.Services.Common;
using Microsoft.VisualStudio.Services.WebApi;
@MarcBruins
MarcBruins / Dockerfile
Last active Apr 10, 2019
Plain functions dockerfile dotnet
View Dockerfile
FROM microsoft/dotnet:2.2-sdk AS installer-env
COPY . /src/dotnet-function-app
RUN cd /src/dotnet-function-app && \
mkdir -p /home/site/wwwroot && \
dotnet publish *.csproj --output /home/site/wwwroot
FROM mcr.microsoft.com/azure-functions/dotnet:2.0
ENV AzureWebJobsScriptRoot=/home/site/wwwroot
View gistnukeeper.cs
using System;
using System.Collections.Generic;
using System.IO;
using Microsoft.FSharp.Collections;
using Microsoft.FSharp.Core;
using NuKeeper.Abstractions.Inspections.Files;
using Paket;
namespace NuKeeper.Inspection.RepositoryInspection
{
@MarcBruins
MarcBruins / keyvault-secrets-from-appconfig.cs
Last active Jan 9, 2019
Read keyvault secrets from app config json
View keyvault-secrets-from-appconfig.cs
//1. Create a file for both classes
//2. Replace the IKeyVaultAccessClient with a concrete keyvault implementation
//3. Add it to the builder: builder.Add(new ReplaceTokensConfigurationSource(configuration, logger, client));
//4. Add secrets placeholder to the appsetings.json with the following pattern __secret__
/// <summary>
/// A JSON configuration source that replaces values from JSON that are tokenized with a value from Azure Key Vault,
/// using the tokenized value as lookup key.
/// </summary>
public sealed class ReplaceTokensConfigurationProvider : ConfigurationProvider, IDisposable
@MarcBruins
MarcBruins / AzureServicesAuthConnectionString.txt
Created Jan 7, 2019
AzureServicesAuthConnectionString sample
View AzureServicesAuthConnectionString.txt
AzureServicesAuthConnectionString RunAs=App;AppId=YOURAPPID;TenantId=YOURTENANTID;AppKey=OPTIONALAPPKEY
View pwd.cs
private string DbPassword = "MySuperSecretPassword";
View callingkeyvault.cs
var azureServiceTokenProvider = new AzureServiceTokenProvider();
var keyVaultClient = new KeyVaultClient(new KeyVaultClient.AuthenticationCallback(azureServiceTokenProvider.KeyVaultTokenCallback));
var secret = await keyVaultClient.GetSecretAsync("https://YOURKEYVAULT.azure.net/secrets/sqlAzure--AdminPassword").ConfigureAwait(false);
@MarcBruins
MarcBruins / possiblederefenceofnull.cs
Last active Jan 4, 2019
Possible dereference of a null reference sample
View possiblederefenceofnull.cs
public async Task<SearchCodeResult> Search(SearchCodeRequest search)
{
foreach (var repo in search.Repos)
{
//do search stuff
}
}
class SearchCodeRequest{
public IList<string>? Repos { get; set; }
@MarcBruins
MarcBruins / returningforuri.cs
Created Dec 16, 2018
Return value for uri trailing slash
View returningforuri.cs
public static Uri EnsureTrailingSlash(Uri uri)
{
return new Uri(uri.ToString() + "/");
}
//OR
public static Uri EnsureTrailingSlash(Uri? uri)
{
if(uri == null)
You can’t perform that action at this time.