Skip to content

Instantly share code, notes, and snippets.

View GeorgDangl's full-sized avatar
😎
Coding

Georg Dangl GeorgDangl

😎
Coding
View GitHub Profile
@GeorgDangl
GeorgDangl / AvaCloudUserClientFactory.cs
Created July 5, 2023 11:26
Accessing AVACloud with user- instead of service accounts
public class AvaCloudUserClientFactory
{
public AvaCloudUserClientFactory(string userIdentifier,
string userPassword,
string avacloudBaseUrl = "https://avacloud-api.dangl-it.com",
Func<ITokenStorage> tokenStorageFactory = null)
{
_serviceProvider = BuildAvaCloudServiceProvider(userIdentifier,
userPassword,
avacloudBaseUrl,
@GeorgDangl
GeorgDangl / SwaggerExtensions.cs
Created April 16, 2023 20:39
NSwag Parameter Sorting
services.AddSwaggerDocument(c =>
{
c.PostProcess = (openApiDocument) =>
{
var operation = openApiDocument.Paths.Single(p => p.Key.StartsWith("/conversion/gaeb/ava"));
var operationParameters = operation.Value.Values.Single().Parameters;
var sortedParameters = SortParameters(operationParameters).ToList();
operationParameters.Clear();
foreach (var parameter in sortedParameters)
{
@GeorgDangl
GeorgDangl / index.html
Created October 19, 2021 14:58
#31474 Electron crash when launched from network drive
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
<title>Hello World!</title>
</head>
<body>
<h1>Hello World!</h1>
We are using Node.js <span id="node-version"></span>,
@GeorgDangl
GeorgDangl / BuildElectron.cs
Last active August 18, 2021 21:32
Signing Electron Apps before Bundling with Azure Key Vault and EV Code Signing Certificates: https://blog.dangl.me/archive/signing-electron-apps-before-bundling-with-azure-key-vault-and-ev-code-signing-certificates/
Target BuildElectronApp => _ => _
.DependsOn(Clean)
.DependsOn(GenerateVersion)
.Requires(() => CodeSigningCertificateName != null)
.Executes(() =>
{
// To ensure the tool is always up to date
DotNet("tool update ElectronNET.CLI -g");
BuildElectronAppInternal(
@GeorgDangl
GeorgDangl / Dockerfile
Last active June 28, 2022 01:36
Running Fully Automated E2E Tests in Electron in a Docker Container with Playwright: https://blog.dangl.me/archive/running-fully-automated-e2e-tests-in-electron-in-a-docker-container-with-playwright/
FROM node:14 AS node
FROM node AS headless
RUN apt-get update && \
apt-get install -y xvfb \
libgbm1 \
libxss1 \
libnss3 \
libgtk-3-dev \
libasound2-dev \
@GeorgDangl
GeorgDangl / DockerWebhook.cs
Created May 16, 2021 17:42
DockerWebhook.cs
private async Task CallWebhookToUpdateDockerImageAsync()
{
var webhookUri = "https://username:password@app-name.scm.azurewebsites.net/docker/hook";
var uri = new Uri(webhookUri);
var httpRequest = new HttpRequestMessage(HttpMethod.Post, webhookUri);
// The webhooks for Azure App Service contain username & password, it's required for authentication
// in the webhook request
if (!string.IsNullOrWhiteSpace(uri.UserInfo))
{
var encodedStr = Convert.ToBase64String(Encoding.ASCII.GetBytes(uri.UserInfo));
@GeorgDangl
GeorgDangl / Build.cs
Last active October 13, 2020 10:15
Let's use NUKE to Quickly Deploy an App to Azure via Zip Deployment, see https://blog.dangl.me/archive/lets-use-nuke-to-quickly-deploy-an-app-to-azure-via-zip-deployment/
using Nuke.Common;
using Nuke.Common.Execution;
using Nuke.Common.Tools.GitVersion;
using static Nuke.Common.IO.FileSystemTasks;
using static Nuke.Common.Tools.Npm.NpmTasks;
using static Nuke.Common.ChangeLog.ChangelogTasks;
using static Nuke.Common.IO.TextTasks;
using static Nuke.GitHub.GitHubTasks;
using Nuke.GitHub;
using Nuke.Common.Git;
@GeorgDangl
GeorgDangl / AssemblyInfo.cs
Last active September 18, 2022 03:27
Running SQL Server Integration Tests in .NET Core Projects via Docker, see https://blog.dangl.me/archive/running-sql-server-integration-tests-in-net-core-projects-via-docker/
using Xunit;
// This is required to have the IAssemblyFixture from the Xunit.Extensions.Ordering Package available
[assembly: TestFramework("Xunit.Extensions.Ordering.TestFramework", "Xunit.Extensions.Ordering")]
@GeorgDangl
GeorgDangl / Jenkinsfile
Last active June 14, 2020 15:20
Simple and Quick Way to Backup Jenkins to Azure Blob Storage, see https://blog.dangl.me/archive/simple-and-quick-way-to-backup-jenkins-to-azure-blob-storage/
pipeline {
triggers {
cron('0 0 1 * *')
}
agent {
node {
label 'master'
customWorkspace 'workspace/JenkinsBackup'
}
}
@GeorgDangl
GeorgDangl / E2eTestsBase.cs
Last active March 17, 2022 06:41
Improving ASP.NET Core End-to-End Tests with Selenium Docker Images, see https://blog.dangl.me/archive/improving-aspnet-core-end-to-end-tests-with-selenium-docker-images/
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Remote;
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Threading.Tasks;
using Xunit;