Skip to content

Instantly share code, notes, and snippets.

@mclang
mclang / vivaldi-ffmpeg-workaround.sh
Created May 6, 2018 19:11
Downloads and replaces Vivaldi's `libffmpeg.so` library with a prebuild version
#!/bin/bash
# Vivaldi and Opera cannot play some videos on Linux unless the ffmpeg library they use is replaced with proper one.
#
set -e
set -u
# Testing against '$1' directly does not work b/c of 'set -u'
if [[ -z "$@" ]]; then
echo ""
echo "USAGE:"
@mclang
mclang / mkv2mp4_hsubs.sh
Created April 25, 2017 07:37
Converts given mkv files with embedded subtitle _streams_ into _harsub_ mp4 files using ffmpeg. Uses hardlinking to overcome problem with spaces in filename of the source subtitle file.
#!/bin/bash
set -u
set -e
shopt -s nullglob
for MKV in "$@"; do
out="$(basename "$MKV" .mkv).mp4"
echo "CONVERTING '$MKV''"
cp -l "$MKV" input.mkv
ffmpeg -i input.mkv -c:a copy -c:v libx264 -preset veryslow -crf 23 -vf subtitles=input.mkv "$out"
@mclang
mclang / ksm_stats_in_MB
Last active October 4, 2021 14:37 — forked from wankdanker/ksmstat
Simple bash script to calculate ksm stats in MB
#!/bin/bash
if [ "$1" != "" ]; then
echo "
----------------------------------------------------------------------------
http://www.kernel.org/doc/Documentation/vm/ksm.txt :
The effectiveness of KSM and MADV_MERGEABLE is shown in /sys/kernel/mm/ksm/:
pages_shared - how many shared pages are being used