Skip to content

Instantly share code, notes, and snippets.

View matthiasguentert's full-sized avatar
💭
Typing...

Matthias Güntert matthiasguentert

💭
Typing...
View GitHub Profile
@matthiasguentert
matthiasguentert / ffmpeg-cheat-sheet.md
Created March 16, 2022 22:20
ffmpeg-cheat-sheet.md

Smoothing out a video...

ffmpeg -i input.mp4 -filter:v "minterpolate='mi_mode=mci:mc_mode=aobmc:vsbmc=1:fps=30'" output.mp4

Crop a video

ffmpeg -i input.mp4 -filter:v "crop:1920:1080:100:50" output.mp4
@matthiasguentert
matthiasguentert / curl-cheat-sheet.md
Last active January 5, 2022 19:54
Curl Cheat Sheet

Show response headers & body

curl --include https://somehost

Show only response header

curl --head https://somehost
curl -I https://somehost
@matthiasguentert
matthiasguentert / kql-cheat-sheet.md
Last active December 29, 2021 11:56
KQL Cheat Sheet

Get AKS pods logs

let startTimestamp = ago(1h);
KubePodInventory
| where TimeGenerated > startTimestamp
| project ContainerID, PodName=Name
| distinct ContainerID, PodName
| join
(
    ContainerLog
@matthiasguentert
matthiasguentert / postgres-dml-tracing.md
Created December 7, 2021 09:29
Postgres & DML Tracing
create table debug.employee_trail (
	id serial PRIMARY KEY, 
	operation varchar(6) not null, 
	employee_id integer not null, 
	timestamp timestamp not null
);

create or replace function debug.f_employee_changed() returns trigger as 
$$
@matthiasguentert
matthiasguentert / mssql-cheat-sheet.md
Last active December 20, 2023 01:11
MSSQL Cheat Sheet

Iterate over all tables in a db and count its rows

declare @name varchar(100)
declare @sql nvarchar(300)

declare cur cursor for
    select name from sys.tables where type = 'U' and schema_id = 1
open cur

fetch next from cur into @name
@matthiasguentert
matthiasguentert / powershell-cheat-sheet.md
Last active December 3, 2021 13:42
PowerShell Cheat Sheet

Base64 Encode String

$input = "Foobar🤪"
$byteString = [System.Text.Encoding]::UTF8.GetBytes($input)
$base64String = [System.Convert]::ToBase64String($byteString)

Base64 Decode String

$input = "Rm9vYmFy8J+kqg=="
@matthiasguentert
matthiasguentert / mysql-cheat-sheet.md
Last active October 26, 2021 20:02
MySQL Cheat Sheet

Count all tables in a database

-- Count number of tables 
select count(*)
from information_schema.tables
where table_schema = '<my-schema>'

-- Warning! Might return inaccurate results!
select TABLE_NAME, TABLE_ROWS
from information_schema.tables

Set default resource group

az config set defaults.group=MyResourceGroup

Set default subscription

az account set --subscription <name or id>
@matthiasguentert
matthiasguentert / azure-alerts.md
Created July 26, 2021 19:25
How to create an Azure alert rule

Azure CLI version

az monitor action-group create --name ag-notify-admins --resource-group rg-training --action email action-send-mail admin@host.org

# Install App Insights extension (requires Azure CLI 2.0.79 or higher)
az extension add --name application-insights 

# Retrieve resource id 
$scope = az monitor app-insights component show --app appi-demo --resource-group rg-training --query id --output tsv
@matthiasguentert
matthiasguentert / aks-cheat-sheet.md
Last active February 28, 2022 09:06
AKS Cheat Sheet

Forwarding ports

kubectl port-forward --namespace=<namespace> <pod> <localport>:<podport>

# JVM remote debug 
kubectl port-forward --namespace=<namespace> <pod> 5005:5005

Forcefully remove a PVC & PV