Skip to content

Instantly share code, notes, and snippets.

View slhck's full-sized avatar

Werner Robitza slhck

View GitHub Profile
@slhck
slhck / csv_to_ndjson.py
Created June 22, 2022 08:12
Convert CSV to NDJSON (LDJSON)
#!/usr/bin/env python3
#
# csv_to_ndjson.py
#
# Author: Werner Robitza
#
# Convert CSV files to .ndjson.
# This assumes the same keys being used in every line of the input file.
# It works on a line-by-line basis, so it should be fast and memory-efficient.
@slhck
slhck / fft.py
Last active May 11, 2022 19:51
Code for calculating FFT and radial profile of an image
#!/usr/bin/env python3
#
# Code for calculating FFT and radial profile of an image
#
# Implements a method similar to:
# Katsavounidis, I., Aaron, A., & Ronca, D. (2015, October). Native resolution detection
# of video sequences. In SMPTE 2015 annual technical conference and exhibition (pp. 1-20).
# SMPTE.
#
# Author: Werner Robitza
@slhck
slhck / gist:7ca145663f5898b2a9018106cc0b0d6a
Created December 6, 2021 07:55
FFmpeg Filter Grammar
// Work in progress! Does not handle escapes within filter arguments.
FilterGraph =
head: FilterChain
tail:(";" @FilterChain)*
{ return [head, ...tail]; }
FilterChain =
head: Filter
tail:("," @Filter)*
@slhck
slhck / word-to-json-string.sh
Created November 12, 2020 14:53
Convert a Word document to a Markdown-formatted JSON-parsable string
#!/usr/bin/env bash
#
# Convert a Word document to a Markdown-formatted JSON-parsable string
pandoc "$1" -t gfm-raw_html --wrap=preserve -o - | python -c 'import json; import sys; print(json.dumps(sys.stdin.read()))'
@slhck
slhck / ffmpeg-progress.py
Last active July 10, 2023 11:29
Run an ffmpeg command and get the progress in percent
#!/usr/bin/env python3
#
# Run an ffmpeg command with a progress iterator
# Author: Werner Robitza
# Based on: https://gist.github.com/Hellowlol/5f8545e999259b4371c91ac223409209
# For a library version, see https://pypi.org/project/ffmpeg-progress-yield/
# License: MIT
import subprocess
import re
@slhck
slhck / diagnostics.txt
Created July 15, 2020 07:00
RStudio diagnostics
RStudio Diagnostics Report
==========================
WARNING: This report may contain sensitive security information and / or
personally identifiable information. Please audit the below and redact any
sensitive information before submitting your diagnostics report.
Generated: Wed Jul 15 08:58:21 2020
@slhck
slhck / pyproject.toml
Created March 16, 2020 10:01
SSH in Poetry
[tool.poetry]
name = "test"
version = "0.1.0"
description = ""
authors = ["Werner Robitza <werner.robitza@gmail.com>"]
[tool.poetry.dependencies]
python = "^3.8"
ffmpeg_bitrate_stats = { git = "ssh://git@github.com:slhck/ffmpeg-bitrate-stats.git" }
@slhck
slhck / release.sh
Created January 16, 2020 09:00
A simple release script for Python projects
#!/bin/bash
#
# Bump the version, run auto-changelog, and push to Git
#
# Based on:
# - https://gist.github.com/pete-otaqui/4188238
# - https://gist.github.com/mareksuscak/1f206fbc3bb9d97dec9c
#
# Requirements:
# - `npm i -g auto-changelog`
{"lastUpload":"2021-06-17T18:38:14.803Z","extensionVersion":"v3.4.3"}
@slhck
slhck / # libvmaf - 2019-04-12_08-37-31.txt
Created April 13, 2019 15:52
libvmaf on 4.9.125-linuxkit - Homebrew build logs
Homebrew build logs for libvmaf on 4.9.125-linuxkit
Build date: 2019-04-12 08:37:31