Skip to content

Instantly share code, notes, and snippets.

View fritschy's full-sized avatar

Marcus Borkenhagen fritschy

  • Black Forest, Germany
View GitHub Profile
@fritschy
fritschy / ffmpeg-one-liners.sh
Last active September 7, 2024 01:27
ffmpeg one-liners
# For all snippets, check documentation for details and settings.
# encode video from a V4L2 device, using specified settings.
# x265 worked somewhat better here and produced less skips (although uses 10x CPU compared to x264)
ffmpeg -f video4linux2 -framerate 30 -input_format mjpeg -video_size 1920x1080 -i /dev/video6 -c:v libx265 -preset ultrafast -c:a none -crf 20 out.mp4
# Convert a raw YUYV422 frame from my USB "microscope" to PNG:
# other valid pixel formats are e.g. rgb24 or yuv420p
ffmpeg -f rawvideo -video_size 2592x1944 -pixel_format yuyv422 -i input_yuyv422_2592x1944.dat -f image2 output.png
@fritschy
fritschy / Dockerfile
Last active July 29, 2019 13:04
Blender from source Dockerfile
FROM debian:buster
ENV LC_ALL C.UTF-8
RUN apt update
RUN apt install -y --no-install-recommends git
RUN git clone -j$(nproc) --recursive -b blender-v2.80-release git://git.blender.org/blender.git /usr/src/blender
#RUN git clone https://github.com/OpenImageIO/oiio /usr/src/oiio
@fritschy
fritschy / Dockerfile
Created October 7, 2019 10:57
Loosely Debian-Based Docker image for blender
FROM debian:buster
ENV LD_LIBRARY_PATH /blender/lib
RUN apt update && \
apt install --no-install-recommends -y curl bzip2 libfreetype6 \
libx11-6 libxi6 libxrender1 libxxf86vm1 libxfixes3 runit \
busybox-static && \
mkdir /blender && curl -kSL https://mirror.clarkson.edu/blender/release/Blender2.80/blender-2.80-linux-glibc217-x86_64.tar.bz2 | \
tar -jx -C /blender --strip-components=1 && \
@fritschy
fritschy / tcpdump-bpf-disasm.sh
Created December 17, 2019 11:01
How to disassemble a pcap BPF program
#!/bin/sh
(
echo -n load bpf ""
sudo tcpdump -ilo -ddd "$@" | tr '\n' ','
echo
echo disassemble
) | bpf_dbg
@fritschy
fritschy / Makefile
Created December 17, 2019 18:32
Sensible GNU Makefile Template
# Sensible Makefile Template
# Soure: https://web.archive.org/web/1/https://tech.davis-hansson.com/p/make/
SHELL := bash
.ONESHELL:
.SHELLFLAGS := -eu -o pipefail -c
.DELETE_ON_ERROR:
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules
ifeq ($(origin .RECIPEPREFIX), undefined)
@fritschy
fritschy / fxlib.h
Created January 9, 2020 08:04 — forked from holubv/fxlib.h
CASIO fx-9860G SDK Library (with documentation) https://edu.casio.com/
/*****************************************************************/
/* */
/* CASIO fx-9860G SDK Library */
/* */
/* File name : fxlib.h */
/* */
/* Copyright (c) 2006 CASIO COMPUTER CO., LTD. */
/* */
/*****************************************************************/
#ifndef __FXLIB_H__
@fritschy
fritschy / reddit-stuff.js
Last active March 11, 2020 09:29
Unsave/Unlike reddit posts JS snippet
// Paste to firefox js console
// Source: https://stackoverflow.com/a/59443772
// XXX unsave posts
const delay = ms => new Promise(res => setTimeout(res, ms));
(async () => {
for (const a of document.querySelectorAll('.link-unsave-button > a, .comment-unsave-button > a')) {
a.click();
await delay(300);
}
@fritschy
fritschy / not-so-smallpt-min.rs
Last active July 29, 2025 07:34
Not so smallpt rust port...
use std::{f64::consts::*,io::*,ops::*,*};type B<T>=Vec<T>; type T=f64;#[
derive(Copy,Clone)]struct V(T,T,T);impl Add for V{ type Output=V;fn add(
self,o:V)->V{V(self.0+o.0, self.1+o.1, self.2+o.2)}} impl Sub for V{type
Output=V; fn sub(self,o:V) ->V{V(self.0-o.0,self.1-o.1,self.2-o.2)}}impl
Mul<T>for V{type Output=V;fn mul(self,o:T)->V{V(self.0*o,self.1*o,self.2
*o)}}impl Mul for V{type Output=V;fn mul(self,o:V)->V{V(self.0*o.0,self.
1*o.1,self.2*o.2)}}const fn b(f:T)->V{V(f,f,f)}impl V{fn n(self)->V{self
*(1./self.d(self).sqrt())}fn d(self,o:V)->T{self.0*o.0+self.1*o.1+self.2
*o.2}fn c(self,o:V)->V{V( self.1*o.2- self.2*o.1, self.2*o.0-self.0*o.2,
self.0*o.1-self.1*o.0)}}#[derive(Copy,Clone)]struct R(V,V);enum M{D,S,R}
@fritschy
fritschy / cryptsetup-with-luks2-and-integrity-demo.sh
Created April 20, 2020 13:08 — forked from MawKKe/cryptsetup-with-luks2-and-integrity-demo.sh
dm-crypt + dm-integrity + dm-raid = awesome!
#!/usr/bin/env bash
#
# Author: Markus (MawKKe) [email protected]
# Date: 2018-03-19
#
#
# What?
#
# Linux dm-crypt + dm-integrity + dm-raid (RAID1)
#
@fritschy
fritschy / encode-video.zsh
Last active June 1, 2021 13:47
Wrapper around my mostly-used-part of ffmpeg ...
#!/usr/bin/env zsh
set -e
FFMPEG="$HOME/Downloads/ffmpeg-4.2.1-amd64-static/ffmpeg"
CRF=20
VCODEC=libx264
PRESET=
DEBUG=x
FORCE=()