RSSAmplifier

Blog

reversed(top()) Posts

Some notes on computer stuff

reversed.topRSS feed ↗71 posts

Latest posts

Linux cannot up Ethernet after sleep

In a nutshell: # ip link set eth0 down # echo mem > /sys/power/state # ip link set eth0 up RTNETLINK answers: No such device

A couple of slackpkg+ tips

One tip is on an issue with https://slakfinder.org , another is about not upgrading some packages by default. They aren’t related to each other, but I’ve dealt with one and found a solution to the second one at about the same time. There is also an unrelated bonus section. The tips are related to slackpkg+ (the link likely won’t open), which is useful if you have multilib installed because it…

How to limit flag occurence count in CLI11

There exists a quite popular command-line parser for C++ called CLI11 . It’s not without issues (e.g., compilation time is quite bad), however its API is probably one of the most convenient out there (really weird that other similar libraries aren’t doing the same). I’m using it for a project and had a need for a flag that can be repeated but I wanted to limit number of times that it can be…

The fucking Firefox lag

Some time ago Firefox started to occasionally hang for maybe 20 seconds during which nothing was drawn on the window. Later I’ve noticed that it happened every time a context menu was about to be shown, same for some dialogs, all drop-downs and sometimes on opening of a new tab. I think it started after an update and naturally expected it to go away after another one. Sound also started to have…

Code review rules

Over the years I have contributed to various FOSS projects (both non-commercial and those owned by corporations) as well as proprietary ones. I’ve also played a role of a reviewer in all of those settings. Based on what I’ve seen and done I would like to propose some recommendations on how both sides can do better.

Benchmarking I/O ETA algorithms

Vifm can show some statistics about an ongoing file operation and recently it was suggested to add an ETA there as well. I have an issue with ETAs because of how wrong they often are, so the plan was to find out what’s the best way to implement one before proceeding. Unfortunately, I wasn’t able to find anything useful that could aid in making the decision. I found a lot of frustration about ETAs…

Using Sumneko Lua Language Server in Vim via vim-lsp

I finally decided to give LSP a try in my Vim for the purpose of getting completion in Lua. I kinda hate that decision by now, but there are some results to show and I want to document all the shit I had to deal with along with a working configuration.

Front panel headphone jack and PipeWire

After upgrading to Slackware 15.0 I kept using Bluetooth for headphones and only later found out that sound through wires didn’t work if plugged into front panel. While advices on the Web immediately jump to module settings I realized that on 14.2 everything worked with Alsa and PulseAudio, so usage of PipeWire might have contributed to the issue.

Repository-specific commands

Automating typical tasks in your repositories makes life easier by relieving you from running same commands over and over again. However, eventually using the automation itself can start taking more effort than you feel it deserves. At the same time some things are so simple you don’t even try to automate them properly or maybe you’re not sure they are useful enough to warrant generalization, so…

Don't trip over string optimizations

Optimizations are nice, but sometimes their effects can take you by surprise, especially if you’re not thinking about them while trying to debug an issue. If that’s the case, they can make your head hurt for a while. This post is about std::string class, but it’s far from being the only string class out there, so keep the outlined issues in mind while working with other implementations as well.

Prevent MPlayer from disabling display's powersave

MPlayer disables powersave for your screen when it has a video to play, which is what you want usually, but not always. In particular, the fact that powersave is disabled regardless of whether the video is running or being paused can be somewhat irritating if you’re watching something in multiple takes and just keep it paused in background for a long time to avoid writing down position at which…

How -f[un]signed-char can break your code

Most programmers are used to targeting x86 systems where char is signed char by default. It can lead to this assumption being baked into the code. Later, the code might break on a system where defaults differ, causing trouble. The first solution you might try to reach out for is -fsigned-char compiler’s switch, but there is a catch there which might or might not matter for a specific code base.

Why do new software tools look shiny?

It puzzles me when people get excited about some new tool which is just a rewrite of an old one. Usually it is written in a different language by its proponents and is more a testament to lack of fantasy rather than an indication of a need for one more copy of an old program. What’s more interesting though is an appeal these new implementations have for users which—I claim—are mostly superficial.…

Inventing grammar for GNU Make

For the purpose of making zograscope support parsing of more than just one language, there was a need to pick a language that is substantially different from C (the first one supported). GNU Make language certainly looked like an interesting option right from the start and it’s a tool that I use regularly. However, finding a grammar to implement it turned out to be a problem. Since grammar wasn’t…

More than 256 color pairs in curses

Those who used curses at least once to draw something in color had to notice that setting colors happens in pairs (foreground and background) and number of such pairs is limited. These limitations and some basics about upgrading code to lift one of the limits will be described in this short post.

New tool: pipedial (terminal element picker)

