Skip to content

Instantly share code, notes, and snippets.

Avatar
😃
On duty

Ole Morten Didriksen oledid

😃
On duty
View GitHub Profile
@oledid
oledid / make-vc-keys.ps1
Created Jun 14, 2021 — forked from srvrguy/make-vc-keys.ps1
A PowerShell script to make a 2048-bit RSA keypair. Saves the files in XML format in the user's document directory.
View make-vc-keys.ps1
# Create a 2048-bit RSA Keypair in XML format
#
# @author Michael Johnson <michael.johnson@snap.md>
# @copyright 2016 SnapMD, Inc.
# @license https://opensource.org/licenses/BSD-2-Clause Simplified BSD License
<#
Copyright (c) 2016, SnapMD, Inc.
All rights reserved.
@oledid
oledid / resubmit-failed-logic-app-runs.ps1
Created May 6, 2021
Resubmit failed logic app runs
View resubmit-failed-logic-app-runs.ps1
############################################################
# Resubmit failed logic app runs
############################################################
# Sources:
# https://github.com/Azure/logicapps/tree/master/scripts/resubmit-all-failed-runs
# https://github.com/Azure/azure-powershell/issues/7752
import-module Az
@oledid
oledid / Manage-App-Service-Plan.md
Created Apr 23, 2021 — forked from mmckechney/Manage-App-Service-Plan.md
PowerShell and CLI to manage App Service Plan sizing
View Manage-App-Service-Plan.md

Manage App Service Plan count and SKU

Get the number of worker nodes serving the app service plan

(Get-AzAppServicePlan -ResourceGroupName "<resource group name>" -Name "<app service plan name>").Sku.Capacity
@oledid
oledid / run-jetbrains-inspectcode.ps1
Last active Mar 19, 2021
Visual Studio Code-task and problem matcher for JetBrains InspectCode
View run-jetbrains-inspectcode.ps1
dotnet tool install -g JetBrains.ReSharper.GlobalTools
jb inspectcode (Get-Item *.sln).FullName -o="jetbrains-inspectcode-results.xml" --absolute-paths --DotNetCore="C:\Program Files\dotnet\dotnet.exe"
Get-Content jetbrains-inspectcode-results.xml
@oledid
oledid / ogg2mp3.ps1
Created May 20, 2020
Convert files in folder from ogg to mp3, if they are not already converted
View ogg2mp3.ps1
# using powershell core and ffmpeg
ls *.ogg | where { -Not (Test-Path $_.FullName.Replace(".ogg", ".mp3")) } | foreach {
$fullName = $_.FullName;
$output = $_.FullName.Replace('.ogg', '.mp3');
ffmpeg -i "$fullName" "$output"
}
@oledid
oledid / Startup.cs
Last active Apr 3, 2020
OpenIdConnect against ID-porten, an example for ASP .NET Core 3.1
View Startup.cs
using System;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Diagnostics;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
@oledid
oledid / Core_BuildDateAttribute.cs
Last active Nov 1, 2019
BuildDateAttribute - get build-date in build for cache-busting
View Core_BuildDateAttribute.cs
// https://www.meziantou.net/getting-the-date-of-build-of-a-dotnet-assembly-at-runtime.htm
using System;
using System.Globalization;
namespace Core
{
[AttributeUsage(AttributeTargets.Assembly)]
public class BuildDateAttribute : Attribute
{
View index.html
<!doctype html public>
<meta charset="utf-8"/>
<title>HTML with venderPackages.dll.js</title>
<body>
<div id="root"></div>
<!-- node_modules/PROJECT-NAME-TEMP-FOLDERNAME-dll/vendorPackages.dll.js generated by postinstall.js running webpack with webpack.dll.config.js -->
<script src="/vendorPackages.dll.js"></script>
<script src="/__build__/bundle.js"></script>
</body>
</html>
@oledid
oledid / CommonEntityBaseExtensions.cs
Last active Mar 15, 2019
Serialize LLBLGEN Entity to json without LLBLGEN-specific fields
View CommonEntityBaseExtensions.cs
using System.Collections.Generic;
using System.Dynamic;
using Newtonsoft.Json;
using Your.ORM.EntityClasses; // <- replace
namespace Your.Namespace // <-
{
public static class CommonEntityBaseExtensions
{
/// <summary>