Skip to content

Instantly share code, notes, and snippets.

View berndverst's full-sized avatar

Bernd Verst berndverst

View GitHub Profile
@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 / 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 / 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 #
########################################################
@berndverst
berndverst / organize-functions.sh
Last active June 25, 2020 22:51
Shell (Bash, ZSH) functions for easily organizing media files and documents on MacOS and Linux
# Example use:
# cd ~/Downloads
# mvmedia .
# mvdocs .
#
# Intended to be used for MacOS, but can be used on Linux if destination folders are altered.
# Simply save this file and source in your .zshrc, .bash_profile, .bashrc etc
mvimages() {
DESTINATION="$HOME/Pictures/"
@berndverst
berndverst / # openjdk - 2020-10-05_23-44-13.txt
Created October 6, 2020 06:47
openjdk on Ubuntu 20.04.1 LTS - Homebrew build logs
Homebrew build logs for openjdk on Ubuntu 20.04.1 LTS
Build date: 2020-10-05 23:44:13
@berndverst
berndverst / Live Coding Music Workshop.md
Last active January 11, 2021 02:41
Workshop: Creating Music through Live Coding

Creating Music through Live Coding

Author: Bernd Verst

In this workshop we will use the Sonic Pi live coding synthesizer to create part of an iconic song, live. We'll be creating the repeating four bar / measure phrase of the opening song to Hamilton, Alexander Hamilton.

Participation is strongly encouraged. A note on accessibility: Unfortunately this workshop relies on the participant / learner to receive immediate feedback via audio. Hearing impaired participation is possible and correctness of a piece of music can be achieved, but will be less enjoyable.

Prerequisites

You need to install Sonic Pi from here: https://sonic-pi.net/