Next: Ubuntu Linux

Pages

Showing posts with label Ubuntu Linux. Show all posts
Showing posts with label Ubuntu Linux. Show all posts

Hot to change the mkv title

 Use the following command:

>mkvpropedit old_title.mkv --edit info --set "title=new_title"


Anydesk - Error: Display_Server_Not_Supported

 


Solution:

sudo gedit /etc/gdm3/custom.conf

and hen the file is open then uncomment the following lines:

WaylandEnable=false
AutomaticLoginEnable=true
AutomaticLogin=
<youruser>

in my case <youruser> is equal to max



Convert jpeg file to pdf




Step 1 - Installa the following package

    sudo apt install imagemagick

Step 2 - Use the following command:
    convert *.jpeg my_pdf.pdf 


The command above might yield an “operation not allowed” error. Fortunately, we
can easily fix it by executing:

sudo sed -i 's/^.*policy.*coder.*none.*PDF.\*//' /etc/ImageMagick-6/policy.xml

or better:

sudo gedit /etc/ImageMagick-6/policy.xml

add or change the row at end of the file (just before </policymap>) with the following:

<policy domain="coder" rights="read | write" pattern="PDF" />



Ho to remove metadata from a PDF

 sudo apt install mat2


mat2 filename.pdf  # you will now end up with a file called filename.cleaned.pdf

mat2 --inplace filename.pdf  # this will overwrite original file with the new one, effectively removing the original file

mat2 --show filename.pdf  # this will show the metadata that will be removed, if any (similar to dry run) 




Bash GUI for QPDF (using Python)


 

Step 1: Create a python program called mergePDF.py

import PySimpleGUIQt as sg
import sys
import os 

arg = sys.argv[1:] 

current_working_directory = os.getcwd() + "/undefined.pdf"
current_working_directory = "/home/max/Scrivania" + "/undefined.pdf"


class Listbox(sg.Listbox):

    def dragEnterEvent(self, e):
        e.accept()

    def dragMoveEvent(self, e):
        e.accept()

    def dropEvent(self, e):
        data = window['LISTBOX'].get_list_values()
        items = [str(v).replace("PySide2.QtCore.QUrl('file://", "").replace("')", "") for v in e.mimeData().urls()]
        for x in items:
          if (x[-4:].upper() != '.PDF'): items.remove(x)        
        data.extend(items)
        window['LISTBOX'].update(data)
        window.refresh()

    def enable_drop(self):
        self.Widget.setAcceptDrops(True)
        self.Widget.dragEnterEvent = self.dragEnterEvent
        self.Widget.dragMoveEvent = self.dragMoveEvent
        self.Widget.dropEvent = self.dropEvent
        
file_list_column = [
     [ 
        Listbox(arg, size=(50, 10), enable_events=True, key='LISTBOX', select_mode="single"), 
     ],
     [
        sg.Input(default_text=current_working_directory, key='FOLDER')
     ],       
]

image_button_move_column = [  
   [sg.Button("Up")],
   [sg.Button("Down")],
   [sg.Button("Delete")],  
]
       

image_button_action_column = [
   [
      sg.Button("Merge")
   ],
]

layout = [
   [
        sg.Column(file_list_column),
        sg.VSeperator(),
        sg.Column(image_button_move_column),
        sg.VSeperator(),
        sg.Column(image_button_action_column),
   ]
]   

window = sg.Window("pdfMerge V1.0", layout, finalize=True, resizable=False)
window['LISTBOX'].enable_drop()

def retreive_elem_selected(element):
    if element['LISTBOX']: 
       item = element['LISTBOX'][0]
    else: item = ""    
    return item      


def manage_up(item, mylist):
    if item:
       pos = mylist.index(item)
       newpos = pos-1
       if newpos>-1:
          mylist.insert(
             newpos,
             mylist.pop(pos)
            )  
    return mylist
       
def manage_down(item, mylist):
    if item:
       pos = mylist.index(item)
       newpos = pos+1
       mylist.insert(
             newpos,
             mylist.pop(pos)
            )  
    return mylist       
       

def manage_delete(item, mylist):
    if item:
       mylist.remove(item)
    return mylist 
    
def manage_merge(mylist,myfile):
    if myfile:
       str1 = " ".join(str("\""+x+"\"") for x in mylist) 
       os.system("qpdf --empty --pages "+ str1 + " -- " + myfile)  
    else: sg.popup('','The output field is empty') 
    
