Downloading Videos As Audio Using YT-DLP

As you will more than likely be wanting the best quality audio the format (-f) selector will be for best audio (ba).

yt-dlp -f ‘ba’ -o ‘%(id)s.%(ext)s’

To save as the video title change %(id)s.%(ext)s to '%(title)s.%(ext)s' to save. For a custom filename songname.%(ext)s.

With YouTubes VP9 codec this file will most likely be .webm or .opus extension.

Saving video as an MP3 file

To save the highest quality audio as an mp3 file you need to define --audio-format mp3 with -x which is extract audio

$ yt-dlp -f 'ba' -x --audio-format mp3  -o '%(id)s.%(ext)s'


Less On Linux ::: Navigating With Less Command

Use these keys to move and search through the text file.

  • Move forward one line: Down Arrow, Enter, e, or j
  • Move backward one line: Up Arrow, y, or k
  • Move forward one page: Space bar or Page Down
  • Move backward one page: Page Up or b
  • Scroll to the right: Right Arrow
  • Scroll to the left: Left Arrow
  • Jump to the top of the file: Home or g
  • Jump to the end of the file: End or G
  • Jump to a specific line: Type the line number  and then hit “g”
  • Jump to a percentage way through the file: Type the percentage and then hit “p” or “%.” (You can even enter decimal values, so to jump to the point 27.2 percent through the file, type “27.2” and then hit “p” or “%.”  Why would you want to use decimals? I honestly have no idea.)
  • Search forward: Hit “/” and type your search, like “/Jekyll”, and press Enter
  • Search backward: Hit “?” and type your search, like “/Hyde”, and press Enter
  • Next matching search item: n
  • Previous matching search item: N
  • Quit: q

Using Scrcpy On Linux With Wireless

$ adb kill-server
$ adb tcpip 5555
$ adb connect {phone IP address}:5555
$ adb devices

After adb devices, make sure the phone shows up twice, once for the USB connection and once for the WiFi connection, which will list your IP address. If the connections are not showing, then adb is not connecting – your phone may be blocking it. If you have the WiFi connection showing, unplug the phone from the USB and enter the following:

$ scrcpy


Cutting, Copying, Pasting From Vim To Clipboard And Back

1 Cut, Copy and Paste using the computer keyboard

Everybody knows how to use the keyboard combinations Ctrl-c, Ctrl-x, and Ctrl-v in Windows and Linux (or Cmd-c, Cmd-x and Cmd-v in macOS) to copy, cut and paste text across applications.

Many think that those combinations are universal and work with any application.

But Vim and gVim are different, they use another system to exchange information with the rest of the IT world.

For example, in Vim under Linux, the key combination Ctrl-v corresponds to the visual block function and does not affect the pasting text.

I wrote this article to remind me, as a non-programmer, the key combinations to be used in the Vim world to share text with other applications.

2 Vim and the clipboard

Vim uses an original resource to exchange text with other applications.

If you press the Vim (or gVim) :reg command, you can notice a list of items beginning with a double quotation mark (“) and followed by a symbol, a letter or a number: these are the registers.

Vim uses a specific register to interact with the system clipboard and, consequently, with other applications.

This specific clipboard register is identified with the mathematical plus symbol (+) 1

3 From Vim to the Clipboard

If you need to transfer information from Vim to other environments you must use the key combination ​"+y to copy the text and ​"+x to cut it from the original document.

Pay attention to the following table:

KeyWhat is?
The registers symbol
+The clipboard register symbol
xThe letter to cut the text
yThe letter to copy the text

Then you have to press three keys in sequence:

  1. ​”​
  2. +
  3. x or y

In both cases, the cut or copied text is sent also to the clipboard and can be pasted outside Vim using the usual Ctrl-v command, in Windows and Linux, or Cmd-v in macOS.

4 From the Clipboard to Vim

The reverse operation is also quite simple. You can transfer your text copied from the clipboard using the string ​"+gP.

Let’s analyze every single component of the string:

P” means paste before the current position.

The “g” key puts the cursor after the pasted text.

Then “gP” command produces the following result: Paste before the current position, placing the cursor after the pasted text.

If you don’t use g the cursor will be placed on the last letter of the pasted text and you’ll waste time to advance the cursor by one character.

In Vim philosophy everything must be optimized, also the single movements of the cursor!

5 Some key shortcuts in gVim

In some cases, it is also possible to use key shortcuts in gVim.

They mainly work in MS Windows but some of the work also in several Linux distributions. I can directly confirm the working in Mint, Fedora, Ubuntu, Antergos for the pasting shortcut (see list below) but not the same for the others.

The following is the list of shortcuts:

ShortcutWhat happens?
Shift+DeleteCut text and copy it in the clipboard
Ctrl+InsertCopy text in the clipboard
Shift+InsertPaste text from the clipboard into a document

Thank You for Your attention.



There’s also another symbol for the clipboard: the asterisk (*): it produces almost the same results of the plus symbol but in GNU/Linux OS it saves information specifically for the middle mouse button.


Showing Current Date, Day, Or Time In WordPress

WordPress does not come with a default widget or block to display current date or time.

However, you can still display current date or time using some very simple code.

You can add this simple code in your WordPress theme’s template files where you want to display the time.

1<?php echodate(get_option('date_format')); ?>

This code simply prints the current date using the date format set in your WordPress settings. You can change the date format by visiting the Settings » General page.

You can also use your own formatting tags to output the date in any other format. For instance, using the following code you can print the date in month, day, and year format.

1<?php echodate('F j, Y'); ?>

This method allows you to directly add the code into WordPress theme files, but it is not very flexible. What if you wanted to display current date and time inside a WordPress post, page, or a sidebar widget?

This next method allows you to add date and time anywhere on your site.


Reusable Cursor Hover Function In JavaScript

function hover(element, enter, leave){
  element.addEventListener('mouseenter', enter)
  element.addEventListener('mouseleave', leave)

You can then pass your element and callback functions like so.

hover(document.querySelector('h1'), e => {
  // On hover"logo__container--hover")
}, e => {
  // On exit hover"logo__container--hover")

You can reduce the lines of code too by modifying the hover function.

function hover(element, className){
  element.addEventListener('mouseenter', e => element.classList.add(className))
  element.addEventListener('mouseleave', e => element.classList.remove(className))

Then use it like so.

hover(document.querySelector('h1'), "logo__container--hover")

You can reuse this now for multiple elements scalably.


Getting Theme URL In WordPress

If You wish to retrieve a template’s directory URI for the active theme, use


Using get_template_directory_uri() to link a static image with its correct path in html :

1<img src="<?php echo get_template_directory_uri(); ?>/images/logo.png"width=""height=""alt=""/>


Adding An Event Listener To Multiple Elements With JavaScript

Using a loop

The loop is the simplest one conceptually.

You can call querySelectorAll() on all elements with a specific class, then use forEach() to iterate on them:

document.querySelectorAll('.some-class').forEach(item => {
  item.addEventListener('click', event => {
    //handle click

If you don’t have a common class for your elements you can build an array on the fly:

[document.querySelector('.a-class'), document.querySelector('.another-class')].forEach(item => {
  item.addEventListener('click', event => {
    //handle click

Using event bubbling

Another option is to rely on event bubbling and attach the event listener on the body element.

The event is always managed by the most specific element, so you can immediately check if that’s one of the elements that should handle the event:

const element1 = document.querySelector('.a-class')
const element2 = document.querySelector('.another-class')

body.addEventListener('click', event => {
  if ( !== element1 && !== element2) {
  //handle click