analitics

Pages

Wednesday, December 17, 2025

Python Qt6 : Run Visual Studio Code directly from RAM using ImDisk and python.

I built a small tool using Python + PyQt6 that lets me run Visual Studio Code directly from a RAM Disk for maximum speed and minimal SSD wear.
The setup uses ImDisk Toolkit to automatically create a 6 GB RAM Disk (drive O:).
The tool then copies VS Code into RAM and launches it instantly through a simple graphical interface with three buttons:
  • Create RAM Disk
  • Copy VS Code to RAM
  • Launch VS Code from RAM
This method provides much faster startup times and a smoother workflow, making it a great performance boost for Windows users.

News : Reporting a security issue - good practice.

This is how the python solve a security issue:
We take security very seriously and ask that you follow our security policy carefully.
If you've identified a security issue with a project hosted on PyPI.
Login to your PyPI account, then visit the project's page on PyPI. At the bottom of the sidebar, click Report project as malware. Supply the following details in the form:
  • A URL to the project in question
  • An explanation of what makes the project a security issue
  • A link to the problematic lines in the project's distributions via inspector.pypi.io
Important! If you believe you've identified a security issue with PyPI, DO NOT report the issue in any public forum, including (but not limited to):
  • Our GitHub issue tracker
  • Official or unofficial chat channels
  • Official or unofficial mailing lists

Monday, December 15, 2025

Python Qt6 : ... tool for testing fonts.

Today I created a small Python script with PyQt6 using artificial intelligence. It is a tool that takes a folder of fonts, allows to select their size, displays the font size in pixels for Label text from the Godot engine and downloads only the selection of fonts that I like. I have not tested it to see the calculations with Godot, but it seems functional...

Saturday, December 13, 2025

Python Qt6 : ... search custom data in files with python and PyQt6.

The other day I noticed that I can't find what I worked on in the past, some files were blocked... Another task was blocking the artificial intelligence due to the number of uses. I could have used artificial intelligence to open old projects and ask where what I worked on is, but it would be a risk to waste my queries. Since I always use a specific signature when working on separate projects and the backup is distributed on storage that is always filling up, I created a simple script that would search for my custom with custom files, custom content and output a spreader with them. Here is the result of a 310-line source code script, obviously created with artificial intelligence.

Wednesday, December 10, 2025

Python 3.13.0 : ... simple script for copilot history.

NOTES: I have been using artificial intelligence since it appeared, it is obviously faster and more accurate, I recommend using testing on larger projects.
This python script will take the database and use to get copilot history and save to file copilot_conversations.txt :
import os
import sqlite3
import datetime
import requests
from bs4 import BeautifulSoup
import shutil

# Locația tipică pentru istoricul Edge (Windows)
edge_history_path = os.path.expanduser(
    r"~\\AppData\\Local\\Microsoft\\Edge\\User Data\\Default\\History"
)

# Copiem fișierul History în folderul curent
def copy_history_file(src_path, dst_name="edge_history_copy.db"):
    if not os.path.exists(src_path):
        print("Nu am găsit istoricul Edge.")
        return None
    dst_path = os.path.join(os.getcwd(), dst_name)
    try:
        shutil.copy(src_path, dst_path)
        print(f"Am copiat baza de date în {dst_path}")
        return dst_path
    except Exception as e:
        print(f"Eroare la copiere: {e}")
        return None

def extract_copilot_links(db_path):
    conn = sqlite3.connect(db_path)
    cursor = conn.cursor()

    cursor.execute("""
        SELECT url, title, last_visit_time
        FROM urls
        WHERE url LIKE '%copilot%'
    """)

    results = []
    for url, title, last_visit_time in cursor.fetchall():
        ts = datetime.datetime(1601, 1, 1) + datetime.timedelta(microseconds=last_visit_time)
        results.append({
            "url": url,
            "title": title,
            "last_visit": ts.strftime("%Y-%m-%d %H:%M:%S")
        })

    conn.close()
    return results

def fetch_conversation(url):
    try:
        resp = requests.get(url)
        if resp.status_code == 200:
            soup = BeautifulSoup(resp.text, "html.parser")
            texts = soup.get_text(separator="\n", strip=True)
            return texts
        else:
            return f"Eroare acces {url}: {resp.status_code}"
    except Exception as e:
        return f"Eroare acces {url}: {e}"

if __name__ == "__main__":
    copy_path = copy_history_file(edge_history_path)
    if copy_path:
        chats = extract_copilot_links(copy_path)
        if chats:
            with open("copilot_conversations.txt", "w", encoding="utf-8") as f:
                for chat in chats:
                    content = fetch_conversation(chat["url"])
                    f.write(f"=== Conversație: {chat['title']} ({chat['last_visit']}) ===\n")
                    f.write(content)
                    f.write("\n\n")
            print("Am salvat conversațiile în copilot_conversations.txt")
        else:
            print("Nu am găsit conversații Copilot în istoricul Edge.")

Saturday, December 6, 2025

News : Python 3.14.1 and Python 3.13.10 are now available!