while True:

    event, values = window.read()
    
    item_selected = retreive_elem_selected(values)
    mylist = window['LISTBOX'].get_list_values()
    
    if event == sg.WINDOW_CLOSED:
       break
        
    if event == 'Merge':
       manage_merge(mylist,window['FOLDER'].get())    
       
    if event == 'Up':
       window['LISTBOX'].update(manage_up(item_selected,mylist))
       window['LISTBOX'].set_value(item_selected)
             
    if event == 'Down':
       window['LISTBOX'].update(manage_down(item_selected,mylist))
       window['LISTBOX'].set_value(item_selected)
       
    if event == 'Delete': 
       if item_selected:
          pos = mylist.index(item_selected)
          window['LISTBOX'].update(manage_delete(item_selected,mylist))
          mylist = window['LISTBOX'].get_list_values()
          if mylist:
             if pos < len(mylist): 
                window['LISTBOX'].set_value(mylist[pos])
             else: window['LISTBOX'].set_value(mylist[-1:])                    

   
    
window.close()
  
Step 2:  create a bash file mergePDF.sh to run the mergePDF.py

#!/bin/bash
python3 /home/max/batfile/Py/mergePDF.py "$@"
  
where /home/max/batfile/Py/ is the path where your python file is stored

Step 3:  create a link of mergePDF.sh file into scripts folder
    in my case into /home/max/.local/share/nautilus/scripts
  

How to extract mp3 from youtube





  • Install yt-dlp_linux

from https://github.com/yt-dlp/yt-dlp go su release and download linux yt-dlp_linux,
put all into a new folder ad assign the execution permission.


  • Download a specific video, i.e:

./yt-dlp_linux -x --audio-format mp3 https://www.youtube.com/watch?v=cen1SvpTsYk&ab_channel=BlackSabbath






Convert mp4 to mp3 under linux

 
#!/bin/bash
clear

# Example: ./mp4ToMp3.sh ~/Downloads

for entry in "$1"/*.mp4
do
  
  ext="${entry##*.}"
  filename="${entry:0:${#entry} - ${#ext}}"
  mp3file="${filename}mp3" 
  echo "$entry ===> $mp3file"
  ffmpeg -i "$entry" -vn -acodec libmp3lame -ac 2 -ab 160k -ar 48000 "$mp3file"
done

How to install HEVC/H.265 codec for Ubuntu



To install HEVC/H.265 codec you can use this procedure (it is has not worked for me):

sudo apt-add-repository ppa:strukturag/libde265
sudo apt-get update

If you want you can install directly the plug-in in this way:
sudo apt-get install gstreamer0.10-libde265
If you use GStreamer 1.0 , you can try:
sudo apt-get install gstreamer1.0-libde265
Or if you use VideoLan Client VLC (I have used it)
sudo apt-get install vlc-plugin-libde265

How to revive an old computer



A week ago an old man calls me asking me to fix your computer .

It was an old computer with only 512MB of RAM .

The computer was installed Windows XP but would stop every 30 minutes.

The old man tells me that the computer he needs to write some letters and to surf the Internet and listen to some music .

I had to find a solution without him spending money .

Solution Found

How to reset your password in Ubuntu



Do not ask me how it happened. But I lost my password .
Strange, but after a system upgrade my usual password did not work more.

Panic !!!

The solution is here....

(I thought it was safe linux)


Update Ubunu from 12.04 TLS to 14.04.1 TLS




Some week ago I have try to update the version of my Ubuntu Linux.


A tragedy !!!



Everything was fine, but at some point the upgrade is blocked......

W: Impossibile recuperare bzip2:/var/lib/apt/lists/partial/it.archive.ubuntu.com_ubuntu_dists_trusty-updates_main_source_Sources  Somma hash non corrispondente

I tried the following solutions

How to install AMD/ATI RV730XT (Radeon HD4670) on Ubuntu 12.04 TLS





After the last ever Updating the graphics card was no longer seen by Ubuntu here is how I solved the problem.

How to Add the Trash Icon to Your Ubuntu Desktop



The best way to add the Trash icon in your Ubuntu Desktop is the following:

To create a new file ~/Desktop/Trash.desktop.
The contents of the file are:

[Desktop Entry]
Comment=Contains removed files
EmptyIcon=trashcan_empty
Encoding=UTF-8
Icon=trashcan_full
Name=Trash
Name[en_US]=Trash
Type=Link
URL=trash:/

How to remove the Launcher (quicklaunch of GNOME) on Ubuntu 12.04

To remove the Launcher use the following buttons:

special button (Windows button) + ALT Sx button + right Mouse Button

and move the icon to trush.




How to install MFC-7360N Brother on Ubuntu 12.04 for Ethernet

Hi guys,

  yesterday I have bougth the Printer/Scan/Fax Brother MFC-7360N; a nice hardware.



These are the steps to configure the Printer on Ubuntu 12.04 (64 bit) for Ethernet..


Psensor on Ubuntu



Psensor is a power tool to check the temperature of your computer.

If you want install psensor in your Ubuntu OS then the steps are the following:

Open a terminal and run the following commands:

sudo apt-add-repository ppa:jfi/ppa
sudo apt-get update
sudo apt-get install psensor