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
Some notes on computer stuff
In a nutshell: # ip link set eth0 down # echo mem > /sys/power/state # ip link set eth0 up RTNETLINK answers: No such device
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…
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…
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…
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.
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…
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.
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.
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…
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.
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…
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.
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.…
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…
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.
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 .
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 .
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…
The most important part Old URL: https://xaizek.github.io/ New URL: https://reversed.top/
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…
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.
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.
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…
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.
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…
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…
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.
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…
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.
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?…
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.
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…
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.
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 )…
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…
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.
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/’
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.
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.
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.
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.
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.
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.
Had an issue with setting up correct routing rule for VPN network through PPTP .
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.
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…
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.
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…
The issue explained Say directory structure is as follows: $ tree . |-- Makefile `-- lib.cpp 0 directories, 2 files
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