Skip to content

Instantly share code, notes, and snippets.

@programminghoch10
programminghoch10 / mintedcleverref.tex
Created February 23, 2025 14:45
LATeX Minted Cleverref Line Numbers
% insert these two lines after your \usepackage{cleveref}
% then use \mintedlinelabel{labelname} inside the minted file using the "escapeinside" minted option
% then \cref and deriviates should correctly reference as "line x"
\newcounter{line}
\newcommand{\mintedlinelabel}[1]{\setcounter{line}{\value{FancyVerbLine}}\addtocounter{line}{-1}\refstepcounter{line}\label{#1}}
@programminghoch10
programminghoch10 / RipDVDsusingFFmpeg.md
Last active September 17, 2024 10:44
Rip DVDs using FFmpeg

Rip DVDs using FFmpeg

This Gist provides an easy to use script for ripping DVDs using FFmpeg.

Install

Install ffmpeg, libdvdcss2 and lsdvd on your system.

@programminghoch10
programminghoch10 / lsdvdjson.sh
Created September 12, 2024 17:33
lsdvd output as JSON
lsdvd -x -Oy | sed -e 's/^lsdvd = //' -e "s/'/\"/g" | tr -d '\n'| sed -e 's/,\s*}/}/g' -e 's/,\s*]/]/g'
@programminghoch10
programminghoch10 / android_external_protobuf.patch
Created August 8, 2024 15:58
statically linked aapt2 binary for android
diff --git a/Android.bp b/Android.bp
index a2a2cbdc8..16dc0e699 100644
--- a/Android.bp
+++ b/Android.bp
@@ -252,7 +252,7 @@ cc_library {
target: {
android: {
static: {
- enabled: false,
+ enabled: true,
@programminghoch10
programminghoch10 / remove-mkvmerge-statistics-metadata.md
Last active December 7, 2024 16:32
remove mkvmerge statistics metadata

After mkvmerge processed an mkv file, all streams have a lot of statistics metadata tagged onto them.

For example:

Stream #0:27: Subtitle: hdmv_pgs_subtitle
    Metadata:
      BPS-eng         : 40153
      DURATION-eng    : 02:26:34
      NUMBER_OF_FRAMES-eng: 3294
      NUMBER_OF_BYTES-eng: 34073971
@programminghoch10
programminghoch10 / FFmpegISOlanguagecodesforJellyfin.md
Last active December 7, 2024 16:29
FFmpeg ISO language codes for Jellyfin

Jellyfin uses only ISO 639-2 language codes to translate the metadata tag eng to English for the track selector.

For some languages multiple such tags exist, for example Germany has ger and deu. Here only the tag deu is correctly translated to German whilst ger remains unrecognized.

mkvmerge always replaces the language codes with the matroska specified set of langauge codes, which sadly are the wrong ones for Jellyfin.

As an end user one can use ffmpeg to rewrite the metadata language tags to the correct set for Jellyfin.

@programminghoch10
programminghoch10 / semlock.sh
Last active January 23, 2024 09:48
Simple bash script parallelization using semaphores
#!/bin/bash
SEMPATH="/run/lock"
SEMNAME=""
semtake() {
local name="$1"
[ -z "$name" ] && echo "Missing semaphore name!" && return 1
local j="$2"
[ -z "$2" ] && j=$(nproc)
@programminghoch10
programminghoch10 / torsocksmulticore.sh
Last active February 12, 2023 15:11
Multi-Core Torsocks
#!/bin/bash
# TorSocksMultiCore
# a wrapper for torsocks for multicore tor execution
#
# This script starts a new tor daemon everytime it is invoked.
# This way every command or shell will have it's own tor daemon.
# The usage is functionally equivalent to torsocks itself.
#
@programminghoch10
programminghoch10 / nccp.sh
Last active May 14, 2022 11:00
scp compliant copy without encryption using netcat
#!/bin/bash
echo "Arguments: "
echo "${@}"
set -x #explain steps for debug purposes
set -e #exit when any command executed fails unexpectedly
IFS=$'\n'
@programminghoch10
programminghoch10 / bl_splash_helper.sh
Last active March 19, 2024 08:00
Samsung UP_PARAM Bootloader Splash Helper Script
#!/bin/bash
DEVICE="unknown"
PIC_META_FILE="up_param_files_${DEVICE}.txt"
if [ "$1" = "" ]; then
echo "This script helps you create your own up_param file for modifying bootloader splashes on samsung devices."
echo
echo "Download the stock firmware, extract it until you have up_param.bin"
echo "Set your device codename by editing this script. (Currently set to \"$DEVICE\")"