... these are good news from 2 december 2025:
Python 3.14.1 is the first maintenance release of 3.14, containing around 558 bugfixes, build improvements and documentation changes since 3.14.0.
Python 3.13.10 is the tenth maintenance release of 3.13, containing around 300 bugfixes, build improvements and documentation changes since 3.13.9.
Read more on the official blogger.

Friday, December 5, 2025

Python Qt6 : ... data generator tool for a custom format file.

Today I finished a data generator tool for a custom format for a game. The idea is that PyQt6 is versatile and very useful for a developer. This tool generates data in the 2D area of a screen and saves them in a defined format, in this case a position and a size for a text ...
Here is the class for custom range selection sliders.
class RangeSlider(QWidget):
    def __init__(self, parent=None):
        super().__init__(parent)
        self._min, self._max = 0, 1000
        self._start, self._end = 0, 1000
        self._dragging = None
        self.setMinimumHeight(24)

    def setRange(self, minimum, maximum):
        self._min, self._max = minimum, maximum
        self._start, self._end = minimum, maximum
        self.update()

    def setStart(self, val):
        self._start = max(self._min, min(val, self._end))
        self.update()

    def setEnd(self, val):
        self._end = min(self._max, max(val, self._start))
        self.update()

    def start(self): return self._start
    def end(self): return self._end

    def _pos_to_val(self, x):
        w = self.width()
        ratio = max(0, min(x, w)) / w if w else 0
        return int(self._min + ratio*(self._max-self._min))

    def _val_to_pos(self, val):
        w = self.width()
        return int((val-self._min)/(self._max-self._min)*w) if self._max>self._min else 0

    def mousePressEvent(self, e):
        x = e.position().x()
        sx, ex = self._val_to_pos(self._start), self._val_to_pos(self._end)
        self._dragging = "start" if abs(x-sx)<abs(x-ex) else "end"
        self.mouseMoveEvent(e)

    def mouseMoveEvent(self, e):
        if self._dragging:
            val = self._pos_to_val(int(e.position().x()))
            if self._dragging=="start": self.setStart(val)
            else: self.setEnd(val)

    def mouseReleaseEvent(self,e): self._dragging=None

    def paintEvent(self,e):
        p=QPainter(self); rect=self.rect()
        sx,ex=self._val_to_pos(self._start),self._val_to_pos(self._end)
        p.fillRect(rect,QColor(220,220,220))
        p.fillRect(QRect(QPoint(sx,0),QPoint(ex,rect.height())),QColor(100,200,100,120))
        p.setBrush(QColor(50,120,200)); p.setPen(Qt.PenStyle.NoPen)
        p.drawEllipse(QPoint(sx,rect.center().y()),6,6)
        p.drawEllipse(QPoint(ex,rect.center().y()),6,6)

Thursday, December 4, 2025

News : the pythononline online tool for python users.

Wednesday, December 3, 2025

Python 3.13.0 : ... playwright - part 001.

Playwright for Python is a modern automation library that allows developers to control browsers like Chromium, Firefox, and WebKit. It is widely used for testing, scraping, and simulating real user interactions.
The package provides an asynchronous API, enabling fast and reliable automation. Developers can launch browsers, navigate to pages, fill forms, click buttons, and capture results with minimal code.
In practice, Playwright is useful for tasks such as automated testing, repetitive searches, data collection, and simulating human-like browsing behavior across multiple browsers.
The example script demonstrates how to open Firefox, navigate to Google, perform a series of searches, scroll the page, and pause between actions to mimic natural user activity.
Additionally, the script saves each search query into a text file, creating a simple log of performed searches. This shows how Playwright can combine browser automation with file handling for practical workflows.
I used the pip tool then I install the playwright:
pip install playwright
playwright install
Let's see the script:
import asyncio
from playwright.async_api import async_playwright

async def main():
    async with async_playwright() as p:
        browser = await p.firefox.launch(headless=False)
        context = await browser.new_context()
        page = await context.new_page()

        await page.goto("https://www.google.com")

        queries = [
            "python automation",
            "playwright tutorial",
            "google search automation"
        ]

        with open("results.txt", "w", encoding="utf-8") as f:
            for q in queries:
                # Fill search box
                await page.fill("textarea[name='q']", q)
                await page.press("textarea[name='q']", "Enter")
                await page.wait_for_load_state("domcontentloaded")

                # Scroll + pause
                await page.evaluate("window.scrollBy(0, document.body.scrollHeight)")
                await page.wait_for_timeout(3000)

                # Extract search results (titles + links)
                results = await page.query_selector_all("h3")
                f.write(f"\nResults for: {q}\n")
                for r in results[:5]:  # primele 5 rezultate
                    title = await r.inner_text()
                    link_el = await r.evaluate_handle("node => node.parentElement")
                    link = await link_el.get_attribute("href")
                    f.write(f"- {title} ({link})\n")

                print(f"Saved results for: {q}")

        await browser.close()

asyncio.run(main())
Then I run with this command:
python google_search_test_001.py
Saved results for: python automation
Saved results for: playwright tutorial
Saved results for: google search automation
Need to click to accept on browser ... , and some basic result on results.txt file:

Results for: python automation

Results for: playwright tutorial
- Playwright: Fast and reliable end-to-end testing for modern ...