Pages

Wednesday, November 20, 2024

Fedora 41 : generated shapes with python !

Today I created this source code in python that generates eight random convex polygons. The idea was to create sprites for a 2D game: snowballs, boulders, or similar objects ... Obviously I also used Sonet 3.5 artificial intelligence. You can find the source code on the pagure account in fedora.
#!/usr/bin/env python3
"""
SVG Polygon Generator

This script generates multiple deformed polygonal shapes and saves them as separate SVG files.
Each polygon maintains convex properties while having controlled random deformations.

Features:
    - Generates 8 unique polygonal shapes
    - Controls deformation through radial and angular factors
    - Maintains convex properties
    - Exports each shape to a separate SVG file
    - Uses random colors for visual distinction

Usage:
    python generate_svgs.py

Output:
    Creates 8 SVG files named 'polygon_1.svg' through 'polygon_8.svg'
"""

from lxml import etree
import random
import math
from pathlib import Path


def create_svg_root():
    """Create and return a base SVG root element with standard attributes."""
    root = etree.Element("svg")
    root.set("width", "500")
    root.set("height", "500")
    root.set("xmlns", "http://www.w3.org/2000/svg")
    return root


def calculate_points(center_x: float, center_y: float, radius: float, 
                    num_sides: int, deform_factor: float) -> list:
    """
    Calculate polygon points with controlled deformation.

    Args:
        center_x: X coordinate of polygon center
        center_y: Y coordinate of polygon center
        radius: Base radius of the polygon
        num_sides: Number of polygon sides
        deform_factor: Maximum allowed deformation factor

    Returns:
        List of tuples containing (x, y) coordinates
    """
    points = []
    angle_step = 2 * math.pi / num_sides
    
    for i in range(num_sides):
        angle = i * angle_step
        radial_deform = random.uniform(-deform_factor, deform_factor)
        angular_deform = random.uniform(-deform_factor/2, deform_factor/2)
        
        modified_angle = angle + angular_deform
        modified_radius = radius * (1 + radial_deform)
        
        x = center_x + modified_radius * math.cos(modified_angle)
        y = center_y + modified_radius * math.sin(modified_angle)
        points.append((x, y))
    
    return points


def generate_deformed_shapes():
    """Generate multiple deformed polygons and save them to separate SVG files."""
    # Base parameters
    num_sides = 8
    center_x = 250
    center_y = 250
    base_radius = 150
    max_deformation = 0.15
    output_dir = Path("generated_polygons")
    
    # Create output directory if it doesn't exist
    output_dir.mkdir(exist_ok=True)

    for i in range(8):
        root = create_svg_root()
        points = calculate_points(center_x, center_y, base_radius, 
                                num_sides, max_deformation)
        
        path = etree.SubElement(root, "path")
        path_data = f"M {points[0][0]} {points[0][1]}"
        path_data += "".join(f" L {p[0]} {p[1]}" for p in points[1:])
        path_data += " Z"
        
        path.set("d", path_data)
        path.set("fill", "none")
        path.set("stroke", f"#{random.randint(0, 16777215):06X}")
        path.set("stroke-width", "2")
        path.set("opacity", "0.7")

        # Save individual SVG file
        output_file = output_dir / f"polygon_{i+1}.svg"
        tree = etree.ElementTree(root)
        tree.write(str(output_file), pretty_print=True, 
                  xml_declaration=True, encoding='utf-8')
    
    print(f"Generated {num_sides} polygons in {output_dir}")

if __name__ == "__main__":
    generate_deformed_shapes()

Saturday, November 16, 2024

Fedora 41 : Bookworm - open-source eBook reader !

Bookworm is an open-source eBook reader with an easy and simple layout supporting different file formats like epub, pdf, mobi, cbr and cbz. See the official webpage.
root@localhost:/home/mythcat# dnf5 search bookworm
Updating and loading repositories:
Repositories loaded.
Matched fields: name (exact)
 bookworm.x86_64: Simple, focused eBook reader
root@localhost:/home/mythcat# dnf5 install bookworm.x86_64
Updating and loading repositories:
Repositories loaded.
Package                 Arch   Version                      Repository      Size
Installing:
 bookworm               x86_64 1.1.3-0.13.20200414git.c7c36 fedora       3.6 MiB
