Skip to content

Instantly share code, notes, and snippets.

View cknd's full-sized avatar

Clemens Korndörfer cknd

  • Berlin
View GitHub Profile
@cknd
cknd / ffmpeg calls
Last active March 18, 2021 16:00
magic ffmpeg calls
# pack a bunch of images into a nice-looking gif running at 5 fps (with rescaling and a proper color palette)
ffmpeg -f image2 -r 5 -i %*.png -vf "scale=450:-1,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" out.gif
# convert section of video to gif (with palette, rescale and slowdown)
ffmpeg -ss 00:00:43 -to 00:00:49.5 -i input.mp4 -r 15 -vf "scale=300:-1,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse,setpts=2.0*PTS" out.gif
# shrink a video (half the size and _slightly_ lower quality)
ffmpeg -i input.mp4 -vf scale="iw/2:ih/2" -crf 30 output.mp4
@cknd
cknd / .bashrc
Last active November 15, 2022 10:23
some cobbled-together dotfiles, mostly to add the git branch to the bash prompt and to make history infinite, cross-session and searchable by arrow-up prefix completion
# 1) set CUDA paths even if this bash session isnt running interactively
export CUDA_HOME="/usr/local/cuda"
export PATH="$CUDA_HOME/bin:$PATH"
export LD_LIBRARY_PATH="$CUDA_HOME/lib64:$LD_LIBRARY_PATH"
export CPATH="$CUDA_HOME/include:$CPATH"
export LIBRARY_PATH="$CUDA_HOME/lib64:$LIBRARY_PATH"
export TF_MIN_GPU_MULTIPROCESSOR_COUNT='3'
@cknd
cknd / traceback.py
Last active March 20, 2023 21:39
super verbose python tracebacks
import sys
import traceback
import linecache
def printlocals(frame, truncate=500, truncate__=True):
sep = '.' * 50
msg = ' %s\n' % sep
for name, value in sorted(frame.f_locals.items()):
if hasattr(value, '__repr__'):
try:
@cknd
cknd / mandelprot.pl
Last active September 3, 2016 11:37
prolog ascii art mandelbrot maker, makes cheesy mandelbrot ascii art in prolog. Run in swipl and type "helper."
% prolog ascii art mandelbrot maker, makes cheesy mandelbrot ascii art in prolog
% c korndoerfer, jan '10
%:- dynamic state/7.
:- dynamic storedvalue/3.
drawanddebug:-
guitracer, trace,
set(5,5,-1.4,1.4,-2,2,20).
% start state