This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| # -*- coding: utf-8 -*- | |
| """ | |
| Agent RSS avec résumé automatique via LLM local. | |
| Ce script exécute ces actions, dans l'ordre : | |
| - Lit une liste de flux RSS | |
| - Filtre les articles selon des mots-clés | |
| - Résume les articles avec un modèle LLM local (Ollama) | |
| - Affiche les résultats en console |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Démonstration du softmax calculé avec la T° | |
| Plus les colonnes seront de même niveau (même proba), plus il y aura de chance que le LLM en choisse un au hasard | |
| """ | |
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| def softmax(logits: list[float], T=1.0): | |
| """ | |
| Calcule le softmax avec une température donnée |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # article.save() provoquera les évènements pre_save / post_save, idem pour les autres exemples | |
| @receiver(pre_save, sender=Article) | |
| def generate_slug(sender, instance, **kwargs): | |
| """création d'un slug sur un article de blog""" | |
| if not instance.slug: | |
| instance.slug = slugify(instance.title) | |
| @receiver(post_save, sender=Invoice) | |
| def create_reference_invoice(sender, instance, created, **kwargs): | |
| """création d'une référence de facture à la création""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" | |
| "http://www.w3.org/TR/html4/loose.dtd"> | |
| <html> | |
| <head> | |
| <title>Site en HTML 4</title> | |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
| <style> | |
| body { background-color: #f0f0f0; } | |
| </style> | |
| </head> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # | |
| # Benchmark entre pip et uv | |
| # sous Windows git-bash | |
| # | |
| # pip env | |
| $ virtualenv env | |
| $ source env/Scripts/activate | |
| # Exécution pip pour installation requirements.txt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Component, OnDestroy } from '@angular/core'; | |
| import { interval, map, filter, tap } from 'rxjs'; | |
| import { Subscription } from 'rxjs'; | |
| @Component({ | |
| selector: 'app-jcvd', | |
| template: `<h2>{{ message }}</h2>`, | |
| }) | |
| export class JcvdComponent implements OnDestroy { | |
| message = 'En attente de la sagesse de JCVD...'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # NVM environnement virtuel nodejs | |
| # Github nvm https://github.com/nvm-sh/nvm | |
| # versions Angular et de Node nécessaires : https://angular.dev/reference/versions | |
| # installation, une version pour Windows est aussi disponible : https://github.com/coreybutler/nvm-windows/releases | |
| $ curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.4/install.sh | bash | |
| # installation de différentes version de Node.js : 14, 16, 20 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div class="@container grid place-items-center w-screen h-screen"> | |
| <button class="w-max flex items-center gap-2 p-4 @[9em]:px-6 rounded-lg text-sm bg-emerald-200 text-emerald-950"> | |
| <svg viewBox="0 0 24 24" fill="none" stroke-width="1.5" stroke="currentColor" class="size-5"> | |
| <path stroke-linecap="round" stroke-linejoin="round" d="M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5M16.5 12 12 16.5m0 0L7.5 12m4.5 4.5V3" /> | |
| </svg> | |
| <span class="sr-only @[9em]:not-sr-only"> | |
| Download <span class="sr-only @[13em]:not-sr-only">PDF file</span> | |
| </span> | |
| </button> | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class CacheHelper: | |
| """ | |
| Cache de données | |
| low-level cache api https://docs.djangoproject.com/fr/4.2/topics/cache/#the-low-level-cache-api | |
| """ | |
| def get_queryset_cache(self, key, queryset) -> QuerySet: | |
| CACHE_TTL = 60 * 60 * 24 * 7 | |
| objects = cache.get(key) | |
| if objects is None: | |
| logger.debug(f"init cache {key}") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| PWD=`pwd` | |
| TRUNK="master" | |
| mode="" | |
| if [[ $# -eq 2 ]]; then # -D : tentera une suppression soft (-d) puis hard (-D) | |
| mode="$2" | |
| fi | |
| echo -e "$PWD/$1 \r\n" | |
| cd "$1" |
NewerOlder