Bourne Again SHell

SOCKS proxy using ssh (with i3 integration)

From time to time, thanks to geoblocking or IP address based authorization, you need to access websites through a proxy. If you have access to a machine that would have the right address range or region, an easy and straightforward way is to use ssh: $ ssh -N -D 8180 <desired_machine> & i3 integration If you need this proxy more frequently and you want to have the status of the proxy connection displayed in your i3-status line (from the window manager i3wm), then you can integrate the proxy with the following scripts:

Posted

#CaffeeLog #Linux

Bourne Again SHell

Search files with grep

In a programmers live, you need a recursive file search nearly every day. Of course, this is possible without a heavy IDE and with a simple but useful bash one liner: $ grep "pattern" -HniR ./path/to/dir The options in detail: H printing the filename of the match n print also the line number i for a case *in*sensitive search R for recursive Of course, this can also be combined with grep regular expressions.

Posted

#CaffeeLog #Linux

Vivaldi Browser

Get H.264/MP4 codecs to work in Vivaldi Browser

I’m a happy user of the Vivaldi Browser. But every time after an upgrade, H.264 videos stop working and every time I search and try quite a while to get it working again…maybe because the solution is always to obvious. So, now I write it down in the hope of remembering it next time ;). 1) The easy (to obvious) option Execute vivaldi in a comand line! The output is something like:

Posted

#CaffeeLog #Linux

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

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