Skip to content

Instantly share code, notes, and snippets.


Michael Hamann michitux

View GitHub Profile
michitux / rotate.patch
Created Apr 27, 2020
Patch to rotate resized images in DokuWiki based on EXIF orientation
View rotate.patch
--- a/inc/media.php 2018-12-28 17:46:14.000000000 +0100
+++ b/inc/media.php 2018-08-20 21:05:55.000000000 +0200
@@ -1084,6 +1084,15 @@
$w = (int) $info[0];
$h = (int) $info[1];
+ if ($meta) {
+ $orientation = media_getTag('Orientation', $meta);
+ if ($orientation == 3 || $orientation == 6) {
+ $tmp = $h;
michitux / Profiling-deleted-nodes.ipynb
Created Jul 24, 2017
Example for broken NetworKit profiles with deleted nodes
View Profiling-deleted-nodes.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
michitux /
Last active Sep 27, 2021
Export a series of git commits into patches.
# Inspired by
# This calls git log to get a list of commits that affect a certain file pattern and then exports each of them into a file
# If the exported commits shall be limited to these files, another pathspec could be added in the second git log call.
# The code is split into several lines to make it more readable, but all ";" are there such that all line breaks could be removed.
git log --oneline --reverse -- your/pathspec.* |cut -d' ' -f1 | while read a;
michitux / anotherTest.pyx
Last active Oct 22, 2019
Simple example that shows a compilation problem with Cython (see error.log for the error message), fixedTest.pyx shows a workaround. anotherTest.pyx is another failing example.
View anotherTest.pyx
# This file also fails to compile with error error: redefinition of ‘std::vector<int, std::allocator<int> > __pyx_convert_vector_from_py_int(PyObject*)’. Note that it only fails when I have another definition without the fused type.
from libcpp.vector cimport vector
cdef extern from "test.h":
cdef cppclass _TestClassInt "TestClass<int>":
vector[double] toDouble(const vector[int] &items) except +
cdef cppclass _TestClassChar "TestClass<char>":
vector[double] toDouble(const vector[char] &items) except +
michitux / indexer.patch
Created Apr 8, 2013
Backported GIF output fix ( for DokuWiki 2012-01-25b "Angua" both as patch and as the resulting file lib/exe/indexer.php
View indexer.patch
diff --git a/lib/exe/indexer.php b/lib/exe/indexer.php
index 95e2af0..9edd8be 100644
--- a/lib/exe/indexer.php
+++ b/lib/exe/indexer.php
@@ -16,15 +16,16 @@ if(!defined('NL')) define('NL',"\n");
// check if user abort worked, if yes send output early
$defer = !@ignore_user_abort() || $conf['broken_iua'];
+$output = isset($_REQUEST['debug']) && $conf['allowdebug'];
michitux / iexec
Created Mar 1, 2013
Simple script for executing a command whenever a file in the current directory (or a subdirectory of it) that matches a certain expression (using grep) is changed. The script uses inotifywait (from inotify-tools), i.e. it waits efficiently using inotify. The rationale for watching the whole directory is that editors like VIM work with temporary …
View iexec
inotifywait -r -m --format '%f' -e close_write "$PWD" | while read file; do
if echo "$file" | grep "$expression"; then
michitux / s9y2blogger.php
Created Sep 16, 2012
PHP script to generate a Blogger Import file from a Serendipity database, it does some automatic conversion of utf-8 using iconv
View s9y2blogger.php
class s9y2blogger {
private $database = NULL;
private $errors = array();
private $curEntry = array(); // current entry of the parser
private $inPublished = false;
public function __construct() {
michitux / arte_download.rb
Created Feb 16, 2011
Simple script for downloading Arte videos. Use at your own risk (and respect the copyright of Arte), it requires rtmpdump.
View arte_download.rb
require 'net/http'
require 'cgi'
require 'rexml/document'
require 'optparse'
require 'time'
options = {
:lang => 'de',
michitux / goQR.js
Created Jul 26, 2010
Bookmarklet for quickly creating QR-codes from URLs using QR-Server
View goQR.js
/* This bookmarklet tries to find the first selected link and opens the QR code. When no link is selected the current URL is used. */
/* This bookmarklet uses the current URL. On some pages the above bookmarklet doesn't work/always uses an unwanted URL. If you experience this issue or don't need selected links try this one. */
michitux / JamendoOGGDownloadBookmarklet.js
Last active Dec 26, 2016
Bookmarklet for downloading the normally hidden OGG version of any Jamendo album.
View JamendoOGGDownloadBookmarklet.js