Installing dependencies:
 granite                x86_64 6.2.0-9.fc41                 fedora     949.2 KiB
 javascriptcoregtk4.0   x86_64 2.46.3-1.fc41                updates     28.3 MiB
 webkit2gtk4.0          x86_64 2.46.3-1.fc41                updates     75.4 MiB

Transaction Summary:
 Installing:         4 packages
...
[6/6] Installing bookworm-0:1.1.3-0.13. 100% | 430.8 KiB/s |   3.7 MiB |  00m09s
Complete!ng trigger-install scriptlet: hicolor-icon-theme-0:0.17-19.fc41.noarch
The last step, search this on gnome environmet and you will find this application.

Wednesday, November 13, 2024

Fedora 41 : use pagure tool with ssh key ...

Pagure is a light-weight git-centered forge based on pygit2.
The basic tool can be found on this fedora package, the pagure has more features.
Because I used only like a repo I install with DNF5 tool the basic cli:
# dnf5 install pagure-cli.x86_64
I created a folder then I used easy like git tool for each project I have under basic fedora account:
mythcat@localhost:~/pagure_fedora$ git clone https://pagure.io/mythcat
Cloning into 'mythcat'...
remote: Enumerating objects: 1567, done.
remote: Counting objects: 100% (1567/1567), done.
remote: Compressing objects: 100% (1467/1467), done.
remote: Total 1567 (delta 76), reused 1496 (delta 63), pack-reused 0
Receiving objects: 100% (1567/1567), 5.82 MiB | 2.26 MiB/s, done.
Resolving deltas: 100% (76/76), done.
mythcat@localhost:~/pagure_fedora$ git clone https://pagure.io/radio-online-catafest
Cloning into 'radio-online-catafest'...
remote: Enumerating objects: 8, done.
remote: Counting objects: 100% (8/8), done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 8 (delta 1), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (8/8), 6.01 KiB | 267.00 KiB/s, done.
These are git repos for folders: mythcat and radio-online-catafest, any git command can be run on these folders.
mythcat@localhost:~/pagure_fedora$ cd mythcat 
mythcat@localhost:~/pagure_fedora/mythcat$ nano test.txt
mythcat@localhost:~/pagure_fedora/mythcat$ git status
On branch main
Your branch is up to date with 'origin/main'.

Untracked files:
  (use "git add <file> ..." to include in what will be committed)
	test.txt

nothing added to commit but untracked files present (use "git add" to track)
mythcat@localhost:~/pagure_fedora/mythcat$ git add .
mythcat@localhost:~/pagure_fedora/mythcat$ git commit -am "test with a file"
[main 2c9fa14] test with a file
 Committer: Catalin George Festila <mythcat localhost.localdomain="">
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly. Run the
following command and follow the instructions in your editor to edit
your configuration file:

    git config --global --edit

After doing this, you may fix the identity used for this commit with:

    git commit --amend --reset-author

 1 file changed, 1 insertion(+)
 create mode 100644 test.txt
 mythcat@localhost:~/pagure_fedora/mythcat$  git config --global --edit
mythcat@localhost:~/pagure_fedora/mythcat$ git commit --amend --reset-author
[main 308a2c9] test with a file
 1 file changed, 1 insertion(+)
 create mode 100644 test.txt
mythcat@localhost:~/pagure_fedora/mythcat$ git remote set-url origin git@pagure.io:mythcat.git
mythcat@localhost:~/pagure_fedora/mythcat$ git remote -v
origin	git@pagure.io:mythcat.git (fetch)
origin	git@pagure.io:mythcat.git (push)
You need to use ssh-keygen to have a ssh key for pagure on Fedora linux then remove the old key and, add the ssh key to Fedora pagure account, then I push the file:
mythcat@localhost:~/pagure_fedora/mythcat$ ssh-add ~/.ssh/mypagure
mythcat@localhost:~/pagure_fedora/mythcat$ ssh-keygen -y -f ~/.ssh/mypagure
mythcat@localhost:~/pagure_fedora/mythcat$ systemctl restart sshd.service mythcat@localhost:~/pagure_fedora/mythcat$ git push 
For my repo radio-online-catafest the git remote command is this:
mythcat@localhost:~/pagure_fedora/radio-online-catafest$ git remote set-url origin git@pagure.io:radio-online-catafest.git
mythcat@localhost:~/pagure_fedora/radio-online-catafest$ git push 
Everything up-to-date

