- 
        Apr 18, 2023Activate more verbose LaTeX errors: \errorcontextlines=200 %%%%% THIS IS THE IMPORTANT LINE \documentclass[12pt]{report} \usepackage[a4paper,widh=100mm,top=50mm]{geometry} \begin{document} test \end{document}
- 
        Apr 18, 2023I used this technique to vectorize smartphone photos of hand-drawn pencil sketches to be included in a presentation using comic sans typeset and xkcd style charts: convert -channel RGB -compress None input.jpg bmp:- | potrace -s - -o output.svg
- 
        Apr 18, 2023Pythons stdout/stderr are buffered by default, leading to weird behavior, especially when running massively parallel. Running with python -uto activates unbuffered stdout/stderr and therefore helps finding all kinds of strange bugs in such environments.
- 
        Apr 18, 2023Profiling Python apps (e.g., app.py)pip3 install cProfile sudo apt install pyprof2calltreelaunch your code via: python3 -m cProfile -o app.cprof app.pypyprof2calltree -k -i app.cprofNote that the latter will call kcachegrind. On old versions of kcachegrind the time unit is not given directly. It should be in the Shortdescription field of the event type and is nanoseconds on my device.
- 
        Apr 18, 2023Working on LaTeX documents while continuously rebuilding in the background on changes and displaying can be done using latexmk:latexmk -pvc main.tex
- 
        Apr 18, 2023Inspect binary files and libraries (.so files and so on): - readelf -d <lib.so> - strings <lib.so> - nm -D <lib.so> - nm -Ca <lib.so> - ldd <lib.so>- see man ld.soto check in which order things will be linked
- compile time information can be added using the -rflags!
 
- see 
- 
        Dec 21, 2018Imagine you just installed a package into $PREFIXvia:$ ./configure --prefix=$PREFIX $ make installTo now execute the recently installed piece of software it would be cool to have a generic environment setup script: $ source generic-setenv.sh $PREFIXAnd here it is generic-setenv.sh- to be put in your$PATH:export PREFIX=$1 export PATH=$PREFIX/bin:$PATH export LD_LIBRARY_PATH=$PREFIX/lib:$LD_LIBRARY_PATH export LD_LIBRARY_PATH=$PREFIX/lib64:$LD_LIBRARY_PATH export PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig:$PKG_CONFIG_PATH export PKG_CONFIG_PATH=$PREFIX/lib64/pkgconfig:$PKG_CONFIG_PATH
- 
        Dec 28, 2017I use this script ( toWindowsFilename.sh) to clean my mp3 filenames:#!/bin/bash # usage: toWindowsFilename.sh '*.mp3' for dryrun # usage: toWindowsFilename.sh --no-dry '*.mp3' for real rename. DRY=1 if [ "$1" = "--no-dry" ]; then DRY=0 input=$2 else input=$1 fi for f in $input; do new_name="$f" re[1]=" /_" re[2]="ä/ae" re[3]="ö/oe" re[4]="ü/ue" re[5]="Ä/AE" re[6]="Ö/OE" re[7]="Ü/UE" re[8]="ß/ss" # convert special chars i=1 while [ "$i" -le "${#re[@]}" ]; do new_name=`echo "$new_name" | sed -e"s/${re[i]}/g"` i=$((i+1)) done # strip lasting special chars new_name=`echo "$new_name" | tr -cd '.A-Za-z0-9_-'` echo $new_name if [ "$DRY" == "0" ]; then mv "$f" $new_name fi doneTo run it in the current directory on all mp3 files: toWindowsFilename.sh --no-dry '*.mp3'
- 
        Nov 21, 2017This shows a way to set the version variables in cmake by parsing the version string execute_process(COMMAND mpirun --version OUTPUT_VARIABLE mpi_version_output) STRING(REGEX REPLACE "^.+([0-9]+)\\.([0-9]+)\\.([0-9]+)(\n.*)*$" "\\1;\\2;\\3" RESULT ${mpi_version_output}) list(GET RESULT 0 MAJOR_VERSION) list(GET RESULT 1 MINOR_VERSION) list(GET RESULT 2 PATCH_VERSION) message(${MAJOR_VERSION}) message(${MINOR_VERSION}) message(${PATCH_VERSION})- copy version string into array string (1.10.2->1;10;2)
