Skip to content

Instantly share code, notes, and snippets.

@sfan5
sfan5 / PKGBUILD
Last active Apr 5, 2021
imagine if software just worked
View PKGBUILD
# Maintainer: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
# Contributor: Ionut Biru <ibiru@archlinux.org>
pkgname=networkmanager-openvpn
pkgver=1.8.15dev+1+gf4bd840
pkgrel=1
pkgdesc="NetworkManager VPN plugin for OpenVPN"
url="https://wiki.gnome.org/Projects/NetworkManager"
arch=(x86_64)
license=(GPL)
@sfan5
sfan5 / build.sh
Last active Jan 22, 2021
Compiles qbittorrent-nox & libtorrent-rasterbar statically linked together (+ optional debian package)
View build.sh
#!/bin/bash -e
LIBTORRENT_VER=1.2.12
QBITTORRENT_VER=4.3.3
export CXXFLAGS="-std=c++17"
# Dependencies on Debian/Ubuntu:
#sudo apt install --no-install-recommends \
# g++ make autoconf automake libtool pkg-config \
# zlib1g-dev libssl-dev libboost-system-dev \
@sfan5
sfan5 / build_qemu.sh
Last active Dec 27, 2020
Builds qemu
View build_qemu.sh
#!/bin/bash -e
prefix=/opt/qemu
qemuver=5.2.0
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 \
lib{jpeg,png,aio,jemalloc,cap-ng,glib2.0,pixman-1}-dev
which pacman &>/dev/null && pacman -S --needed \
@sfan5
sfan5 / rtorrent-git.sh
Last active Sep 12, 2020
Compiles rtorrent & libtorrent from git statically linked together
View rtorrent-git.sh
#!/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 / makepkg.sh
Last active Apr 13, 2021
Reimplements functionality of makepkg to a small degree
View makepkg.sh
#!/bin/bash -e
finalpath=/var/tmp/final
msg () {
echo ":: $1"
}
noextract=
[ "$1" == "-e" ] && { noextract=1; shift; }
View ilbot_log_line2.sql
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 / ttml2ass.py
Last active Oct 15, 2020
Converts TTML (XML) subtitles to SSA/ASS format
View ttml2ass.py
#!/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",
@sfan5
sfan5 / convert.sh
Last active Jul 21, 2018
Converting .xm/.mod files to .wav in batch using MilkyTracker
View convert.sh
#!/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 / nginx-libressl.sh
Last active Mar 25, 2021
Compiles nginx statically linked with LibreSSL
View nginx-libressl.sh
#!/bin/bash -e
LIBRESSL_VERSION=3.2.5
NGINX_VERSION=1.19.8
NGINX_CONFIG="--with-pcre-jit --with-threads --with-http_ssl_module --with-http_v2_module --with-http_realip_module"
[ -f libressl.tar.gz ] || \
wget "https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-$LIBRESSL_VERSION.tar.gz" \
-O libressl.tar.gz
@sfan5
sfan5 / alpine-container.sh
Last active Apr 3, 2021
bootable systemd-nspawn containers with Linux distributions: Alpine, Arch Linux, Ubuntu
View alpine-container.sh
#!/bin/bash -e
# Creates a systemd-nspawn container with Alpine
MIRROR=http://dl-cdn.alpinelinux.org/alpine
VERSION=${VERSION:-v3.13}
APKTOOLS_VERSION=2.12.1-r0
if [ $UID -ne 0 ]; then
echo "run this script as root" >&2