Saturday, November 9, 2024

Fedora 41 : timeshift tool for backup.

... one old tool for backup was rsync ...
Now you have a tool named timeshift with this tool named timeshift and more features ...
You can install with:
root@localhost:/home/mythcat# dnf5 install timeshift.x86_64
I run this tool with :
mythcat@localhost:~$ sudo timeshift-gtk 
The result is this G.U.I. ...
... because the backup is not easy, I search on web and I found a video tutorial from the official youtube channel - DrewHowdenTech
...

Fedora 41 : Minimal gnome install and nemo additionals packages.

I reinstall the Fedora, somehow was crashed with a bad systemd error:
uname -a
Linux localhost.localdomain 6.11.5-300.fc41.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Oct 22 20:11:15 UTC 2024 x86_64 GNU/Linux
If you install nemo with minimal gnome features then you need to install fedora packages, like this one:
root@localhost:/home/mythcat# dnf5 install nemo-image-converter

Sunday, October 27, 2024

Fedora 42 : Can be better? part 020.

I wrote in some posts about this blog about the possibility of improving the distribution of Linux Fedora.
Today I discovered that choosing GNOME is a better option with lighting modes and options for the Nemo file manager actions.
I would have wanted to have a better network system similar to portmanager with S.P.N. for fedora users and team on web.
SPN (Secure Peer Name) is a technology related to secure communication protocols, particularly in the context of peer-to-peer networks and distributed systems.
I want to have more tools and applications on tty with GUI, like ncurses... I created an radio online application with ncurses and you can find it on my pagure.
The main goal of these type of graphic user interface is simplicity, no need hardware resources - this HP Compaq 6710b has only 4Gb RAM, and cand be used with Single Board Computer.
I think Fedora don't have a Fedora Spin for Single Board Computer hardware.
Let's start with python 3 action on nemo file manager.
Go to the action folder and create an action file named: python3.nemo_action.
[root@fedora mythcat]# cd /usr/share/nemo/actions
[root@fedora actions]# nano python3.nemo_action
Add this source code :
[Nemo Action]
Name=Execute Python Script
Icon-Name=python
Exec=env /usr/bin/python3 %F
Selection=S
Name[tr]=Python script         
Extensions=py;
Reopen the Nemo file manager and you see an an Execute Python Script, only on the python script on right click menu.
Let's see some screenshots:

Saturday, October 26, 2024

Fedora 42 : ... testing Advanced Intrusion Detection Environment (AIDE).

Advanced Intrusion Detection Environment (AIDE) is a utility that creates a database of files on the system, and then uses that database to ensure file integrity and detect system intrusions.. See more on the official fedora documentation webpage.
NOTE : The documentation and translations on the official page are in progress due to ongoing development and resource management ...
I used the DNF tool to install:
[mythcat@fedora ~]$ sudo dnf install aide
... aide      x86_64      0.18.6-5.fc41        rawhide      
Make sure the AIDE database file exists and is accessible:
[mythcat@fedora ~]$ sudo ls -l /var/lib/aide/aide.db.gz
Ensure that the user running AIDE has the necessary permissions:
[mythcat@fedora ~]$ sudo ls -l /var/lib/aide/
Check the AIDE configuration file:
[mythcat@fedora ~]$ sudo cat /etc/aide.conf | grep DBDIR
Check if the AIDE service file exists:
[mythcat@fedora ~]$ sudo ls /usr/lib/systemd/system/ | grep aide
If the service exists then check the status:
[mythcat@fedora ~]$ sudo systemctl status aide
Unit aide.service could not be found.
If the service not exist then take some time to run first time ...
[mythcat@fedora ~]$ sudo /sbin/aide --init
...
End timestamp: 2024-10-26 14:10:00 +0300 (run time: 98m 41s)
You can check each time you want ...
[mythcat@fedora ~]$ sudo /sbin/aide --check
If you want and your Fedora linux need to use this tool, then you can use it like service:
sudo nano /usr/lib/systemd/system/aide.service
Fill with the basic service source code like any unit service :
[Unit]
   Description=Advanced Intrusion Detection Environment
   After=network.target

   [Service]
   Type=simple
   ExecStart=/sbin/aide --init
   ExecStop=/sbin/aide --check
   Restart=on-failure

   [Install]
   WantedBy=multi-user.target
