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.

Links

[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: , , ,

Keyboard automation

June 10, 2023 Leave a comment

Problem

I had a text on the clipboard and I wanted to automate the Shift+Insert (paste) keypress. That is, I wanted to paste the content of the clipboard using a script.

Solution

I have a Bash script and when I run this script, this script at the end should paste the content of the clipboard.

First I came up with a Python solution using the excellent PyAutoGUI library:

python -c "import pyautogui; pyautogui.hotkey('shift', 'insert')"

It did the job but it required the pyautogui library to be installed. Then I found a solution that doesn’t need this dependency. This one relies on the Linux command xdotool:

xdotool key Shift+Insert

That’s it. Done :)

Speech-to-text conversion

March 12, 2023 Leave a comment

See https://github.com/openai/whisper

Example:

$ whisper speech.mp3 --model small

It also knows other languages. It can even translate a foreign audio to English.

Categories: Uncategorized Tags: , ,

Play a file in muted mode with mplayer

March 7, 2023 Leave a comment

Problem

With mplayer, I wanted to play an audio file in muted mode, i.e. without any sound (with volume=0). How to do that?

Solution

mplayer -volume 0 -softvol audio.mp3

If you don’t add “-softvol“, it’ll change your system volume too and it will persist after mplayer closes. Adding “-softvol” will mute the playback, but it won’t modify the system volume.

Categories: linux Tags: , ,

New Notebook for Mom

February 11, 2023 Leave a comment

Yesterday I bought a new notebook for my Mom. Here are my notes about it:

  • It’s an HP 250 G8 Notebook (27J97EA), 15.6″ FullHD, Intel Core i3-1005G1, 8GB RAM, 256GB SSD, Hungarian keyboard, no operating system, 3 years guarantee.
  • Its price was friendly, 358 USD.
  • I put Windows 10 on it (Enterprise, 22H2). The pendrive was prepared with Rufus. Settings: GPT / UEFI.
  • When you switch on the machine, keep pressing F10 to enter the BIOS. Here you can configure the boot order.
  • Upon reboot, keep pressing F9 to get the boot order menu. First, my USB stick was not in the list. After reformatting it in Rufus with GPT / UEFI, it appeared in the list and I could start installing Windows 10.
  • The machine is very good. It’s fast and it’ll be perfect for my Mom’s needs (e-mails, YouTube, Zoom, Skype).
  • I only had one issue but I could solve it. After installing all the updates, I still couldn’t change the brightness of the screen. The problem was that the appropriate video driver was missing. Start the Device Manager (Windows key + X, then select it). Here, open the video card. There I had something general. Righ click on it and select “update driver”. It did the trick! The Intel video driver got installed and I could change the brightness immediately.
  • On the keyboard, there are also two keys for changing the brightness. After the previous trick they also started to work.

All in all, I’m very satisfied with this notebook.

Categories: Uncategorized, windows 10 Tags: ,