ChatGPT - Wow, just WOW

Glenn

Administrator
Staff member
I have been messing with the tasks I have to do to update the LL/PP Games and I used ChatGPT to generate the code I need to do the tasks I was doing manually, Updating the missing sizes in Kilobytes within the LLGame.llg, ppGame.ppg and all the others for apps etc. it works faster and is perfect, I even made it calculate the size of the current folder if no ppGame.7z or LLGame.tar.gz file is found (for items I've not yet compressed), it works so flawlessly. I can see why AI will be a hit, this has saved me many hours of work and it means I'll be able to upload the Repositories tonight instead of tomorrow or so.

I am amazed at how the memory side of it works, I asked it to make changes and it updated to include said changes on the existing scripts it generated. Now I'd not really understood the appeal of Vibe coding, but after it was able to save me so much time, I am converted!
 
Hi Glenn,

As is so often the case, it's a double-edged sword. AI functions “seduce” us, and you never really know if the whole thing is actually good for us.

Please understand what I mean. I'm not a religious nut or anything like that, but I do know that we'll end up looking really stupid if we rely on all this AI and stuff.

No power = no brain.

(Do you understand?)

Nevertheless, I must also say that AI technology is absolutely brilliant. Anyone familiar with Skynet (from Terminator) knows that a certain amount of fear is not unfounded. Even now, AI could be secretly generating an immune system against potential attackers. Or am I the only one who sees it so pessimistically?
 
I agree, But I am old and wont change the world, I can only improve it. So I use AI to create things I need to save me time (I am one man and try to achieve so much), so the fact AI can code what I need better/less buggy and MUCH faster than I is worth me using it, But if I was wanting to learn to do everything from memory and understand I still do things manually when I am learning, but even then to understand if it is the "best" way to get results, sometimes AI give a few ideas than you originally had or build upon it.

Relying on AI to achieve results is stupid if you don't understand why the results it gives is so damn impressive, I looked through the code and learnt some stuff and seen it's methods. it was MUCH cleaner than I could do, but I understood it. Now if I wasn't already a script coder and wanted to use AI to do it, that's a bad use case, because you can't tell when it's doing something totally wrong.

But the lack of learning for yourself will limit you and the lack of trying your own solutions first, means that AI can't learn from you, your contributions may never progress AI beyond it's current level if we all used it all the time for everything. everything would have a sameness to it. So I only use it to save time, instead of extracting a archive, opening a file, editing the file, saving and re archiving, I automated it - saved me many hours, I figure my time will be better spent using AI to help me automate it, it took me less than 15 minutes and the job it did took a little under 40 minutes to complete.


Here is the code, it's great that it uses things I know, things I don't and things I wish I knew, I can learn from reading this codes output and even use AI and ask what it's doing on certain sections, because it can elaborate so well. AI is just a tool, you need to choose when to use it and how:
Code:
#!/bin/bash

# Nemo script:
# Update InstalledSize= for ALL metadata files found.
#
# Rules:
#  - Only modify files that contain a [Meta] section.
#  - Prefer archive size (without extracting):
#       LLGame.tar.gz
#       LLApp.tar.gz
#       ppGame.7z
#       ppApp.7z
#  - If no matching archive is found:
#       Use the total size of the folder and all subfolders (in KB).
#  - InstalledSize= is always written inside the [Meta] section.
#  - No .bak files are created, files are overwritten directly.
#
# Supported metadata:
#   LLGame.llg
#   LLApp.lla
#   ppGame.ppg
#   ppApp.app
#   ssApp.app

IFS=$'\n'

# Get uncompressed size from archive without extracting
get_size_from_archive() {
    local archive="$1"
    local total_bytes=0

    case "$archive" in
        *.tar.gz)
            while read -r size; do
                total_bytes=$((total_bytes + size))
            done < <(tar -tvzf "$archive" | awk '{print $3}')
            ;;
        *.7z)
            while read -r size; do
                total_bytes=$((total_bytes + size))
            done < <(7z l "$archive" | awk '
                /^-------------------/ {p=!p; next}
                p && $1 ~ /^[0-9]/ {print $4}
            ')
            ;;
        *)
            return 1
            ;;
    esac

    # Bytes → KB (round up)
    echo $(( (total_bytes + 1023) / 1024 ))
}

# Get size of directory + subdirectories in KB
get_size_from_folder() {
    local folder="$1"
    du -sk "$folder" | cut -f1
}

