Bourne Again SHell

Add headers recursive on top of each code file

In various situations during the work on a project, it could happen that one is required to add a header to a lot of source code files. Since programmers are usually lazy — eh, interested to work efficiently — they won’t open every file and copy it manually. Once again, the Bash can help us. For example, a copyright notice in all C/C++ files: find . -name \*.{c,cpp,h,hpp} | xargs sed -i "1i/*Copyright .

Posted

#CaffeeLog #Linux

Vim

Spell checking in Vim

Mark Twain has been quoted as saying that he respected a person who could spell a word more than one way. Unfortunately, Twain’s enthusiasm for creative spelling isn’t widely shared today, at least in the professional world. (1) You know Vim already from a lot of features, including Macros, Reg Ex, or code formatting. Now, let’s add spell checking: Support for spell checking was added in Vim 7 and therefore it is really easy to activate:

Posted

#CaffeeLog #Vim

New year, new blog!

Finally, I found the time and motivation to update my blog 0xCAFFEE.de. Since the initial setup of this blog in Joomla in 2015, I found a lot of lightweight but useful frameworks for websites and blogs and I slowly reconsidered my opinion over how to setup a good webpage. In the past, I preferred Joomla over Wordpress, because I liked powerful and feature-rich engine and I found for every idea I had for my webpage a suitable plug-in or component.

Posted

#CaffeeLog

Sorry, we're stuck in the slow lane

Jeder soll das Internet überall und frei von Diskriminierung nutzen können

Endnutzer haben das Recht, über ihren Internetzugangsdienst, unabhängig vom Standort des Endnutzers oder des Anbieters und unabhängig von Standort, Ursprung oder Bestimmungsort der Informationen, Inhalte, Anwendungen oder Dienste, Informationen und Inhalte abzurufen und zu verbreiten, Anwendungen und Dienste zu nutzen und bereitzustellen und Endgeräte ihrer Wahl zu nutzen. ([1] Seite 26, Artikel 3, Absatz 1) Als ich diesen Satz gelesen habe (und ihn nach einigen Sekunden des Nachdenkens auch verstanden habe), habe ich erst einmal nicht geglaubt, dass dieser aus der viel-geschimpften und verteufelten Verordnung des EU-Parlamentes vom 27.

Posted

#internet politics #Discussions

LG G4

How to get marshmallow on the LG G4 AND encrypt the device AND root it WITHOUT a factory reset

So, since a few days I’ve a new toy….a LG G4! And, of course, I wanted to get the newest marshmallow android on it, as soon as possible. And - also of course - I wanted to encrypt the /data-partition (called device encryption) and wanted still to become root (I’ve been used to fully control a device - and I wouldn’t change this in android 6.0). So, here is the story I’ve got root on a encrypted LG G4 with marshmallow and WITHOUT a factory reset needed:

Posted

#How To

FFMPEG: convert flac to mp3 and copy id3tags

And again something to ffmpeg: this very sophisticated tool can not only convert video or audio files. It also can handle the associated metadata. So, when you have a big music-library in the lossless format .flac (or .wav) and want to have it also on mobile devices you probably convert the files to mp3 or similar. Also, I do so, because when I’m travelling around I’ve mostly not the silence and equipment to hear music in best quality, so a little loss of quality through the use of mp3 would not be noticed.

Posted

#CaffeeLog #Linux

FFMPEG using the H264 codec

I’ve often the “problem”, that I want to show a movie while traveling, but the mpg-file on my PC is a few GB big and the disk-space on my mobile Devices are limited. So, I want to convert my mpg-files to mp4 files, with less or no loss of quality, but a huge reduce of bytes. And every time I’m searching around the web to find the correct ffmpeg-options. In order not to search the next time I need it, I write it down:

Posted

#CaffeeLog #Linux

Tux, the Linux-Penguin

Recursive search in files on Linux

Sometimes I’m searching for a specific function in the many files and directories of a project. Of course, I could use heavy, often crashing and expensive IDEs to do this but there is one simple and fast method using the “boring” command line and the “ugly” tool grep: (Maybe I should note, that the “” in this case may mean some irony) grep -E -lir --include=*.{c,cpp,h,hpp} "void test()" The options:

Posted

#CaffeeLog #Linux

Courser highlighting and code formating in Vim

Every Programmer knows some of these very annoying situations: you have to edit someones code and he likes it to use really long lines you write in a language, which is sensitive to Indenting (e.g. Phyton, YAML) you have to read/edit someones code and he doesn’t now what Code Style means… So, to boils it down to one Point: You have trouble to because of bad code formating…

Posted

#CaffeeLog #Vim