Skip to content

Instantly share code, notes, and snippets.

View rpappalax's full-sized avatar

Richard Pappalardo rpappalax

  • Mozilla
  • Valencia, Spain
View GitHub Profile
from __future__ import annotations
import math
from typing import Sequence
def cosine(a: Sequence[float], b: Sequence[float]) -> float:
dot = 0.0
na = 0.0
nb = 0.0
from __future__ import annotations
from dataclasses import dataclass
from typing import List
@dataclass(frozen=True)
class Note:
note_id: str
content: str
source: str | None = None
@rpappalax
rpappalax / gist:d3a0b795ed6189e2d5c3c9f3c93cfec9
Created January 30, 2026 15:29
app/llm/gemini_client.py
from __future__ import annotations
from vertexai.preview.generative_models import GenerativeModel, Part
from app.common.config import Settings
from app.llm.vertex_init import init_vertex
def generate(
settings: Settings,
from __future__ import annotations
from typing import List
from vertexai.language_models import TextEmbeddingModel
from app.common.config import Settings
from app.llm.vertex_init import init_vertex
_MODEL: TextEmbeddingModel | None = None
import logging
import vertexai
from app.common.config import Settings
_INITIALIZED = False
def init_vertex(settings: Settings) -> None:
"""Initialize Vertex AI once per process."""
global _INITIALIZED
@rpappalax
rpappalax / gist:0990fb2764346e85a58ab9af5215ddba
Created January 30, 2026 15:27
app/common/logging_utils.py
import logging
import os
def setup_logging() -> None:
level = os.getenv("LOG_LEVEL", "INFO").upper()
logging.basicConfig(
level=getattr(logging, level, logging.INFO),
format="%(asctime)s %(levelname)s %(name)s - %(message)s",
)
import os
from dataclasses import dataclass
def _env(name: str, default: str | None = None) -> str | None:
v = os.getenv(name)
if v is None or v == "":
return default
return v
from __future__ import annotations
import logging
from typing import Optional
from fastapi import FastAPI, Form, File, UploadFile, HTTPException
from fastapi.responses import JSONResponse
from app.common.config import Settings
from app.common.logging_utils import setup_logging
0. Accessing the Credit cards section
1. Verify the Autofill credit cards toggle on/off
2. Verify the Edit Saved Cards view
3. Turn History search suggestions on/off
4. Empty tab tray - grid view
5. Video with DRM content can be played. (Notification not yet implemented)
6. Clear key DRM video can be played. (Notification not yet implemented)
7. Add a new tab to a collection from tabs tray
8. Notifications permission prompt
9. Location permission prompts
@rpappalax
rpappalax / gist:97eb51111ac032c2474ec9cd8083d6bb
Created October 15, 2021 20:20
new Flank replacement file
# save this configuration to a file called: firebase.yaml
#
# gcloud args match the official gcloud cli
# https://cloud.google.com/sdk/gcloud/reference/firebase/test/android/run
#
# run command:
# gcloud beta firebase test android run firebase.yaml:x86
#
x86: