Skip to content

Instantly share code, notes, and snippets.

View sfan5's full-sized avatar

sfan5

  • Germany
  • 12:36 (UTC +02:00)
View GitHub Profile
@sfan5
sfan5 / webm_twopass.txt
Last active April 28, 2017 21:08
script for twopass encoding of webms
#!/bin/bash -e
src="2QO90IaN_UM.mkv"
dst="a.webm"
opts="-vf scale=1280:720 -threads 10"
aopts="-c:a libopus -b:a 128k"
vopts="-c:v libvpx-vp9 -b:v 1024k -tile-columns 6 -frame-parallel 1 -row-mt 1"
vopts_final="-auto-alt-ref 1 -lag-in-frames 25"
ffmpeg -i "$src" $opts \
@sfan5
sfan5 / alpine-container.sh
Last active February 15, 2025 13:49
Create bootable systemd-nspawn containers with Alpine, Arch Linux or Ubuntu
#!/bin/bash -e
# Creates a systemd-nspawn container with Alpine
MIRROR=http://dl-cdn.alpinelinux.org/alpine
VERSION=${VERSION:-v3.21}
APKTOOLS_VERSION=2.14.6-r3
wget_or_curl () {
if command -v wget >/dev/null; then
@sfan5
sfan5 / nginx-libressl.sh
Last active April 17, 2025 12:51
Compiles nginx statically linked with LibreSSL
#!/bin/bash -e
LIBRESSL_VERSION=4.0.0
NGINX_VERSION=1.27.5
NGINX_CONFIG=(
--with-pcre-jit --with-threads
--with-http_ssl_module
--with-http_v2_module
--with-http_realip_module
--with-http_stub_status_module
--with-http_auth_request_module
@sfan5
sfan5 / convert.sh
Last active March 11, 2022 03:59
Converting .xm/.mod files to .wav in batch using MilkyTracker
#!/bin/bash -e
# adjust as needed, leave encode_ext empty to keep the wav files
encode_ext="opus"
function encode_func() {
# $1: source file (wav)
# $2: destination file
opusenc --quiet --bitrate 64 "$1" "$2"
}
@sfan5
sfan5 / ttml2ass.py
Last active December 6, 2021 16:40
Converts TTML (XML) subtitles to SSA/ASS format
#!/usr/bin/env python3
import sys
from xml.dom.minidom import parseString
COLORS = { # TODO more colors
"white" : "FFFFFF",
"black" : "000000",
"yellow" : "FFFF00",
"green" : "00FF00",
"cyan" : "00FFFF",
DELIMITER //
CREATE PROCEDURE `ilbot_log_line2`(IN p_time TIMESTAMP, IN p_channel VARCHAR(30), IN p_nick VARCHAR(40), IN p_line mediumtext)
LANGUAGE SQL
NOT DETERMINISTIC
SQL SECURITY INVOKER
COMMENT 'Log a line from IRC with custom timestamp'
BEGIN
DECLARE channel_id, day_id INT(11);
DECLARE today CHAR(10);
START TRANSACTION;
@sfan5
sfan5 / makepkg.sh
Last active August 2, 2023 14:12
Reimplements functionality of makepkg to a small degree
#!/bin/bash -e
finalpath=/var/tmp/final
msg () {
echo ":: $1"
}
noextract=
bfile=PKGBUILD
@sfan5
sfan5 / rtorrent-git.sh
Last active September 12, 2020 09:12
Compiles rtorrent & libtorrent from git statically linked together
#!/bin/bash -e
LIBTORRENT_BRANCH=master
LIBTORRENT_CONFIG="--disable-debug"
RTORRENT_BRANCH=master
RTORRENT_CONFIG="--disable-debug --enable-ipv6"
# Dependencies on Debian/Ubuntu:
#sudo apt install \
# g++ make autoconf libtool pkg-config \
# zlib1g-dev libssl-dev libcurl4-openssl-dev \
@sfan5
sfan5 / build_qemu.sh
Last active April 19, 2023 17:27
Builds qemu
#!/bin/bash -e
prefix=/opt/qemu
qemuver=7.2.1
targets=('x86_64' 'i386')
# install dependencies
which apt-get &>/dev/null && apt-get install -y --no-install-recommends \
gcc make python3 pkg-config bison flex ninja-build \
lib{jpeg,png,aio,jemalloc,cap-ng,glib2.0,pixman-1}-dev
which pacman &>/dev/null && pacman -S --needed \
@sfan5
sfan5 / build.sh
Last active May 11, 2024 21:07
Compiles qbittorrent-nox as statically linked build (+ deb package)
CMAKE_VER=3.29.3
QT_VER=6.7.0
LIBTORRENT_VER=2.0.10
QBITTORRENT_VER=4.6.4
export LANG=C.UTF-8
export CXXFLAGS="-std=c++17 -flto=auto"
export LDFLAGS="-flto=auto"
export MAKEFLAGS="-j12"