link from outside to a part of a file

pdf

It is possible to link a page of a pdf, with the following syntax:

file:///your-path-here/your-pdf-filename-here.pdf#pag=[the-page-number]

or, if the file is within your localhost folder

http://localhost/your-path-here/your-pdf-filename-here.pdf#pag=[the-page-number]

epub

It is possible to link to a given location of an epub file, i.g. with calibre viewer, with a code like the following

file:///your-path-here/your-epub-filename.epub?open_at=epubcfi(/10/2/4/2/132/18/1:65)

You can get the string after open_at (in the above case: epubcfi(/10/2/4/2/132/18/1:65) in the calibre viewer, this way:

  • right click
  • -> go to
  • -> location
  • -> current location (above in the window) : copy

video file

with VLC you can use this code

vlc file:///my-path/my-video.mp4 --start-time=90

where ’90’ are the seconds (after the start of video).

I didn’t manage, so far, to open a video with such a code from a browser.

audio file

You ca do it in several ways. With play (sox) in Linux you can use a code setting not only the start time, but the end one as well:

play '/your-path/your-file.ogg' trim 5:18 =7:01

where 5:18 is the start time, and 7:01 the end one (=7.01 and not = 7:01)

normalize audio volume

In Linux you can

1) change physically the volume, recodifying the files

such as

  • with ffmpeg-normalize, a tool for automatic changes
  • or with ffmpeg, for manual changes (i.g. ffmpeg -i input.mp3 -filter:a "loudnorm" -q:a 2 output.mp3 for a change with a re-encodig of high quality, or ffmpeg -i input.mp3 -filter:a "loudnorm" -b:a 192k output.mp3 to a bitrate of 192, and so on)

2) modifying only the way your file is read (by the audioplayers)

  • with normalize-audio, which don’t encode the files, but change only the volume metatag.
  • or with mp3gain  (mp3gain -r *.mp3, or mp3gain -r -k *.mp3, to avoid clipping problem)

This second way on the one hand is less invasive (and less destructive), but on the other hand the changes could be not correctly read by the audio player you use.

embed a playlist in a web page

After many attempts I finally figured taht it’s impossible embed an audio playlist (such as m3u) to a webpage: you can add only multiple (audio) files, but not a playlist.

I tried with the <audio> tag: nothing to to, even with jquery or javascript. Neither with <embed> or <object> html tags: html developers allow only a single audio playing, not a playlist.

The mimetype “audio/x-mpegurl” doesn’t work.

linux remove old kernels

Recently Ubuntu-based linux SO doesn’t remove automatically old kernels, with the command

sudo apt-get autoremove --purge

This because kernels, even automatically installed, are considered manually installed, and so they are not automatically removed.

To solve this, you should do beforehand this command

sudo apt-mark auto $(apt-mark showmanual | grep -E "^linux-([[:alpha:]]+-)+[[:digit:].]+-[^-]+(|-.+)$")

With this command you say that all kernels are automatically installed, and therefore the previuous command (sudo apt-get autoremove –purge) will work.

nvidia grafical card and linux kernel

It could happen that a new kernel doesn’t work with your nvidia (geforce) grafical card. The problem could de the linux-modules, such as linux-modules-nvidia-460-5.8.0-53-generic.

You can check it by the following command

dpkg --list | egrep -i --color 'linux-image|linux-headers|linux-modules' | awk '{ print $2 }'

To solve this, if you find that the last kernel does’t have a matchintg nvidia module, you have to install manually that module

sudo apt-get install linux-modules-nvidia-460-5.8.0-53-generic

import an xml into phpmyadmin

Given that WordPress doesn’t allow to import a local file (and this is quite unfair, in my opinion), you can transform a wp site into a xml file and then import it in your local database via phpmyadmin.

But you have to format carefully the xml: look how phpmyadmin export an xml file and format your xml according to that model.

regex replace html tags

In exporting a odt file to epub LibreOffice can make many mistakes, such as get a 2nd level title not with <h2>, but with <p class=”para0″>. To fix this error, you can use regex, in this way:

find: <p class="para0">(.*?)</p>
replace: <h2>\1</h2>

and so on for similar cases.