Thursday, November 2, 2023

Activating newly added HDD in VMWare

Activating newly added HDD in VMWare

echo "- - -" > /sys/class/scsi_host/host0/scan

Friday, September 22, 2023

CursorAI Prompt: Python code for youtube downloader.

CursorAI Prompt:  Python code for youtube downloader.

Sure, you can use the pytube library in Python to download YouTube videos. Here's a simple example:

This code will download the first stream of the video (usually the highest quality) to the specified path.

Please replace 'https://www.youtube.com/watch?v=dQw4w9WgXcQ' with your desired YouTube video URL and '/path/to/download/directory' with the path where you want to download the video.

Remember to install the pytube library if you haven't already done so. You can install it using pip:

Please note that downloading YouTube videos may violate YouTube's terms of service, so use this responsibly.

Prompt for Python code for creating a webbrowser

CursorAI Prompt: Python code for creating a webbrowser

import tkinter as tk
from tkinter import messagebox
import webbrowser

def open_url():
url = entry.get()
webbrowser.open_new(url)

root = tk.Tk()
root.title("Web Browser")

label = tk.Label(root, text="Enter URL")
label.pack()

entry = tk.Entry(root)
entry.pack()

button = tk.Button(root, text="Go", command=open_url)
button.pack()

root.mainloop()


Roles and Responsibilities of a Data Analyst in 2023

CursorAI Prompt: # Roles and Responsibilities of a Data Analyst in 2023

1. **Data Collection and Processing**: A data analyst is responsible for collecting, processing, and performing statistical analyses of data.

2. **Data Cleaning**: They are responsible for finding and correcting errors, or 'cleaning' the data, to make it suitable for data analysis.

3. **Data Interpretation**: They interpret complex data sets to help companies make decisions. This involves presenting data in charts, graphs, tables, designing and creating data reports using statistical software.

4. **Predictive Analysis**: With the rise of machine learning and AI, data analysts are expected to use predictive models to interpret trends and patterns in data.

5. **Data Security**: Ensuring the integrity and security of data is a key responsibility. This includes setting up correct access permissions and also regularly backing up data to prevent data loss.

6. **Communication**: Data analysts are expected to communicate their findings, or translate the data into an understandable document. They will need to present their findings to both technical and non-technical team members.

7. **Staying Up-to-Date**: As the field of data analysis is constantly evolving, a data analyst in 2023 is expected to stay up-to-date with the latest industry trends and advancements in technology.

Cursor AI Prompt for DNS configuration

Cursor AI Prompt for DNS configuration
Prompt:  Share the DNS server configuration steps in Centos7.

  # Step 1: Install the bind package
 sudo yum install bind bind-utils -y

 # Step 2: Configure the main configuration file named.conf
 sudo vi /etc/named.conf

 # Step 3: Add DNS zones to the named.conf file
 # Replace 'yourdomain.com' with your actual domain
 zone "yourdomain.com" IN {
     type master;
     file "forward.yourdomain";
     allow-update { none; };
 };

 zone "0.0.10.in-addr.arpa" IN {
     type master;
     file "reverse.yourdomain";
     allow-update { none; };
 };

 # Step 4: Create forward and reverse zone files
 sudo vi /var/named/forward.yourdomain
 sudo vi /var/named/reverse.yourdomain

 # Step 5: Add DNS records to the zone files
 # In the forward zone file
 yourdomain.com.     IN    SOA     ns.yourdomain.com. root.yourdomain.com. (
                         2011071001  ;Serial
                         3600        ;Refresh
                         1800        ;Retry
                         604800      ;Expire
                         86400       ;Minimum TTL
 )

 # In the reverse zone file
 @     IN    SOA     ns.yourdomain.com. root.yourdomain.com. (
                         2011071001  ;Serial
                         3600        ;Refresh
                         1800        ;Retry
                         604800      ;Expire
                         86400       ;Minimum TTL
 )

 # Step 6: Check the configuration files for syntax errors
 sudo named-checkconf
 sudo named-checkzone yourdomain.com /var/named/forward.yourdomain
 sudo named-checkzone yourdomain.com /var/named/reverse.yourdomain

 # Step 7: Start and enable the named service
 sudo systemctl start named
 sudo systemctl enable named

 # Step 8: Open DNS service in the firewall
 sudo firewall-cmd --permanent --add-service=dns
 sudo firewall-cmd --reload

Wednesday, August 16, 2023

Brave Brower installation in Ubuntu 23.04

 To install Brave browser on Ubuntu 23.04, you can follow these steps:

1. Open the terminal.
2. Install the `curl` command line download tool by running the following command:
   
sudo apt install curl
   
3. Download and install the GPG key by running the following command:
   

sudo curl -fsSLo /usr/share/keyrings/brave-browser-archive-keyring.gpg https://brave-browser-apt-release.s3.brave.com/brave-browser-archive-keyring.gpg
   
4. Add the Brave apt source repository by running the following command:
   
echo "deb [signed-by=/usr/share/keyrings/brave-browser-archive-keyring.gpg arch=amd64] https://brave-browser-apt-release.s3.brave.com/ stable main" | sudo tee /etc/apt/sources.list.d/brave-browser-release.list
   
5. Update the package cache by running the following command:
   
sudo apt update
   
6. Install Brave browser by running the following command:
   
sudo apt install brave-browser
   
7. Once the installation is complete, you can launch Brave browser from the system menu.

Thursday, July 27, 2023

KVM installation in Ubuntu with these below commands

KVM installation in Ubuntu with these below commands

sudo apt install -y cpu-checker
sudo apt install -y qemu-kvm virt-manager libvirt-daemon-system virtinst libvirt-clients bridge-utils
apt install qemu-system

Wednesday, July 12, 2023

Ansible syntax check with Python Module

The below commands will help us to check the ansible format.

#pip install ansible-lint
#ansible-lint playbook.yml --force-color
 

#ansible-playbook playbook.yml --syntax-check

Fixation of older CentOS8 repos

Follow the below steps to fix the broken Centos8 repo setup - works good in CentOS8

sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*

Python overview

Using Python on your own

The best way to learn any programming language is to practice it on your own as much as you can. If you have Python installed on your computer, you can execute the interpreter by running the python3 command (or just python on Windows), and you can close it by typing exit() or Ctrl-D.

If you don’t already have Python installed on your machine, that’s alright. We’ll explain how to install it in an upcoming course.

In the meantime, you can still practice by using one of the many online Python interpreters or codepads available online. There’s not much difference between an interpreter and a codepad. An interpreter is more interactive than a codepad, but they both let you execute code and see the results.

Below, you’ll find links to some of the most popular online interpreters and codepads. Give them a go to find your favorite.

Additional Python resources

While this course will give you information about how Python works and how to write scripts in Python, you’ll likely want to find out more about specific parts of the language. Here are some great ways to help you find additional info: 

Python history and current status

Python was released almost 30 years ago and has a rich history. You can read more about it on the History of Python Wikipedia page or in the section on the history of the software from the official Python documentation.

Python has recently been called the fastest growing programming language. If you're interested in why this is and how it’s measured, you can find out more in these articles:

For loop

for i in range(10):

print(i)

Functions and Keywords

Functions and keywords are the building blocks of a language’s syntax.

Functions are pieces of code that perform a unit of work. In the examples we've seen so far, we've only encountered the print() function, which prints a message to the screen. We'll learn about a lot of other functions in later lessons but, if you're too curious to wait until then, you can discover all the functions available here.

Keywords are reserved words that are used to construct instructions. We briefly encountered for and in in our first Python example, and we'll use a bunch of other keywords as we go through the course. For reference, these are all the reserved keywords:

False

class

finally

is

return

None

continue

for

lambda

try

True

def

from

nonlocal

while

and

del

global

not

with

as

elif

if

or

yield

assert

else

import

pass


break

except

in

raise


You don't need to learn this list; we'll dive into each keyword as we encounter them. In the meantime, you can see examples of keyword usage here.

Arithmetic operators

