A Linux command-line utility to discover and list WSD-enabled computers and printers on a home network

, 08/07/2020 | Source: Fitzcarraldo's Blog

In an earlier post I covered the installation and use of wsdd, a WS-Discovery (WSD) daemon that can run on Linux machines and enable machines running Microsoft Windows 10 to discover Linux machines in File Explorer now that Windows 10 has dropped Computer Browser, NetBIOS and SMBv1. All my Linux machines in my home network […]

Reconfiguring the time zone, locales and keymaps in Sabayon Linux

, 02/07/2020 | Source: Fitzcarraldo's Blog

This is an example of how to reconfigure the time zone, locales and keymaps in a Sabayon Linux installation from the command line. Sabayon Linux uses systemd, therefore much of this example should also be applicable in other Linux distributions that use systemd, and will certainly be applicable in Gentoo Linux installations that use systemd […]

How to copy text to the clipboard in Neovim

If you want to copy text to the clipboard in Neovim you can do so with xclip. The command is a bit complicated so I highly recommend you binding it to a shortcut.

This is what I have in my Neovim configuration to let me copy marked text using Ctrl+C:

vmap <C-c> y:call system("xclip -i -selection clipboard", getreg("\""))<CR>:call system("xclip -i", getreg("\""))<CR> 

Just make sure to install the tool xclip if you don’t already have it.

How to automatically change the current working directory in Neovim

Something that has been overly annoying ever since I switched over to Neovim from Vim is the fact that my working directory has alway been my home folder, no matter what file I’m editing.

I first though it was an issue with the plugin Ranger.vim and I didn’t do anything about it. I exclusively use that plugin to navigate my filesystem and open files in Neovim using Ranger (and previously in Vim) and I can’t live without it.

It wasn’t until I recently that I noticed that I had the same issue when using the built in command :edit that I did some research about it and found out about the feature autochdir:

'autochdir' 'acd'       boolean (default off)
        When on, Vim will change the current working directory whenever you
        open a file, switch buffers, delete a buffer or open/close a window.
        It will change to the directory containing the file which was opened
        or selected.

When enabled it means that when I’m working on a file in the folder $HOME/example/ and then open a new buffer and spawn Ranger inside Neovim (or just using :edit) I end up in the folder $HOME/example and no in my home folder $HOME/.

Source: https://vim.fandom.com/wiki/Set_working_directory_to_the_current_file.

Keep track of your uptime with uptimed

If you’re curious about your uptime statistics there’s a tool called uptimed that can help you keep track of your uptime records.

$ uprecords 
     #               Uptime | System                                     Boot up
->   1    29 days, 04:57:14 | Linux 5.4.38-gentoo-x86_  Tue May 26 15:23:46 2020
NewRec    29 days, 04:57:13 | since                     Tue May 26 15:23:46 2020
    up    29 days, 04:57:14 | since                     Tue May 26 15:23:46 2020
  down     0 days, 00:00:00 | since                     Tue May 26 15:23:46 2020
   %up              100.000 | since                     Tue May 26 15:23:46 2020



Install the package app-misc/uptimed:

# emerge --ask app-misc/uptimed

After the installation you need to start the service:

# service uptimed start

And preferable add it to the default system runlevel:

# rc-update add uptimed default


Install the package uptimed:

# apt install uptimed

After the installation you need to start the service:

# systemctl start uptimed

And preferable add it to the default system runlevel:

# systemctl enable uptimed

Using uptimed

After the installation you can simply run the command uprecords to display your uptime records. I also recommend you checking out the flag --help for more options.

Quick work-around for bug in KDE Plasma 5.19.1 (Restart and Shut Down from system menu result in Log Out instead)

, 23/06/2020 | Source: Fitzcarraldo's Blog

See the recent post on 17 June 2020 by reddit and Arch Linux user SnowGigs re KDE Plasma 5.19.1: Cannot shutdown or restart from system menu. Actually I experience the same problem with Plasma 5.19.0 in Gentoo Linux. Until you can install a newer version of Plasma which fixes the bug, here is a quick […]