update_file() {
    local file="$1"
    local dir archive size_kb tmpfile

    # Skip if no [Meta] section
    if ! grep -q '^\[Meta\]' "$file"; then
        echo "Skipping (no [Meta]): $file"
        return
    fi

    dir=$(dirname "$file")

    # Match metadata file to its archive
    case "$(basename "$file")" in
        LLGame.llg) archive="$dir/LLGame.tar.gz" ;;
        LLApp.lla)  archive="$dir/LLApp.tar.gz" ;;
        ppGame.ppg) archive="$dir/ppGame.7z" ;;
        ppApp.app)  archive="$dir/ppApp.7z" ;;
        ssApp.app)  archive="$dir/ppApp.7z" ;;   # adjust if ssApp gets its own archive later
        *) return ;;
    esac

    # Try archive first, fallback to folder size
    if [ -f "$archive" ]; then
        size_kb=$(get_size_from_archive "$archive")
        echo "Using archive for $file → $archive"
    else
        size_kb=$(get_size_from_folder "$dir")
        echo "Archive not found, using folder size for $file"
    fi

    if [ -z "$size_kb" ]; then
        echo "Failed to calculate InstalledSize for: $file"
        return
    fi

    echo "Updating $file → InstalledSize=$size_kb KB"

    tmpfile=$(mktemp)

    # Rewrite file ensuring InstalledSize is inside [Meta]
    awk -v size="$size_kb" '
    BEGIN {
        in_meta=0
        installed_written=0
    }

    /^\[Meta\]/ {
        print
        in_meta=1
        next
    }

    /^\[.*\]/ {
        if (in_meta && !installed_written) {
            print "InstalledSize=" size
            installed_written=1
        }
        in_meta=0
        print
        next
    }

    {
        if (in_meta && $0 ~ /^InstalledSize=/) {
            print "InstalledSize=" size
            installed_written=1
            next
        }
        print
    }

    END {
        if (in_meta && !installed_written) {
            print "InstalledSize=" size
        }
    }
    ' "$file" > "$tmpfile"

    mv "$tmpfile" "$file"
}

for item in $NEMO_SCRIPT_SELECTED_FILE_PATHS; do
    [ -d "$item" ] || continue

    find "$item" -type f \( \
        -name "LLGame.llg" -o \
        -name "LLApp.lla"  -o \
        -name "ppGame.ppg" -o \
        -name "ppApp.app"  -o \
        -name "ssApp.app" \
    \) | while read -r file; do
        update_file "$file"
    done
done

echo "InstalledSize update complete:"
echo " - Used archive sizes when available"
echo " - Fell back to folder sizes when archives were missing"
echo " - Only files with [Meta] were modified"
 
Relying on AI to achieve results is stupid if you don't understand why the results it gives is so damn impressive, I looked through the code and learnt some stuff and seen it's methods. it was MUCH cleaner than I could do, but I understood it. Now if I wasn't already a script coder and wanted to use AI to do it, that's a bad use case, because you can't tell when it's doing something totally wrong.
Yes, I understand what you mean... I was speaking in general terms earlier. I was referring more to people who don't know anything without Google and are too lazy to acquire knowledge.

So, now to LastOS, AI, etc.

I think I'll try to familiarize myself with AI as well. I've been wanting to have a website created using AI for a long time. Somehow, that was pure inspiration...

Best regards

Tommy
 
here's some prompts i've used for webpages:

make a index.html with big text in the middle saying LastOS.org Will shut in 2 days! add a picture of a clock with spinning hands below the text.

i then typed make the background black and the text white.


make a index.php that forwards to https://www.lastos.org/index.html


the next one was way more advanced;

make a index.php that lists all the files in the current directory, make them sortable by name date and size, make them download if clicked, add a home button to go back to lastos.org and change the title on the browser to the current folder name.

the results were perfect.

i use chatgpt for the above and to ask general questions, i use gemini to generate artwork as it's much better than chatgpt. Claude is great at complex coding and grok is a mixed bag, sometime amazing but other times way off.

leonardo.ai has the best art generator with the best upscaling but i've had many produce photo sharpening and repairs better than leo as its sometime too creative.
 
I just noticed that AI isn't as smart as it thinks it is, I just had to repair the code changes it did to LLStore, it said it was supporting spaces in file names using it's method, but it wasn't, meaning even the "c:\Program Files| in the windows version was enough to break it from working from command lines arguments (The store worked fine though).. anyway, It's all updated now and should be fine again, I just filter out the installation locations and make it build the command line file name instead of trusting it is given with quotes etc. Safest way, even if AI says it's not.
 
Back
Top