- now we can access it with the list command
 
- copy version string into array string (
- 
        Oct 20, 2015Recursively generate m3u files containing all music files of a directory, which is an especially useful thing to do for music libraries on smartphones without a folder player (e.g. Blackberry, Android standard player!?) execute in music dir: prepath="$(pwd)/" for sufpath in **/; do echo processing $sufpath cd "$prepath$sufpath" dirname=${PWD##*/} ls | grep -i ".*\.\(mp3\|ogg\|m4a\|wma\)\$" > "$dirname.m3u" done;
- 
        Dec 5, 2014To flatten a unix directory structure ( indir) one can usefindwith-exec-parameter:$ find indir -iname '*.jpg' -exec cp {} outdir/ \;outdirshould not be inside ofindirto avoid recursion hell. If copying needs too much space generating hard links instead is a good idea:$ find indir -iname '*.jpg' -exec ln '{}' outdir/ \;This is especially useful when generating folders for photo slide shows. 
- 
        Aug 21, 2014Shortest clean up script for git using code bases: rm -rf *; git reset --hard
- 
        Aug 3, 2014Since the LaTeX command \paragraph{}doesn’t start a paragraph but a subsubsubsection environment, I spent hours in debugging the spacings of my\paragraphs.So I redefined the command to just look like the \paragraphcommand but acting like a paragraph:\renewcommand{\paragraph}[1]{\par\noindent\textbf{\textsf{#1}}\hspace{\parindent}}Written at the beginning of a paragraph, this will insert a bold non-serif text in front of the indentation. 
- 
        Aug 1, 2014Steps to perform once- install npm
- 
    install grunt-clisudo npm install -g grunt-cliwhich gives you the opportunity to run Gruntfile.js-files by typing$ grunt. Gruntfiles are a bit like makefiles for c/c++, ants for java or rakefiles for ruby…
- 
    install grunt-initto automate project initializationsudo npm install -g grunt-init
- 
    install some grunt templates git clone https://github.com/gruntjs/grunt-init-commonjs.git ~/.grunt-init/commonjs --depth 1 git clone https://github.com/gruntjs/grunt-init-gruntfile.git ~/.grunt-init/gruntfile --depth 1Steps to perform for every new module
- create a project-folder e.g. by cloning the new projects repo from github.
Then cdin this folder.
- 
    create the gruntfile - choose one of the following: - simple gruntfile:
        grunt-init gruntfile
- commonjs:
        grunt-init commonjs
 
- simple gruntfile:
        
- 
    now let’s install all used grunt-modulesand add them topackage.jsonas development dependencies( --save-dev)npm install grunt --save-dev
 Now take a look at package.json,Gruntfile.jsandnode_modules/.package.jsonstores information about the packages to install withnpm installintonode_modules.Gruntfile.jsis read when typinggrunt.
- install 
- 
        Jul 31, 2014Assuming the myLib.pyis in/path/to/myLib/one can either- 
    PYTHONPATH=$PYTHONPATH:/path/to/myLibor
- 
    create a /lib/python/site-packages/myLib.pthcontaining:
 /path/to/myLib
- 
    
- 
        Jul 24, 2014Epic markdown editor in html5, parses markdown in realtime: dillinger.io 
- 
        Jul 21, 2014to disable: $ sudo setenforce 0to get state: $ getenforce
- 
        Jul 21, 2014chrome kioskmode with no same origin policy (e.g. allows loading files through xss from hdd) $ chrome -kiosk -allow-file-access-from-files www.google.deallow even more cross origin with: -disable-web-security
- 
        Jul 16, 2014yum searchsometimes is really slow. So one can use apps.fedoraproject.org/packages/ instead to quick search for packages in the standard repos.
subscribe via RSS