Skip to content

Instantly share code, notes, and snippets.

View morxa's full-sized avatar

Till Hofmann morxa

View GitHub Profile
@morxa
morxa / test_generator.sh
Last active August 22, 2016 18:21
test generator
#!/bin/bash
# Copyright 2016 Till Hofmann <[email protected]>
# 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.
random_word () {
ALL_NON_RANDOM_WORDS=/usr/share/dict/words
non_random_words=`cat $ALL_NON_RANDOM_WORDS | wc -l`
random_number=$(expr $non_random_words \* $RANDOM / 32767)
@morxa
morxa / asprintf.c
Last active August 29, 2015 14:03
string concat with asprintf
std::string foo_string = "foo";
std::string bar_string = "bar";
std::string res;
char * tmp;
if (asprintf(&tmp, "concatenation: %s %s", foo_string.c_str(), bar_string.c_str()) != -1) {
res = tmp;
free(tmp);
} else {
throw Exception("Out of memory");
}
@morxa
morxa / lstlang0.sty
Created June 26, 2014 10:06
Latex Listing PDDL Language Definition
\lst@definelanguage{pddl}
{
keywords={
define,
},
morekeywords={[2]
domain,
problem,
requirements,
predicates,
@morxa
morxa / owncloud.log
Last active August 29, 2015 14:00
owncloud client sync bug with external storage subdirectories
05-01 15:17:20:396 csync_walker: directory: /tmp/test/owncloud-test
05-01 15:17:20:396 _csync_detect_update: ==> file: owncloud-test - hash 8671896127397113479, mtime: 1398950224, fileId: 0000730152460427b79e3
05-01 15:17:20:396 _csync_detect_update: Database entry found, compare: 1398950224 <-> 1398949025, etag: 5362450ed9f59 <-> 5362450ed9f59, inode: 65309 <-> 65309
05-01 15:17:20:396 _csync_detect_update: file: owncloud-test, instruction: INSTRUCTION_EVAL <<=
05-01 15:17:20:396 csync_ftw: Uniq ID from Database: owncloud-test/subdir -> 536248b09129d
05-01 15:17:20:396 csync_walker: directory: /tmp/test/owncloud-test/subdir
05-01 15:17:20:397 _csync_detect_update: ==> file: owncloud-test/subdir - hash 3742522823791505315, mtime: 1398950224, fileId: 0000730252460427b79e3
05-01 15:17:20:397 _csync_detect_update: Database entry found, compare: 1398950224 <-> 1398950055, etag: 536248b09129d <-> 536248b09129d, inode: 65310 <-> 65310
05-01 15:17:20:397 _csync_detect_update: file: owncloud-test/subdir, instruction: