AI ML

# AI / ML

## Prompt

Openness to experience, Conscientiousness, Extraversion, Agreeableness, Non-Neuroticism. (https://github.com/aimclub/OCEANAI?tab=readme-ov-file)


- AIM
- OCEAN
- CoT

## Context

- `.github/prompts/*.prompt.md` - default in VSCode (change: `chat.promptFilesLocations`) https://code.visualstudio.com/docs/copilot/customization/prompt-files
- `@...`
- Structured Output

how to test if a element is enabled on page using Playwright?

// you can do that using the toBeEnabled method of the object that returns expect method
 
import { test, expect } from '@playwright/test';
 
test('basic test', async ({ page }) => {
  await page.goto('https://playwright.dev/');
  const inputName = page.locator("#name") // Select element by id
  await expect(inputName).toBeEnabled()
});

how to check if a element is visible on a page using PlayWright?

// you can do that using the toBeVisible method of the object that returns expect method
 
import { test, expect } from '@playwright/test';
 
test('basic test', async ({ page }) => {
  await page.goto('https://playwright.dev/');
  const inputName = page.locator("#name") // Select element by id
  await expect(inputName).toBeVisible()
});

how to select an html element using css selector in Playwright?

// you can do that using the locator method of the page object that is set as argument of the test function argument

import { test, expect } from '@playwright/test';

test('basic test', async ({ page }) => {
  await page.goto('https://playwright.dev/');
  const inputName = page.locator("#name") // Select element by id
  await expect(inputName).toBeVisible()
});

Prevent to push on branches

- Create `.git/hooks/pre-push` with ``` #!/bin/bash protected_branches=("develop" "main" "master" "prodcution") current_branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,') for branch in "${protected_branches[@]}"; do if [ "$current_branch" = "$branch" ]; then echo "🚫 Direct push to '$branch' is not allowed." echo " Please create a feature branch and open a pull request." exit 1 fi done exit 0 ``` - Then make it executable with `chmod +x .git/hooks/pre-push`
#!/bin/bash

protected_branches=("develop" "main" "master" "production")
current_branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')

for branch in "${protected_branches[@]}"; do
    if [ "$current_branch" = "$branch" ]; then
        echo "🚫 Direct push to '$branch' is not allowed."
        echo "   Please create a feature branch and open a pull request."
        exit 1
    fi
done

exit 0

How to navigate to another page on Playwright?

// You can navigate to another page using the goto method of the page object that is set as argument on the function argument for test function page.goto
import { test, expect } from '@playwright/test';
  test('email entered on login page is displayed on code page', async ({ page }) => {
    await page.goto('/login');
  })

🐧 - Ubuntu - Cheatsheet `fd`

# Cheatsheet fd — De zéro à avancé

## Syntaxe générale

```
fd [FLAGS/OPTIONS] [<pattern>] [<chemin>]
```

- `pattern` : regex par défaut (pas un glob)
- `chemin` : dossier de recherche (défaut : répertoire courant)
- Tout est optionnel : `fd` seul liste tous les fichiers non-cachés du dossier courant

---

## Niveau 1 : Les fondamentaux

### Recherche simple

```bash
# Tous les fichiers contenant "test" dans le nom
fd test

# Recherche dans un dossier spécifique
fd test src/

# Recherche depui

🐧 Ubuntu - Alternatives modernes à find et grep

# Alternatives modernes à `find` et `grep` sur Ubuntu

## Vue d'ensemble

| Outil classique | Alternative moderne | Auteur / Écosystème | Langage |
|-----------------|--------------------|--------------------|---------|
| `find` | **fd** | David Peter | Rust |
| `grep` | **ripgrep** (`rg`) | Andrew Galloway (BurntSushi) | Rust |

Philosophie commune : valeurs par défaut intelligentes, parallélisation, respect automatique de `.gitignore`, syntaxe concise.

---

## fd — Remplaçant de `find`

### I

How can I check what is the remote repository of my current branch?

git remote -v
# origin  https://github.com/user/repo.git (fetch)
# origin  https://github.com/user/repo.git (push)

10. Creer un enemy qui chasse le Player

-- Creer une variable Player

-- Dans ready sauvegarder le player

func _ready() -> void:
	player = get_tree().get_first_node_in_group("Player")

-- Dans physicis process utuliser direction_to

func _physics_process(delta: float) -> void:
	direction = position.direction_to(player.position)
	velocity = direction * vitesse

-- Jouer animation de l'enemy:
 
 func enemy_animation():
	if abs(direction.x) > abs(direction.y):
		if direction.x > 0.0:
			animated_sprite_2d.play("walk_right")
		elif  dire

9.Comment implementer attaque Godot

-- Creer une variable bool pour traquer l'attaque

-- Dans Physic process

func _physics_process(delta: float) -> void:
	if est_en_train_attaquer:
		velocity = Vector2.ZERO
		return


-- Puis creer la function integré de Godot

func _unhandled_input(event: InputEvent) -> void:
	if event is InputEventMouseButton:
		if event.button_index == MOUSE_BUTTON_LEFT and event.pressed:
			if not est_en_train_attaquer:
				est_en_train_attaquer = true
				animated_sprite_2d.play("attack_" +

Crypto Class for PHP

<?php

class Crypto
{
    private const CIPHER = 'aes-256-gcm';

    /* ---------- KEY HELPERS ---------- */

    public static function generateKey(): string
    {
        return random_bytes(32);
    }

    /* ---------- STRING ENCRYPT / DECRYPT ---------- */

    public static function encrypt(string $plaintext, string $key): string
    {
        $ivLength = openssl_cipher_iv_length(self::CIPHER);
        $iv = random_bytes($ivLength);

        $ciphertext = openssl_encrypt(
            $plai

Bootstrap Styled PC Repair Services Section

<section class="py-5 bg-light">
  <div class="container">
    <div class="text-center mb-5">
      <h2 class="fw-bold">PC Repair & IT Support Services</h2>
      <p class="text-muted">Reliable technical solutions for home and business users</p>
    </div>

    <div class="row g-4">

      <!-- Service 1 -->
      <div class="col-md-4">
        <div class="card h-100 shadow-sm">
          <div class="card-body text-center">
            <i class="bi bi-pc-display fs-1 text-primary"></i>
          

67. Add Binary

Given two binary strings a and b, return their sum as a binary string.
/**
 * Adds two binary strings and returns their binary sum.
 * @param {string} a
 * @param {string} b
 * @return {string}
 */
var addBinary = function(a, b) {
    let result = "";   // final binary string (built from right to left)
    let carry = 0;     // carry bit (0 or 1)

    // Continue while there are digits left in either string OR a remaining carry
    while (a.length > 0 || b.length > 0 || carry > 0) {

        // Extract last digit of each string (or 0 if empty)
        const bitA = 

Generate a Full URL of Current Page

<?php
// Determine the protocol (http or https)
$protocol = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https://" : "http://";

// Get the host name (e.g., www.example.com)
$host = $_SERVER['HTTP_HOST'];

// Get the requested URI (e.g., /path/to/page.php?query=string)
$uri = $_SERVER['REQUEST_URI'];

// Construct the full URL
$current_url = $protocol . $host . $uri;

// Echo the URL
echo $current_url;
?>

799. Champagne Tower

We stack glasses in a pyramid, where the first row has 1 glass, the second row has 2 glasses, and so on until the 100th row. Each glass holds one cup of champagne. Then, some champagne is poured into the first glass at the top. When the topmost glass is full, any excess liquid poured will fall equally to the glass immediately to the left and right of it. When those glasses become full, any excess champagne will fall equally to the left and right of those glasses, and so on. (A glass at the bottom row has its excess champagne fall on the floor.) For example, after one cup of champagne is poured, the top most glass is full. After two cups of champagne are poured, the two glasses on the second row are half full. After three cups of champagne are poured, those two cups become full - there are 3 full glasses total now. After four cups of champagne are poured, the third row has the middle glass half full, and the two outside glasses are a quarter full, as pictured below. Now after pouring some non-negative integer cups of champagne, return how full the jth glass in the ith row is (both i and j are 0-indexed.)
/**
 * @param {number} poured       - Total cups of champagne poured into the top glass
 * @param {number} query_row    - Row of the target glass (0-indexed)
 * @param {number} query_glass  - Column of the target glass (0-indexed)
 * @return {number}             - Fullness of the target glass (0 to 1)
 */
var champagneTower = function(poured, query_row, query_glass) {
    // We only need up to 100 rows, so create a 2D array of zeros.
    // dp[r][c] represents the *amount of champagne that arriv