Skip to content

Instantly share code, notes, and snippets.

View velnias75's full-sized avatar
🏠
Working from home

Heiko Schäfer velnias75

🏠
Working from home
View GitHub Profile
@velnias75
velnias75 / karatsuba.php
Last active July 16, 2017 04:16
PHP implementation of the Karatsuba algorithm (base 10)
<?php
function karatsuba($num1, $num2) {
if(($num1 < 10) || ($num2 < 10)) {
return $num1 * $num2;
}
$m = ceil((max(ceil(log10($num1)), ceil(log10($num2))))/2);
@velnias75
velnias75 / aplan.xslt
Last active April 15, 2017 07:21
XSLT-template to output a VLC playlist suitable to convert to MP4 files
<stylesheet version="1.0"
xmlns="http://www.w3.org/1999/XSL/Transform"
xmlns:strings="http://exslt.org/strings"
xmlns:xspf="http://xspf.org/ns/0/">
<output method="text" encoding="utf-8"/>
<variable name="apos">'</variable>
<param name="outdir" select="'/data1/var/tmp'"/>
@velnias75
velnias75 / timeleft.sh
Created October 31, 2016 15:22
Simple time estimator for avconv, without any error checking
#!/bin/sh
#
# Simple time estimator for avconv, without any error checking
#
# Usage: timeleft.sh HH:MM:SS.nn SOURCE_FPS ENCODE_FPS TIME
#
# Notice: for fractional SOURCE_FPS multiply SOURCE_FPS to an integer
# and ENCODE_FPS by the same factor,
# i.e. ENCODE_FPS=24.92 and SOURCE_FPS=5 => 2492 500
#
@velnias75
velnias75 / rnd_expr.py
Last active February 18, 2016 05:03
Python script to create random (huge) expressions
#!/usr/bin/env python
#
# Copyright (C) 2016 Heiko Schaefer <heiko@rangun.de>
#
# This work is free. You can redistribute it and/or modify it under the
# terms of the Do What The Fuck You Want To Public License, Version 2,
# as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.
#
import ast
@velnias75
velnias75 / qgithubreleaseapi-9999.ebuild
Last active February 14, 2016 06:41
Gentoo ebuild for QGitHubReleaseAPI with GitHub fetch
# Copyright 2015 Heiko Schaefer <heiko@rangun.de>
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI=5
inherit cmake-utils eutils git-r3
DESCRIPTION="Qt library to receive release information from the GitHub API"
HOMEPAGE="https://github.com/velnias75/QGitHubReleaseAPI"