Skip to content

Instantly share code, notes, and snippets.

View berndverst's full-sized avatar

Bernd Verst berndverst

View GitHub Profile
@berndverst
berndverst / VSCodeUserSettings.json
Last active April 6, 2024 00:14
VS Code: Override Terminal Colors with Solarized Dark regardless of Theme
{
"workbench.colorCustomizations": {
"terminal.foreground": "#839496",
"terminal.background": "#002833",
"terminal.ansiBlack": "#003541",
"terminal.ansiBlue": "#268bd2",
"terminal.ansiCyan": "#2aa198",
"terminal.ansiGreen": "#859901",
"terminal.ansiMagenta": "#d33682",
"terminal.ansiRed": "#dc322f",
@berndverst
berndverst / acr-login
Created January 16, 2018 07:24
Docker Login Help for Azure Container Registries. Add to your BASH or ZSH .rc file
alias acr-login="echo 'Fetching available Azure container registries...'; az acr list -otable --query='[*].{Name:name,Group:resourceGroup,Location:location}'; echo '\nEnter registry name:'; read azregistry; az acr credential show -n \$azregistry --query='[passwords[0]][0].value' -otsv | docker login -u \$azregistry --password-stdin \$azregistry.azurecr.io"
@berndverst
berndverst / AWSAPIGateway_ProxyAPIwithCreds.json
Created January 25, 2018 00:30
Swagger 2.0 definition for AWS API Gateway endpoint to Proxy API requests and add API client ID and secret
{
"swagger": "2.0",
"info": {
"version": "2016-09-12T23:19:28Z",
"title": "ProxyAPIwithCreds"
},
"host": "my-domain.com",
"basePath": "/test",
"schemes": [
"https"
@berndverst
berndverst / AzureFunctions_ProxyAPIwithCreds.json
Created January 25, 2018 01:53
API Proxy to hide API Credentials based on Azure Functions Proxy
{
"$schema": "http://json.schemastore.org/proxies",
"proxies": {
"API proxy with Credentials": {
"matchCondition": {
"route": "/api/{*route}",
"methods": [
"GET"
]
},
@berndverst
berndverst / gist:66e7158126863514874a3aba024543f4
Created July 13, 2018 00:11
Restarting a AKS kubernetes node gracefully in one line
AKSNODE=aks-nodepool1-32072832-0; kubectl cordon $AKSNODE && kubectl drain $AKSNODE --ignore-daemonsets=true && echo "$AKSNODE restarting" && az vm restart -g MC_containergroupeast_managedkube_eastus -n $AKSNODE && sleep 10 && kubectl uncordon $AKSNODE && until [ $(kubectl get node $AKSNODE --output=json | jq -c '.status.conditions | map(select(.type == "Ready"))[0].status') = '"True"' ]; do echo "sleeping 10 seconds\n" && sleep 10; done && echo "$AKSNODE successfully restarted"

Setup

curl -sSL -o clone.c goo.gl/G45N5X

Net Namespace

# on host
@berndverst
berndverst / hackcbs-workshop.md
Last active December 23, 2022 07:53
hackCBS 2.0: Using Azure + AI to detect Emotion

hackCBS 2.0: Using Azure + AI to detect Emotion

This Hackathon is designed for beginners. No prior experience is necessary.

Azure provides powerful AI tools, wrapped up in APIs that you can use from your apps to add intelligence without being an AI expert. In this hands-on workshop you will build a Python app that takes advantage of one of these APIs to detect emotions in faces, alerting you if you have a sad face too often. This app will be in two parts, one part that runs on the desktop and takes photos, and another that runs in the cloud to analyse photos and store the emotions detected.

Required resources

  • Python 3.7 runtime (not the latest 3.8 as not all required libraries are available yet). We recommend Python 3.7.4 for this workshop. Download
  • Microsoft Azure Account (Azure Portal)
  • Don't have one? Sign up for [Azure for Students](https://azure.mic
@berndverst
berndverst / convert.py
Created April 2, 2020 00:36
Convert Subtitles in WebVTT format exported from Microsoft Stream to SRT
# Conversion of Microsoft Stream WebVTT file to SRT
# Takes advantage of specific metadata structure in Microsoft Stream VTT files
vtt = open('INPUT.vtt','r')
vtt_iter = iter(vtt)
with open('OUTPUT.srt', 'w') as srt:
counter = 1
next(vtt_iter)
for line in vtt_iter:
@berndverst
berndverst / Readme.md
Last active March 29, 2024 09:27
Script to quickly merge captions into mp4 H.264 (or HEVC/H.265) video as selectable or burned in subtitles from command-line

Add captions to MP4 videos as subtitles

Requirements

FFMpeg must be installed.

Instructions:

@berndverst
berndverst / trimvideoinstantly.sh
Last active April 4, 2020 00:00
Trimming videos instantly without reencoding using FFmpeg
INFILE="video.mp4"
OUTFILE="shortenedclip.mp4"
START="00:00:12.35" # Start Time in hh:mm:ss.msec format
DURATION="00:01:05.4" # Duration in hh:mm:ss.msec format
################## Alternative format ##################
# START="12.35" # Start time in s.msec format #
# DURATION="65.4" # Duration time in s.msec format #
########################################################