pipedial is one more tool for selecting something in console. Existence of many such tools might be a valid criticism against creating more, but not for those who think in terms of h / j / k / l .

Weboob as an alternative way of browsing WWW

Turns out there is a nice project that provides another way of accessing some parts of the Web that doesn’t require using a browser. It’s called Weboob .

Take off GitHub with RocketGit

Announcement of GitHub being acquired by Microsoft prompted many people to consider migrating away from it. Yet this isn’t really something new as one could hear similar thoughts expressed even before that ( see ) and I personally chose not to publish a fork of one popular project on GitHub months before the announcement. The sad truth is that there aren’t that many real alternatives there and…

New location of the blog

The most important part Old URL: https://xaizek.github.io/ New URL: https://reversed.top/

Propaganda in IT: Microsoft Buys GitHub: The Linux Foundation’s Reaction

It’s been over a week since MS declared that it buys GitHub, which generated a lot of discussions, but one of the most interesting pieces is a post from The Linux Foundation . It is quite short and at the same time seems to be constructed to sway people in a certain direction that can serve as a nice example on propaganda. Let’s take a look at how things are worded, what is omitted and how the…

Come to terms with computer terms

There are many things which people get wrong over and over again. People seem to care enough to repeat these mistakes out loud regularly, but apparently not enough to actually check correctness of the information or at least question it. Let’s deal with some claims of this sort from IT field which bug me personally.

How to make perf TUI work

perf is a quite handy tool to quickly measure performance of your application on GNU/Linux without recompiling it. The only issue seemed to be inconvenience of viewing report in a pager. It turned into concern after realising that it should start TUI on perf report by default, but for some reason it didn’t.

Updating mail receiving stack

Calling it a “stack” is probably too much, but fetchmail and procmail seem to go together and they are both subject for replacement for good reasons. After finally deciding to replace fetchmail and procmail with something newer, came realization that there aren’t that many choices out there and still quite a lot of people continue recommending fetchmail+procmail. This post is here to contribute to…

Conditional ignorance in C++

It just so happened that I watched several C++ talks that mention upcoming feature of C++17 called “If statement with initializer” all in a relatively short time frame. Unfortunately, there was another common trait among all of these presentations, which is the topic of this post.

The big list of Vim-like software

A more interactive version of this post is available at https://vim.reversed.top/ . Not updated since August 14, 2022; future updates only in the interactive version. There are a number of similar lists already, but they usually lack grouping and miss pointing out things that are of interest for the author of this one. So based on those lists and other sources here’s another one, which actually…

Skipping standard C++ library during debug session in gdb

UPDATE : if you have new gdb (7.12.1), scroll to the bottom. Ability to inline functions and methods in C++ is one of the reasons programs in C++ are so fast. As such code provided by libraries effectively becomes part of its client application and the great and mighty gdb knows what inline functions are, this might cause inconveniences during debugging. The problem is that while stepping into a…

ncurses wrappers for C++

curses is a well known set of libraries (with mostly common API) for creating TUIs . What is significantly less known though is that ncurses implementation comes with C++ wrappers for its C API.

Converting Vim documentation file to HTML

Vim has a great documentation for sure. Part of its greatness is documentation format itself. The only difficulty is that it can’t be easily converted to and from other formats, which might be sometimes desirable or at least useful to provide same documentation in different form. In particular, conversion into HTML is sometimes useful and although there is an HTML version of Vim documentation, the…

C++ manual pages

One of the great things about C is that its documentation is available locally via man command. That’s very convenient and one might expect to get the same for C++, but (say) man std::adjacent_difference will usually just print: No manual entry for std::adjacent_difference Luckily, there are ways to fix it.

Switching from tmux to GNU Screen

I was postponing learning how to use terminal multiplexers for a long time until one day had to test integration with tmux , which required learning it. So I was using tmux since then and always thinking whether I could do better by using GNU Screen instead. After all, most of GNU applications turn out to be quite versatile and extremely useful, so why GNU Screen wouldn’t have these properties?…

Enabling output colorization in GCC

I was waiting for GCC 4.9 for a while to get my hands on colorized color output, but after it became available in Slackware error output didn’t magically become colored. This might not be the case for other distributions, but since it took me some time to make this work and after more than six month I still can’t find any related posts on the Internet right away here’s a short note.

C++11+ aggregate initializer surprise

There is a nice thing in C++ called friend ship between classes or classes and functions, which is used to put several entities in one security domain by allowing “friends” to access private fields. This language feature is usually criticized as something that breaks encapsulation, which is not actually true as C++ is multi-paradigm language rather than being just OOP-language and such exceptions…

Range iterator for Boost.PropertyTree items

The other day I was looking for a way to obtain fully qualified names of items in Boost.PropertyTree in sorted order, but basically found only one post on the subject , which demonstrated recursive traversal of a tree in more detail than iteration over all keys. What I wanted is an iterator based solution, which could be employed in C++11 range-based for loop . So I ended up writing one.