How to use Reddit via web feeds

It is actually possible to use Reddit exclusively via web feeds, unless you want to submit or comment anything. They do not advertice it, but the support is actually pretty good.

Web feeds happens to be my prefered way of consuming Reddit these days. Reddit is for the most part a a higly toxic place and I try to stay away from it, but it does comes with a lot of good things that I like.

June 23, 2020 - Thanks to @dredmorbius@toot.cat on the fediverse for recommending me a few more feeds that I did not know about.

The default web feeds

Let us start with all the standard web feeds.

Adding dates to any feed

If you want to you can even add dates to any feeds, here is an example showing the monthly top feed:

Other possible dates are hour, day, week, year and all.

Subreddit web feeds

If you would like to follow a subreddit you can do so as well. Here is an example with the subreddit r/Gentoo:

You can even combine several subreddits in one feed like this:

User web feeds

It is also possible to follow users. Here is an example with the fictive user “reddit_user”:

If you want to you can only follow either the users submitted posts and the comments of any user:

Single posts web feeds

Yep. This is a thing as well:

Single comment web feeds

It is also possible to follow a single comment:

Using WS-Discovery to enable Windows 10 to browse SMB shares in my home network of Linux computers

, 16/06/2020 | Source: Fitzcarraldo's Blog

I have not used Windows 10 for more than two years now (see ‘Bye bye Windows 10, and good riddance‘ regarding my failed attempts to upgrade Windows 10 Version 1607 to 1703 and 1709). Nevertheless I am aware that, since Version 1709, Windows 10 no longer has SMBv1 and Computer Browser service installed by default. […]

Kotlin multiline strings vs the $ character

Dirk Olmes
, 11/06/2020 | Source: Infoschnipsel und Wissenswertes

I recently started to use Kotlin for small projects at work. At first I was very pleased with the language but the more I use it the more I’m stubling over things that are not nice.

I’ll rumble about the braindead constructor syntax or the epic autoboxing fail with numbers some other time. Today I’ll get into multiline string templates and the use of the $ character.

Kotlin, much like Groovy supports multiline strings. It also allows the use of $-epxressions in the string. Things start to become difficult if you need a literal dollar sign in the string.

Embedding literal dollar signs in Groovy multiline strings is easy:

name = "Dirk"
template = """Hello $name, 
    I owe you \$100 
    but I don't owe you the \$world"""

Just escape the dollar sign with \ and you’re good to go.

Not so in Kotlin! Using a dollar sign that’s escaped with backticks will fail compilation with “unresolved reference”. The documentation talks about the “valid solution” for using dollar signs:

fun main() {
    val name = "Dirk"
    val template = """Hello $name, 
        I owe you $100 
        but I don't owe you the ${'$'}world"""

Note how you don’t have to escape the dollar sign in front of the number and the awkward escaping syntax.

I’m not alone with this complaint as the discussion on the ticket shows. IMHO it’s not a good sign that boasts itself for “making developers happier” when little attention to this kind of details is shown. The ticket has been open for 8 years now …

How to make search highlights visible in Neovim when using URxvt

I don’t know why, but if you use the terminal emulator URxvt, the colour scheme Solarized and Neovim (or Vim) at the same time and then search for something, jump to the highlighted word, the cursor will then blend in a bit too much.

Here’s an example when I have searched for the number 3 and jumped to that search hit:

You can’t probably see it, but the colours are different! The colour on the normal text is #839496 while the highlighted text is #93a1a1. I was able to fix this and here’s how it looks for me right now:

This is the setting that fixes it:

hi search ctermfg=8 ctermbg=3 cterm=none

Adding that setting to my configuration for Neovim didn’t work though, for some reason my colour scheme changes it back, a workaround for me was to use an auto command for it:

autocmd colorscheme solarized highlight search ctermfg=8 ctermbg=3 cterm=none

A big thanks to “marcohinzgitter[” and “habamax” on the irc-channel #neovim at freenode.net for the helping me solving this long standing issue!