Skip to content

Instantly share code, notes, and snippets.

View marcduiker's full-sized avatar
/-/

Marc Duiker marcduiker

/-/
View GitHub Profile
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 April 7, 2024 19: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

My definition of serverless

My definition of serverless is that:

  • You don't have full responsibility of the infrastructure, which is a good thing.
  • Your resources should scale up and down automatically, based on the load.
  • You only pay for what you actually use, so the consumption model.

Usages

  • Glue code, connect services

Serverless Days Amsterdam Conference Script

This document contains the script for the online ServerlessDays Amsterdam Conferene. We're using a combination of OBS, Skype & NDI Tools to combine our streams. Streaming is done to Restream.io which in turn forwards it to YouTube, Twitch and Periscope.

Roles

The lines in the script are prefixed with the role of the person who needs to undertake an action.

  • TECH = The person who's controlling OBS