Other articles


  1. Using python requests over Tor

    Fr 06 Februar 2015
    By Uli Köhler

    In Python

    We provide a simple example of how to use requesocks, a python request wrapper supporting SOCKS proxies for the specific usecase of using requests over Tor.

    read more
  2. Using lwIP SNTP client with ChibiOS

    Sa 01 November 2014
    By Uli Köhler

    In STM32

    We provide example code for using the lwIP contrib SNTP client with ChibiOS HAL RTCs and insights into the art of selecting the right RTC clock source on STM32.

    read more
  3. How to create msgpack DEB packages

    Problem: You want to create a binary DEB package of the msgpack C++ binding. However, there is no official DEB package available.

    Solution:

    Here’s a script that fully automates the process of building the deb package.

    Before building it, you need to install the DEB build toolchain and libgtest-dev ...

    read more
  4. How to check if Hugepages are enabled in Linux

    Do 01 August 2013
    By Uli Köhler

    In Linux

    Problem: On your Linux system, you want to check whether transparent hugepages are enabled on your system.

    Solution:

    It’s pretty simple:

    cat /sys/kernel/mm/transparent_hugepage/enabled
    

    You will get an output like this:

    always [madvise] never
    

    You’ll see a list of all possible options ( always, madvise, never ...

    read more
  5. How to create libsodium (NaCl) DEB packages

    Problem: You want to create a binary DEB package of libsodium. However, there is no official DEB package available.

    Solution:

    Here’s a script that fully automates the process of building the deb package.

    Before building it, you need to install the DEB build toolchain:

    sudo apt-get install devscripts debhelper ...
    read more
  6. User Mode Linux for Beginners - Part 1 - Setup and first VM

    Di 09 Juli 2013
    By Uli Köhler

    In UML

    Why another UML tutorial?

    This is not the first tutorial on UML — there are hundreds of them publicly available on the internet. However, none of them seems to fulfill my requirements:

    • All my computers and servers (= UML hosts) run on x86_64, not on i386.
    • Use an up-to date (self-compiled) UML ...
    read more
  7. grep tip: Only print matches

    Problem: You want grep to print only the match, not the entire line that contains the match

    Solution: Use the -o command line option

    If you use grep on a file list instead of stdin, you might want to add the command line option -h to suppress the filename the ...

    read more
  8. Building LevelDB Debian (.deb) packages

    Di 02 April 2013
    By Uli Köhler

    In LevelDB

    Problem: You intend to install LevelDB, but you don’t want to manually install & compile it as described here.

    Instead, you want to

    Reasons for preferring not to compile & install manually could be: * You want to deploy LevelDB to one ore more environments that doesn’t have a complete build ...

    read more
  9. Reading TAR files in C++

    Fr 29 März 2013
    By Uli Köhler

    In C/C++

    This article describes a method of  reading TAR archives (including .tar.gz and .tar.bz2) in C++ using Boost IOStreams.

    You could use libtar for this, but libtar hasn’t been updated since 2003 and doesn’t provide you flexibility and insight to the internal structure of a TAR archive ...

    read more
  10. git svn: Clone latest revision only

    Mo 11 Februar 2013
    By Uli Köhler

    In Git

    Problem: You want to use git-svn to clone a SVN repository, but you don’t want to clone the entire history (which can be quite slow) but only the latest revision.

    Solution:

    See this post for an explanation of how to get the latest SVN revision of a remote repository ...

    read more
  11. SVN: Find last revision number without cloning

    Problem: You want to find out what the last revision number of a remote subversion repository is.

    Solution:

    svn info provides what you need. Just combine it with grep and cut

    svn info http://llvm.org/svn/llvm-project/llvm/trunk | grep Revision | cut -d' ' -f2
    
    read more
  12. How to solve LT_INIT command not found on Linux

    Problem: You are running a configure script on Linux. It exits with a message like this:

    ./configure: line 3638: LT_INIT: command not found
    

    Solution:

    You’re missing GNU libtool. Install it using your distribution’s package manager, for example on Ubuntu use

    sudo apt-get install libtool
    

    LT_INIT in the error ...

    read more
  13. C++: Check if file exists

    Fr 11 Januar 2013
    By Uli Köhler

    In C/C++

    Problem: In C++ you want to check if a given file exists, but you can’t use stat() because your code needs to work cross-plaform.

    Solution: This solution is 100% portable (stat() isn’t, even if it it’s widely support), but note that it opens the file, so it ...

    read more
  14. Move Minimize, Maximize and Close to the right in Ubuntu

    Fr 11 Januar 2013
    By Uli Köhler

    In Linux

    In more recent Ubuntu Versions, the minimize, maximize and close icons are moved to the left.

    If you want them to show up on the right side instead, follow this guide: 1. Open a terminal (e.g. click on Ubuntu Dashboard and type Terminal, then click on Terminal) 2. Copy ...

    read more
  15. A working Gitlab configuration using Unicorn and Apache Proxy

    So 16 Dezember 2012
    By Uli Köhler

    In Git

    Problem: You want to setup gitlab using Apache and unicorn (no passenger!), but it doesn’t work, no matter how hard you try.

    Solution: You’re not alone with your problem. Even if there are numerous nice tutorials on the internet, none worked for me.

    My final setup includes a ...

    read more
  16. Compiling & Installing LevelDB on Linux

    Fr 14 Dezember 2012
    By Uli Köhler

    In LevelDB

    Update: Please also take a look at this followup article for an automatic compilation script that builds Ubuntu DEB packages!

    Problem: You want to compile and install LevelDB (including development headers) on your Linux computer. ./configure && make && make install does not work so you don’t know how to do ...

    read more
  17. Encoding a Video for HTML5 using ffmpeg

    Problem: You have a video file and want to encode it to support all three HTML5 codecs currently available (WebM, Theora and H.264) on the majority of devices.

    Solution: You can use ffmpeg for this task.

    On Linux, you can use the following bash script, assuming you have installed ...

    read more
  18. Shell: Strip extension and directory from path

    Problem: In the Linux shell, you have a path, e.g. ../images/photo.jpg and you want to strip the extension and the directory from it to get only photo.jpg

    Essentially this is a combination of two problems I featured before. To find out how to strip the directory ...

    read more
  19. Shell: Strip directory from path

    Problem: In the Linux shell, you have  a file path and you want to strip everything but the filename, for example  you have the path ../images/photo.jpg  and want only photo.jpg

    Solution: Assuming the filename is stored in the shell variable $filename, use this snippet:

    echo $filename | rev ...
    read more
  20. Othello in Java: Part 1: Data structures

    Fr 23 November 2012
    By Uli Köhler

    In Algorithms

    You’ve got a big problem. Someone forces encourages you to implement a complete Othello UI+AI in Java, but you don’t have any idea how to do that. If you already know how to implement the basics and you are interested in more advanced strategy concepts, you might ...

    read more
  21. Shell: Strip extension from filename

    Problem: You have a filename in the Linux shell and want to strip/remove the filename extension from it - e.g. if you have myarchive.zip, you want to get only myarchive as output.

    Solution: Let’s assume your original filename is saved in the bash variable $filename. Then you ...

    read more
  22. VNC: Scale VNC window

    Di 13 November 2012
    By Uli Köhler

    In Linux

    Problem: You want to view a VNC on a screen with a different resolution than the screen you’re viewing (e.g. you want to view your Full HD desktop display on your Notebook).

    Usually VNC viewers show scroll bars, but in some cases you need to view the entire ...

    read more
  23. R: Count occurrences of character in string

    Sa 10 November 2012
    By Uli Köhler

    In R

    Problem: In GNU R, you have an arbitrary string s and want to count how often a given character occurs in s.

    Solution:

    There might be a more efficient way, but substituting all occurrences in s by the empty string and counting the length difference works - the concept also works ...

    read more
  24. Check Scanner number input in Java

    Di 23 Oktober 2012
    By Uli Köhler

    In Java

    In many cases if you want to create an interactive command line interface, you need to check if a number entered by the user is valid and - if it isn’t - you want the user to re-input it.

    Here’s a simple static method to check if a number typed ...

    read more
  25. Automatically format size string in Node.js

    So 16 September 2012
    By Uli Köhler

    In Node.js

    Problem: In NodeJS, you got a size of something (a file?) in bytes, but you want to format it for better readability. For example if your size is 10000 bytes, you want to print “10 kilobytes”, but if it is 1200000, you want to print “1.20 megabytes”.

    Solution: Use ...

    read more