This is a simple tutorial about how to start with AIDE tool ...

Saturday, October 19, 2024

Fedora 42 : Still in the development without some features ...

An intrusion on my vodafone network , change my layout on windows.
Even the network provider say always is not from hardware or administration vodafone network ...
I tried to wrote a post on my graphics blogger on windows os , but I got something like this:
... ld ne frm 3 cmbire 224 ...
My nicknames comes like this: mhca caafe for mythcat and catafest ...
The tab and enter keys not works, also 1234 789 and num keys ... and more keys: s, t, w, y, o.
This post is wrote on Fedora 42 and works fine , but will be more good if this distro will have all features.
Some examples :
- Selinux still works but some enforced can change the default user permissions and privileges.
- Selinux works but you can use full features like : mls.
- the TPM device from this HP Laptop cannot be used with all features on Fedora.
In conclusion, this old laptop with Fedora and GNOME environment is more than 10 times faster human operations on the range of time, than the Asus laptop with the same 4GB RAM but with a different CPU Intel(R) Core(TM) i3-60060 @ 2.00 GHz 1.99 GHz and windows 10 pro.

Thursday, October 17, 2024

Fedora 42 : Testing isoimagewriter.

Today I tested the isoimagewriter tool on Fedora 42 and works well:
[mythcat@fedora ~]$ sudo fdisk -l /dev/sdb
Disk /dev/sdb: 984 MiB, 1031798784 bytes, 2015232 sectors
Disk model: USB FLASH DRIVE 
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000
[mythcat@fedora ~]$ isoimagewriter 
[mythcat@fedora ~]$ sudo file -s /dev/sdb
/dev/sdb: ISO 9660 CD-ROM filesystem data 'CorePure64' (bootable)
[mythcat@fedora ~]$ sudo qemu-system-x86_64 -cdrom /dev/sdb 
I used an linux iso image from CorePure64

Wednesday, October 16, 2024

Fedora 42 : Using dosbox to run old games in Fedora Linux distro.

You can run DOS games with the DOSBOX emulator ...
This can be install with DNF5 tool:
[root@fedora mythcat]# dnf5 install dosbox-staging.x86_64
Updating and loading repositories:
Repositories loaded.
Package                 Arch   Version                 Repository           Size
Installing:
 dosbox-staging         x86_64 0.81.2-3.fc42           updates-testing  14.6 MiB
The next step is to run the game ...
[mythcat@fedora ~]$ ls /usr/share/dunelegacy/
 ATRE.PAK                  DUNE.PAK       locale         SETUPENG.DIP
 CREDITS.ENG               ENGLISH.PAK    maps           Setup.EXE
 Dune2.BAT                 FINALE.PAK     MENTAT.PAK     SOUND.PAK
 Dune2.EXE                 GFXHD.PAK      MERC.PAK       VOC.PAK
 Dune2.ICO                 HARK.PAK       OneTime.DAT    Waveset.DAT
 Dune2-Versions.txt        HERC.PAK       OPENSD2.PAK    XTRE.PAK
 Dune.CFG                  INTRO.PAK      Options.CFG
'Dune II Icons.icl'        INTROVOC.PAK   ORDOS.PAK
'Dune II Unit Guide.txt'   LEGACY.PAK     SCENARIO.PAK
[mythcat@fedora ~]$ dosbox /usr/share/dunelegacy/Dune2.EXE 
date       time         | 
2024-10-16 11:39:03.508 | arguments: dosbox /usr/share/dunelegacy/Dune2.EXE
2024-10-16 11:39:03.509 | Current dir: /home/mythcat
2024-10-16 11:39:03.509 | stderr verbosity: 0
2024-10-16 11:39:03.509 | -----------------------------------

Monday, October 14, 2024

Fedora 42 : Dune Legacy game .