Python can operate with numbers using the usual mathematical operators, and some special operators, too. These are all of them (we'll explore the last two in later videos).

  • a + b = Adds a and b

  • a - b = Subtracts b from a

  • a * b = Multiplies a and b

  • a / b = Divides a by b

  • a ** b = Elevates a to the power of b. For non integer values of b, this becomes a root (i.e. a**(1/2) is the square root of a)

  • a // b = The integer part of the integer division of a by b

  • a % b = The remainder part of the integer division of a by b

def greeting(name):

print("welcome, " + name)





# 1) Complete the function to return the result of the conversion

def convert_distance(miles):

    km = miles * 1.6  # approximately 1.6 km in 1 mile

    return km

my_trip_miles = 55


# 2) Convert my_trip_miles to kilometers by calling the function above

my_trip_km = convert_distance(my_trip_miles)


# 3) Fill in the blank to print the result of the conversion

print("The distance in kilometers is " + str(my_trip_km))


# 4) Calculate the round-trip in kilometers by doubling the result,

#    and fill in the blank to print the result

print("The round-trip in kilometers is " + str(round(my_trip_km)))



----

def lucky_number(name):

  number = len(name) * 9

  result = "Hello " + name + ". Your lucky number is " + str(number)

  return result

      

print(lucky_number("Kay"))

print(lucky_number("Cameron"))



-----

# This function compares two numbers and returns them

# in increasing order.

def order_numbers(number1, number2):

    if number2 > number1:

        return number1, number2

    else:

        return number2, number1


# 1) Fill in the blanks so the print statement displays the result

#    of the function call

bigger, smaller = order_numbers(10099)

print(smaller, bigger)

Thursday, April 20, 2023

Ubuntu 18.04 Older Notes.

uget
sudo apt-add-repository ppa:plushuang-tw/uget-stable
sudo apt-get update
sudo apt-get install uget aria2

vlc
$ sudo add-apt-repository ppa:videolan/master-daily

deb http://ppa.launchpad.net/videolan/master-daily/ubuntu focal main
$ sudo apt update
$ sudo apt install vlc qtwayland5
$ sudo apt install libavcodec-extra

sudo add-apt-repository ppa:umang/indicator-stickynotes
sudo apt-get update
sudo apt-get install indicator-stickynotes


Download it from here: https://sourceforge.net/projects/pinguy-os/files/ISO_Builder/pinguybuilder_18.4-1_all-alpha.deb/download

Once downloaded ‘CD’ to the folder where it is and run:

sudo dpkg -i pinguybuilder_18.4-1_all-alpha.deb
sudo apt-get install -f

add-apt-repository ppa:ubuntuhandbook1/audacity
apt update && sudo apt install audacity

git clone http://github.com/lwfinger/rtlwifi_new.git -b extended
cd rtlwifi
make
sudo make install
reboot

apt-get install ultracopier

sudo systemctl hibernate

This did not work for me. I try pm-hibernate which did not work for me either until I added missing package uswsusp

sudo apt install uswsusp  

install libelf-dev, libelf-devel or elfutils-libelf-devel"

apt install openshot

Things has to be done after installing Linux Lite 5.6

Remove Thunderbird
apt remove thunderbird

Remove libreoffice
sudo apt-get remove --purge libreoffice*
sudo apt-get clean
sudo apt-get autoremove

Go to folder  /home/<yourusername>/.local/share/applications and delete files Libreoffice-calc, Libreoffice-writer & Libreoffice-impress
Again go to the folder  /etc/skel/.local/share/applications and delete files Libreoffice-calc, Libreoffice-writer & Libreoffice-impress

Install Deluge / Transmission
apt install deluge
apt install transmission

Install testdisk for file recovery software
apt install testdisk

#Balena-etcher download for usb-flashing (startup disk)
apt install usb-creator-gtk

Install playonlinux for MS office etc
apt install playonlinux and install MS office 2016 - 32 bit
search the opt pacakge from virtualbox.com for ubuntu and install it for VMs.

Install pip3
apt install python3-pip

Install audacity - an audio editor
apt install audacity

Install openshot - a video editor
apt install openshot

#install cubic
apt install cubic

#Remastersys (optional)
apt-get install remaster-iso

Install Xtreme Download Manager
https://itsfoss.com/xtreme-download-manager-install/

Install Libreoffice
Download the latest Libre office and extract go to DEBS directory and run the below command
dpkg -i *.deb

Install neofetch
apt install neofetch

Install mouse server
dpkg -i mouseserver

Remove orphan packages
sudo apt-get install deborphan
deborphan
orphaner

wget https://go.skype.com/skypeforlinux-64.deb
apt install ./skypeforlinux-64.deb

pdfsam for pdf manipulations

Install brave browser
sudo apt install apt-transport-https curl
sudo curl -fsSLo /usr/share/keyrings/brave-browser-archive-keyring.gpg https://brave-browser-apt-release.s3.brave.com/brave-browser-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/brave-browser-archive-keyring.gpg arch=amd64] https://brave-browser-apt-release.s3.brave.com/ stable main"|sudo tee /etc/apt/sources.list.d/brave-browser-release.list
sudo apt update
sudo apt install brave-browser

screen recorder
apt install simplescreenrecorder

Software Ubuntu Budgie 22.04.2 LTS

Remove Thunderbird
apt remove thunderbird

Remove libreoffice
sudo apt-get remove --purge libreoffice*
sudo apt-get clean
sudo apt-get autoremove

Libreoffice latest
Download latest package from Libreoffice, extract the deb packages
https://www.libreoffice.org/download/download-libreoffice/
dpkg -i *.deb

xdm Downloader setup
https://xtremedownloadmanager.com/#downloads

vlc player - install inside the snap
snap install vlc

Download the atom deb package from the portal
dpkg -i atom*.deb
apt install -f

Deluge Torrent
apt install deluge

playonlinux wine frontend Software
apt install playonlinux - Remove this from budgie, if it fails.
2013 Office installation test - Did not support office 2016 yet

Virtualbox
Download latest from
https://www.virtualbox.org/wiki/Linux_Downloads
apt install virtualbox
apt install -f

Audio editor
apt install audacity

Install testdisk for file recovery software
apt install testdisk

Install openshot video editor
add-apt-repository ppa:openshot.developers/ppa
apt update
apt install openshot-qt python3-openshot

Install pip3
apt install python3-pip

Remove orphan packages
sudo apt-get install deborphan
deborphan

Install neofetch
apt install neofetch

Install mouse server
dpkg -i mouseserver

screen recorder with voice
apt install obs-studio

pdf manipulations
https://download.qoppa.com/pdfstudio/PDFStudio_linux64.sh
chmod +x PDFStudio_linux64.sh
./PDFStudio_linux64.sh
PDF Sam
https://github.com/torakiki/pdfsam/releases/download/v5.0.3/pdfsam-5.0.3-linux.tar.gz

Necessary steps after installing Ubuntu 20.04 LTS

Ubuntu 20.04 LTS soft
 

1.#apt install transmission # Transmission
2.https://subhra74.github.io/xdm/#downloads # Xtreme downloader
3.#apt install ultracopier  #Ultracopier
4.#apt install gnome-tweak-tool  #Gnome tweaks
5.#apt install gnome-chess  #Gnome-chess

6.PlayonLinux
apt install wine64
apt install winetricks
apt install playonlinux

WINEPREFIX=~/.wine/office2013 WINEARCH=win32 winecfg
cd /home/pna/.wine/
WINEPREFIX=~/.wine/office2013 WINEARCH=win32 winetricks
WINEPREFIX=~/.wine/office2013 WINEARCH=win32 winetricks msxml6
WINEPREFIX=~/.wine/office2013 WINEARCH=win32 wine filename.exe


7.KVM Refer https://linuxconfig.org/install-and-set-up-kvm-on-ubuntu-20-04-focal-fossa-linux
#apt install qemu-kvm libvirt-clients libvirt-daemon-system bridge-utils virt-manager
#ip a  #note down the LAN interface
#vim /etc/network/interfaces
auto br0

iface enp0s3 inet manual

iface br0 inet dhcp
    bridge_ports enp0s3
:wq - save the file

#adduser pna libvirt
#adduser pna libvirt-qemu

8.#apt install audacity - Audacity
9.#apt install vim - vim

10.Tor browser
#apt install torbrowser-launcher
#torbrowser-launcher

11.Libre office (Download the latest package and run dpkg -i *.deb)

12.VLC Refer: https://linuxconfig.org/ubuntu-20-04-vlc-installation
sudo apt install vlc
sudo apt install vlc-plugin-access-extra libbluray-bdj libdvdcss2
vlc

13.Google Chrome
sudo apt install gdebi-core wget
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo gdebi google-chrome-stable_current_amd64.deb
google-chrome

14.#apt install terminator - Terminator
15.mouse server  # remote from phone
16.#apt install pinta # Image editor
17.#apt install kdenlive # Kdenlive - Videoeditor
18.#apt-get install lmms # Musicsoftware
19.#apt install testdisk #Testdisk
20.#apt-get install ansible -y
21.#apt install usb-creator-gtk  #Ubuntu startup disk
22.#apt install devede #Devede writer
23.#apt install brasero #brasero

24. Works only vob format
apt install pv
pv *.VOB > output.vob

25.#apt install blender  #Blender-3d editor
26.#apt install gimp  #Gimp Image Editor

27.#apt-get install ffmpeg
ffmpeg -f concat -safe 0 -i mylist.txt -c copy output.mp4

28.#apt install pulseaudio-equalizer
apt install pavucontrol

29.#apt install soundconverter
30.Putty configuration / Termius from Ubuntu Software

31.#apt install docker.io
systemctl enable --now docker
usermod -aG docker pna
docker --version

32.sudo apt install chrome-gnome-shell

33.Cubic installation for remastersys ubuntu
sudo add-apt-repository ppa:cubic-wizard/release
sudo apt update
sudo apt install cubic

apt install syslinux-utils
isohybrid /path/to/custom_iso.iso

34.apt-get install plank #dock for ubuntu

35.apt install squashfs-tools
http://www.linux-live.org/ - Download
#cd /tmp
#build

8.Virtualbox / 9.VMware15 pro - CU7J2-4KG8J-489TY-X6XGX-MAUX2

11.Openshot Videoeditor
sudo add-apt-repository ppa:openshot.developers/ppa
sudo apt update
sudo apt install openshot-qt

15.screen recorder - Ctrl+Alt+Shift+R to start or stop recording.
screenshot
sudo apt-add-repository ppa:sylvain-pineau/kazam
sudo apt update
sudo apt install kazam
sudo apt upgrade

Enable hibernate
 pm-hibernate

    $ sudo -i
    $ cd /var/lib/polkit-1/localauthority/50-local.d/
    $ gedit com.ubuntu.enable-hibernate.pkla

    [Re-enable hibernate by default in upower]
    Identity=unix-user:*
    Action=org.freedesktop.upower.hibernate
    ResultActive=yes
    [Re-enable hibernate by default in logind]
    Identity=unix-user:*
    Action=org.freedesktop.login1.hibernate
    ResultActive=yes

26.wget -O nero-64bit.deb http://drive.noobslab.com/data/apps/nero/nerolinux-4.0.0.0b-x86_64.deb
dpkg -i nerolinux
nero linux: 9M1K-0098-P3HL-PK6P-T6UA-1E5X-E557-8X41

30. zip -re output_file.zip file1 folder1
31. rm /var/lib/dpkg/lock-frontend

32. apt install cockpit
33. apt install nodejs
34. apt install screenfetch
35. apt install winbind cabextract (msxml6)
36. apt-get -y install python3-pip

Tuesday, April 4, 2023

How to Fix Error: Failed to Download Metadata for Repo ‘AppStream’ in CentOS 8.x

In CentOS8, you might have got the below error while updating the packages via yum/dnf.

"How to Fix Error: Failed to Download Metadata for Repo ‘AppStream’ in CentOS 8.x"

The below is the Cause of This Error:

You may well be aware that CentOS Linux 8 died a premature death, it reached the End Of Life (EOL) on December 31st, 2021, thus it no longer receives development resources from the official CentOS project.

This means that after Dec 31st, 2021, to update your CentOS installation, you are required to change the mirrors to CentOS Vault Mirror, where they will be archived permanently.

Here is the fix:

Type the below commands one by one fix the above error. It works good.

#sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
#sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
#dnf update

This is referred from https://www.tecmint.com/error-failed-to-download-metadata-for-repo-appstream/