Skip to content

Instantly share code, notes, and snippets.

View sepastian's full-sized avatar
💭
\_ . |‾‾‾| o-`o

Sebastian Gassner sepastian

💭
\_ . |‾‾‾| o-`o
View GitHub Profile
@sepastian
sepastian / nikon_d7000_hdmi.md
Last active April 17, 2024 17:53
Nikon D7000 full screen HDMI output

Purpose

Stream HDMI video from a Nikon D7000, for usage in online meetings, video recording, etc.

Based on this video on Youtube.

Steps

1) Download firmware

@sepastian
sepastian / downgrade_debian.md
Last active March 16, 2024 12:19
Downgrade Debian
@sepastian
sepastian / dvgrab_ffmpeg.sh
Created March 3, 2024 17:20
Camcorder to digital video
# Grab video from a camcorder using dvgrap,
# convert to h.265 encoded video using ffmpeg.
#
# https://trac.ffmpeg.org/wiki/Encode/H.265
# https://regx.dgswa.com/html/content/dvgrab-ffmpeg-capture-compression
dvgrab --format dv1 --rewind - \
| ffmpeg -f dv -i - \
-vf yadif \
-c:v libx265 -crf 26 \
@sepastian
sepastian / DEPRECATED_pip_install_in_coderpad.py
Last active October 25, 2023 10:13
(DEPRECATED) Install any pip package in Coderpad
# DEPRECATED:
# In addition to running Python code, the coderpad console allows
# to pip install packages as well:
#
# >>> pip install sortedcontainers
#
# Using the code below is not required.
# It will be kept here for reference, as it shows how to access
# the Coderpad environment.
@sepastian
sepastian / main.cpp
Last active September 29, 2023 13:28
Multiple STL containers referencing same object in C++
#include <set>
#include <iostream>
#include <vector>
/*
* How to order a set<vector<A>::iterator>.
*/
struct A
{
@sepastian
sepastian / meson_ninja.sh
Created September 29, 2023 07:33
Building C++ with Meson and Ninja
# https://germandiagogomez.medium.com/getting-started-with-meson-build-system-and-c-83270f444bee
# Create project directory.
mkdir new_project
cd new_project
# Create source file.
echo "int main() {};" >> main.cpp
# Init meson, setup meson.
@sepastian
sepastian / gst_tools_examples.sh
Created October 7, 2013 12:10
Use gst-launch (gstreamer-tools) to capture single images and stream video from the command-line.
# Capture a single image and save it in JPEG format.
$ gst-launch v4l2src num-buffers=1 ! jpegenc ! filesink location=/tmp/test.jpg
# Stream video from a webcam.
$ gst-launch v4l2src ! xvimagesink
@sepastian
sepastian / v4l2_set_camera_zoom_level.md
Last active June 29, 2023 07:58
V4L2 set camera zoom level

Environment

$ uname -a
Linux x220 6.3.0-1-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.3.7-1 (2023-06-12) x86_64 GNU/Linux

List Cameras

@sepastian
sepastian / raw_to_ppm_to_jpg.sh
Created June 18, 2023 12:34
RAW to PPM (dcraw) to JPG (imagemagick)
#!/bin/bash
set -euo pipefail
# Convert (Nikon/NEF) RAW images to PPM using dcraw;
# write results to stdout with -c;
# convert stdin to JPG using Imagemagick's convert;
# specify format of input image with 'ppm:-'.
find /path/to/sdcard/ -name '*.NEF' \
| parallel 'dcraw -c {} \
@sepastian
sepastian / pdftk_rotate_even_odd_pages_differently.sh
Created June 18, 2019 15:19
PDFTK: rotate even/odd pages differently
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
# From https://unix.stackexchange.com/a/18631/56290
# Rotate even pages by 180 degrees, don't rotate odd pages.
pdftk A=infile.pdf shuffle Aoddnorth Aevensouth output outfile.pdf