[VS Code] remove trailing whitespaces upon save

March 19, 2024 Leave a comment

Problem

You use VS Code. When you save a file, you want to remove trailing whitespaces automatically. In addition, you also want to see the trailing whitespaces, for instance in red.

Solution

For this purpose, I’ve used the extension Trailing Spaces by Shardul Mahadik for years. However, it stopped working correctly, so I looked after an alternative solution.

It turned out that VS Code can indeed remove trailing whitespaces (this feature was missing some years ago). However, it cannot visualize the trailing whitespaces, thus you still need an extension for that. The extension Trailing Whitespace by jkiviluoto can do that.

Thus, follow these steps:

  1. Install Trailing Whitespace by jkiviluoto (extension ID: jkiviluoto.tws)
  2. Add these lines to your settings.json :
  "files.trimTrailingWhitespace": true,
  "tws.highlightTrailingWhiteSpace": true,
  "tws.trimOnSave": false,

We’ll use tws just for highlighting the trailing whitespaces in red. The removal will be done by VS Code, using its built-in ability.

Categories: vs code Tags: , ,

Goodbye Vuze, hello qBittorrent

February 13, 2024 Leave a comment

I was a long-time Vuze user but yesterday I switched to qBittorrent.

I realized yesterday that Vuze is no longer maintained. The final release was in 2017, 6 years ago… Vuze worked well for me but it started very slowly (Java?).

My cousin has been suggesting qBittorrent for a long time, so yesterday I decided to switch. It’s a fast (implemented in C++) and highly configurable, modern bittorrent client. I could easily migrate all my torrents in the new system. qBittorrent starts quickly and seems to work well. It’s open source and available on every major platform (Linux, Windows, macOS).

Categories: Uncategorized Tags: , , ,

visualping.io

February 7, 2024 Leave a comment

Problem

There’s a website that you visit daily to check if there is something new. For instance, you are waiting for a new release of your favorite software and you want to try the new version as soon as possible. But what if there are several sites that you want to monitor regularly?

Solution

There’s a service for this: https://visualping.io/ . You register one or more websites and it checks for changes. If there’s a change, you get an email notification.

They have a personal plan, thus you can try it for free.

Links

Categories: Uncategorized Tags: , , , ,

Set a file or folder to be ignored by Dropbox

February 6, 2024 Leave a comment

Problem

You have a file/folder in your Dropbox folder that you want to keep there (on your local machine), but you don’t want to upload it to the cloud. That is, you want the Dropbox client to ignore it.

A typical use case: you have a Python project that you want to put in a virtual environment. If you create the venv/ directory in the project folder, it’s uploaded to the cloud. However, the venv/ folder can be huge and it’s reproducible. What to do if you don’t want to sync it?

Solution

The Dropbox GUI client must have an option for this but I hate those GUI interfaces. How to do it in the command line?

Well, it can be done. I found the solution here: https://help.dropbox.com/sync/ignored-files

Ignore a file/folder [set ignore]:

$ attr -s com.dropbox.ignored -V 1 'target'

Where 'target' is the file/folder you want to ignore.

Undo the ignoring (i.e., sync it again) [remove ignore]:

$ attr -r com.dropbox.ignored 'target'

For this, you need to install the attr package that makes it possible to handle extended attributes.

Links

How to open two files side by side?

November 30, 2023 Leave a comment

Problem

From the command-line, you want to open two files side by side.

Solution

With vim:

$ vim -O file1 file2

With micro:

$ micro -multiopen vsplit file1 file2

For micro, I got help here.

Categories: terminal Tags: , , ,

vlc: start a video at a specific time

August 23, 2023 1 comment

Problem

Using VLC, I wanted to start a video at a specific time from the command line.

Solution

Use this:

vlc --start-time=20 video.mp4

It will start the video at the 20th second. As can be seen, the time must be specified in seconds. If you have the time in hh:mm:ss format, you’ll have to transform it to seconds.

Here is a little Python snippet that will do the transformation. Let’s say we want to jump to position 09:04:41 .

>>> hour, minute, sec = 9, 4, 41    # it'll be a tuple
>>> sec + minute * 60 + hour * 3600
32681
>>>

Categories: Uncategorized Tags: , , ,

check a Linux file system

August 1, 2023 Leave a comment

Problem

My internal HDD behaved strangely. It made a noise of powering down, then a few seconds later it powered up again. Altogether, it was repeated 3 times within 10 seconds.

After investigating the content of the drive, I noticed that some files were damaged. What to do?

Solution

The partition on this drive had ext4 file system. Before checking it, it had to be unmounted. With gparted I figured out the location of the partition (it was /dev/sdb1). I restarted the machine and booted a Linux from USB. Then I managed to correct the partition with these commands:

# e2fsck /dev/sdb1
# e2fsck -p /dev/sdb1

If you add the -p switch, it’ll try to repair automatically. However, if it cannot repair everything by itself, you’ll have to run the first command where the program will ask you interactively what to do (repair or not).

After a reboot, as I noticed, all my files were restored except one. The content of this one has become some garbage. I changed the SATA cable of this drive (who knows?), and since then this problem hasn’t returned.

Categories: linux Tags: , , , , , ,

bypass paywalls

June 21, 2023 Leave a comment

Problem

You visit a website (e.g. Medium.com) and you can’t read the whole article since it’s behind a paywall. But, of course, you don’t want to pay. What to do?

Solution

Use this browser extension: https://github.com/iamadamdev/bypass-paywalls-chrome . Installation instructions are in the README. I tried it with Edge and it worked.

Update (20240212)

This extension stopped working for me :( Another way is to sign up to Medium.com with a temporary email address. This way you can read some articles for free. The service https://www.emailondeck.com/ worked for me.

Links

Categories: Uncategorized Tags: , , , , , ,

[manjaro] my screen got accidentally zoomed in

June 17, 2023 Leave a comment

Problem

I have Manjaro with Xfce and suddenly my screen got zoomed in a bit. How to revert this change?

Solution

It seems that I accidentally used Alt+Mouse_Wheel_Up without noticing it. Just use Alt+Mouse_Wheel_Down to zoom out.

Categories: manjaro Tags: , , ,

[manjaro] Firefox starts slowly

June 15, 2023 Leave a comment

Problem

After a system update, Firefox starts very slowly. Previously, there was no problem with it.

Solution

According to this forum post, there is a bug with xdg-desktop-portal-gnome. Workaround solution:

sudo pacman -Rdd xdg-desktop-portal-gnome
sudo pacman -S xdg-desktop-portal-gtk

I have Xfce environment and it solved the issue.

Categories: manjaro Tags: , , ,