Skip to content

Instantly share code, notes, and snippets.

View marcduiker's full-sized avatar
/-/

Marc Duiker marcduiker

/-/
View GitHub Profile
@marcduiker
marcduiker / persistence-in-serverless-apps.md
Last active December 20, 2020 21:59
Links for Persistence in Serverless Applications
@marcduiker
marcduiker / vslive_azure_functions_workshop.md
Last active November 5, 2020 20:34
VS Live Functions Workshop

VSLive Azure Functions Workshop 2020

This workshop will start with the basics of serverless architectures and explain how Azure Functions play a part in building serverless solutions.

You will learn how to develop Azure Functions using .NET Core and Visual Studio 2019.

Next, you are going to build and deploy these with Azure DevOps using CI/CD.

Also covered is the lifecycle management and operations of serverless solutions.

artifacts: 'flowing'
from_pipelines: 'into'
cloud: 'environments'
@marcduiker
marcduiker / homework-links.md
Last active December 23, 2021 16:44
CREATE: Serverless Homework
@marcduiker
marcduiker / RetryCallsAndEscalate.cs
Created September 16, 2020 21:13
Possible solution to retry calls and escalate when the callee does not respond within a certain time.
namespace DurableFunctions.Demo.DotNetCore.RetryCallsWithBackup
{
public class EscalatingCallsOrchestrator
{
[FunctionName(nameof(RunEscalatingCallsOrchestrator))]
public async Task RunEscalatingCallsOrchestrator(
[OrchestrationTrigger] IDurableOrchestrationContext context,
ILogger logger)
{
var escalatingCallsInput = context.GetInput<EscalatingCallsInput>();
@marcduiker
marcduiker / EscalateCallsOrchestrator.cs
Created September 16, 2020 17:30
Escalate calls orchestrator with time out.
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.DurableTask;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace DurableFunctions.Demo.DotNetCore.EscalateCalls
@marcduiker
marcduiker / ffmpeg_increase_audio_level
Last active September 15, 2020 20:51
Increase the audio level of an existing mp4 file with ffmpeg
ffmpeg -i input.mp4 -af "volume=10dB" -c:v copy -c:a aac -b:a 192k output.mp4
@marcduiker
marcduiker / incremental_rename.ps1
Last active August 9, 2020 16:08
Incrementally rename files for ffmpeg
$prefix="frame_"
$files = Get-ChildItem "<Path where the pngs are>" -Filter *.png | Sort-Object
$fileCount = 0
$files |
Foreach-Object {
$fileCount++
$currentFileNumber = [int]$_.BaseName.Substring($prefix.Length)
if ($currentFileNumber -ne $fileCount) {
$newFileFormat = "$prefix{0:d4}.png" -f $fileCount
Rename-Item $_.FullName $newFileFormat
@marcduiker
marcduiker / ffmpeg_video_for_twitter.md
Last active June 1, 2024 04:35
FFmpeg command for creating video for Twitter

Convert pngs to mp4

This FFmpeg command reads images named frame_[4 char digit].png and converts it to an mp4 using the h264 encoding which Twitter accepts. The bitrate is set to 5M to reduce blocking as much as possible while keeping the size small.

ffmpeg -framerate 10 -i frame_%04d.png -c:v h264_qsv -b:v 5M video.mp4

Convert and scale an existing mp4 to 1080:

ffmpeg -i input.mp4 -c:v h264_qsv -vf: scale=1080:-1 -b:v 5M output.mp4

@marcduiker
marcduiker / set_kv__access_policy_for_function_app.ps1
Last active June 24, 2020 08:27
Azure CLI to add an access policy for a Function App to KeyVault
$principalId = az functionapp identity show -n FUNC_APP_NAME -g RESOURCE_GROUP_NAME --query principalId
$appId = az ad sp show --id $principalId --query appId
az keyvault set-policy -n KEYVAULT_NAME --spn $appId --secret-permissions get