Skip to content

Instantly share code, notes, and snippets.

View Geertvdc's full-sized avatar
🌩️
Build it, Run it, Break it, Fix it, Own it!

Geert van der Cruijsen Geertvdc

🌩️
Build it, Run it, Break it, Fix it, Own it!
View GitHub Profile
@Geertvdc
Geertvdc / build.yml
Last active November 11, 2019 08:33
Github Actions Workflow with hub CLI
name: Build
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
@Geertvdc
Geertvdc / query-users.http
Created September 19, 2019 14:45
query-users.http
#Get user by email
GET https://graph.microsoft.com/beta/users?$filter=startswith(mail,'geert')
Authorization: Bearer {{auth.response.body.access_token}}
@Geertvdc
Geertvdc / bearertoken.http
Created September 19, 2019 14:26
Get Bearer Token REST Client call
# @name auth
POST https://login.microsoftonline.com/{{tenantId}}/oauth2/v2.0/token HTTP/1.1
Content-type: application/x-www-form-urlencoded
grant_type=client_credentials
&client_id={{clientId}}
&client_secret={{clientSecret}}
&scope={{scope}}
@Geertvdc
Geertvdc / rest-client-config.json
Last active September 19, 2019 14:16
rest-client-config.json
"rest-client.environmentVariables": {
"$shared": {},
"blogdemo":{
"tenantId":"<<your aad tenant>>",
"clientId":"<<your client id>>",
"clientSecret":"<<your client secret>>",
"scope":"https%3A%2F%2Fgraph.microsoft.com%2F.default"
}
},
@Geertvdc
Geertvdc / app.module.ts
Created August 9, 2019 08:14
MSAL app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { MsalModule, MsalInterceptor } from '@azure/msal-angular';
import { HTTP_INTERCEPTORS, HttpClientModule } from '@angular/common/http';
import { DemoApiService } from './demoapi.service';
export const protectedResourceMap:[string, string[]][]=[['https://localhost:44388/api/values', ['api://59b02905-8b6b-4665-a702-321e97392416/api-access']] ];
@Geertvdc
Geertvdc / startup.cs
Created August 9, 2019 07:15
Startup with AAD authentication
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
@Geertvdc
Geertvdc / calculationtimes.kusto
Created January 31, 2019 07:56
Calculation times in Log Analytics query
let today = dependencies
| where timestamp between( now(-1d) .. now() )
| where name == "CalculationCycle"
| project value , timestamp, hour=datepart("Hour",timestamp)
| summarize avg(value) by bin(hour,1)
| sort by hour asc;
let lastmonth = dependencies
| where timestamp between( now(-30d) .. now(-1d))
| where name == "CalculationCycle"
| project value , timestamp, hour=datepart("Hour",timestamp)
@Geertvdc
Geertvdc / appinsights.cs
Last active January 31, 2019 07:40
App insights telemetry
var telemetry = new DependencyTelemetry
{
Type = "type",
Name = nameof(CalculationCycle)
};
telemetry.Start();
telemetry.Context.Operation.Id = telemetry.Id;
telemetry.Context.Operation.ParentId = telemetry.Id;
@Geertvdc
Geertvdc / azure-pipelines.yml
Created October 21, 2018 11:36
full containerized .Net Core build
resources:
containers:
- container: dotnet-geert
image: 'microsoft/dotnet:2.1-sdk'
options: -v /home/vsts/NuGet/Cache:/NuGet/Cache
env:
NUGET_PACKAGES: '/NuGet/Cache'
pool: 'Geerts-Linux-Agents'
container: dotnet-geert
@Geertvdc
Geertvdc / azure-pipelines.yml
Created October 21, 2018 11:10
Basic dockerized build pipeline
resources:
containers:
- container: dotnet-geert
image: 'microsoft/dotnet:2.1-sdk'
pool: 'Hosted Ubuntu 1604'
container: dotnet-geert
variables:
buildConfiguration: 'Release'