Clang by example: Detecting wrong first include

TOC Detecting postfix operators in for loops Detecting unused functions Detecting wrong first include (you are here) Introduction There is a well known (or at least I hope that it’s well known) good practice to include header that corresponds to the current source file before including any other headers. It’s recommended by multiple C++ coding style guides (for example by Google C++ Style Guide )…

Why restoring signal handlers is important

I experienced strange failures of some commands in gvim (e.g. errors on closing window of :Gblame ) for quite a while, but couldn’t figure out why the hell their occur. Overall it probably took more than 20 hours to identify the issue and solve it not causing any other issues to arise. At the end of the day it took single line to solve the issue…

Fixing CIFS mounts in Slackware

I remember CIFS/SMB working fine for me, but it occasionally mysteriously didn’t work on some machines even with 100% correct configuration (e.g. line in /etc/fstab ). It actually happened not only on Slackware, but also on Debian, though not sure what was causing issues there.

How to install data directory with automake

I thought that adding directory to pkgdata_DATA variable in Makefile.am file would be enough, but make install command gave this error: /usr/bin/ginstall: omitting directory ‘../data/vim/’

How to make bootable win7 installation USB stick in GNU/Linux

For most bootable ISO images one of two approaches works: dd if=image.iso of=/dev/sdx if image is a hybrid CD-ROM/HD image. Extracting image via UNetbootin . However, none of this works for Windows setup disks, even if you do this on Windows. Usually I go with UltraISO ’s “Write hard drive image”, which works fine. But there is no UltraISO for GNU/Linux and one has to go another road.

Fix graphic errors after replacing NVIDIA card with Intel Graphics

After upgrading motherboard and its components, regular graphics (windows, video) worked fine with Intel HD Graphics, but trying to run something like glxgears displayed nothing but blank window. It was strange as Intel drivers are open source and known for their good work in GNU/Linux.

Decrease LILO kernel load time

Opened my LILO configuration file ( /etc/lilo.conf ) recently to take a look at video mode options and noticed this line: #compact # faster, but won't work on all systems.

Clang by example: Detecting unused functions

TOC Detecting postfix operators in for loops Detecting unused functions (you are here) Detecting wrong first include Introduction This memo provides description of a tool that scans a set of source files looking for two types of functions declared with external linkage: Those that are defined, but completely unused. Those that are used only inside same translation unit they are defined in.

csplit: splitting text files by separator line pattern

To split files by number of bytes or lines there is standard split command, but how to break file into pieces of variable size that are delimited by a separator? Search revealed csplit tool, hence this quick overview with a small example.

Prefer plain text format over HTML in mutt

Although this subject is covered in multiple sources, it’s hard to find it for some reason or at least it wasn’t that easy for me. That’s why I repeat it once again here and provide links to more verbose explanations.

How to add route for PPTP tunnel automatically

Had an issue with setting up correct routing rule for VPN network through PPTP .

rexima: couldn't open mixer device

After installing Slackware 14.1 on a new machine, I got unexpected output when tried to run rexima interactive mixer (by the way, it’s in extra section of Slackware packages, so search might silently skip it, just do slackpkg install rexima to install it). The output was: $ rexima rexima: couldn't open mixer device.

Removing sendmail from mail receiving chain

One of common ways to receive mail includes using sendmail as an MTA . This causes some inconvenience especially when it’s the only purpose sendmail is installed for. To be able to receive mail sendmail deamon must be running all the time, which also means that it consumes some (small) amount of resources. It’s not a problem at all (even though it slows down system startup a little bit), but why…

How to make tabs visible in git diff

I’m a bit tired looking at diffs like the following: for (int i = 0; i < 3; ++i) { - for (int h = 0; h < 4; ++h) { + for (int h = 0; h < 4; ++h) { for (int k = 0; k < 4; ++k) { Can anybody tell whether spaces were replaces with tabs or tabs were replaced with spaces without knowing anything else about the code? Probably, not.

Clang by example: Detecting postfix operators in for loops

TOC Detecting postfix operators in for loops (you are here) Detecting unused functions Detecting wrong first include Introduction Foreword The LLVM project has been started back in 2000, but became widely known and used quite recently, about 4 years as of now (2014). It’s used by hardware manufactures to implement programming languages for their products as well as by software engineering…

Fix constant rebuilding of static libraries by GNU make

The issue explained Say directory structure is as follows: $ tree . |-- Makefile `-- lib.cpp 0 directories, 2 files

How to profile python application packaged via py2exe

Simple profiling using standard cProfile module Usually a command similar to the one below is used to profile an application: python -m cProfile -o app.prof app.py arg1 arg2