Dune Legacy is an effort by a handful of developers to revitalize the first-ever real-time strategy game.
It tries to be as similar as possible to the original gameplay but to integrate user interface features most modern realtime-strategy games have like selecting multiple units
I download this game from the official website, and I install with DNF5 tool:
[root@fedora Downloads]# dnf5 install dunelegacy-0.96.4.x86_64.rpm
Updating and loading repositories:
Repositories loaded.
Package                 Arch   Version                 Repository           Size
Installing:
 dunelegacy             x86_64 0.96.4-0.1              @commandline      5.8 MiB
Installing dependencies:
 SDL2_mixer             x86_64 2.8.0-2.fc41            updates-testing 345.3 KiB
 ...
 Warning: skipped PGP checks for 1 package from repository: @commandline
Complete!
Find the orifinal Dune II on web, or try this website.
The game can be start after I unarchive the DuneII archive into DuneII then copy to /usr/share/dunelegacy ...
[mythcat@fedora DuneII]$ sudo su 
[sudo] parola pentru mythcat: 
[root@fedora DuneII]# cp *.* /usr/share/dunelegacy
[root@fedora DuneII]# exit
exit
[mythcat@fedora DuneII]$ dunelegacy 
.. and works well :

Sunday, October 13, 2024

Fedora 42 : The cvxpy python module ... part 001.

We are building a CVXPY community on Discord. Join the conversation! CVXPY is an open source Python-embedded modeling language for convex optimization problems. It lets you express your problem in a natural way that follows the math, rather than in the restrictive standard form required by solvers.
Today I install the cvxpy python module ...
You can see on the official website - www.cvxpy.org .
NOTE: I don't understand why the blogger don't have a a code tag , I used a div - pre - code into txt file to wrote my posts ...
[mythcat@fedora ~]$ nano tutoriale.txt 
Let's see ...
[mythcat@fedora home]# dnf5 upgrade
[mythcat@fedora home]# dnf5 install openblas-devel
[mythcat@fedora home]# dnf5 install blas-devel
...
$ ldconfig -p | grep openblas
$ ldconfig -p | grep blas
...
[mythcat@fedora home]$ pip install cvxpy
...
Successfully built cvxpy ecos scs qdldl
Installing collected packages: scipy, scs, qdldl, ecos, clarabel, osqp, cvxpy
Successfully installed clarabel-0.9.0 cvxpy-1.5.2 ecos-2.0.14 osqp-0.6.7.post3 qdldl-0.1.7.post4 scipy-1.14.1 scs-3.2.7

Thursday, October 10, 2024

Fedora 42 : First test with red language - part 001.

Red is a next-generation programming language strongly inspired by Rebol, but with a broader field of usage thanks to its native-code compiler, from system programming to high-level scripting and cross-platform reactive GUI, while providing modern support for concurrency, all in a zero-install, zero-config, single ~1MB file!
I download and change to be executable:
[mythcat@fedora ~]$ cd red-lang/
[mythcat@fedora red-lang]$ ls
red-03oct24-920dd0452  red-toolchain-03oct24-920dd0452  red-view-03oct24-920dd0452
[mythcat@fedora red-lang]$ ls -l
total 4444
-rw-r--r--. 1 mythcat mythcat 1347348 Oct  4 23:56 red-03oct24-920dd0452
-rw-r--r--. 1 mythcat mythcat 1611781 Oct  4 23:55 red-toolchain-03oct24-920dd0452
-rw-r--r--. 1 mythcat mythcat 1589092 Oct  4 23:55 red-view-03oct24-920dd0452
[mythcat@fedora red-lang]$ chmod 760 red*
[mythcat@fedora red-lang]$ ls -l
total 4444
-rwxrw----. 1 mythcat mythcat 1347348 Oct  4 23:56 red-03oct24-920dd0452
-rwxrw----. 1 mythcat mythcat 1611781 Oct  4 23:55 red-toolchain-03oct24-920dd0452
-rwxrw----. 1 mythcat mythcat 1589092 Oct  4 23:55 red-view-03oct24-920dd0452
I check and install these supporting libraries:
sudo yum install glibc.i686
sudo yum install libcurl.i686
sudo yum install gtk3.i686
I start with the basic intro example from the official website.
Then I need to check the missing files with the DNF tool and install Fedora packages for each error on runtime with executable result
dnf provides \*/libgtk-3.so.0
The result is this: