Skip to content

Instantly share code, notes, and snippets.

@juanpabloaj
juanpabloaj / codex_integration_tests_without_docker.md
Last active June 21, 2025 18:38
Running Integration Tests Without Docker in the Codex environment

Running Integration Tests Without Docker in the Codex environment

This guide explains how to execute the integration test suite in an environment where docker or docker-compose are unavailable. Ensure neither tool is installed before continuing. If either command prints a version number, use the container-based workflow instead.

# Check for docker and docker-compose
command -v docker && docker --version
command -v docker-compose && docker-compose --version
@juanpabloaj
juanpabloaj / AGENTS.md
Last active June 6, 2025 01:57
General guidelines and best practices for AI code generation

1. Core Coding Principles

  • Language: All code, comments, variable names, function names, class names, and commit messages must be strictly in English.
  • Idiomatic Style:
    • Write code that adheres to the idiomatic style, conventions, and official style guides of the target language. This includes formatting, naming, and general structure.
    • Assume a linter or formatter will eventually run; aim to produce code that is already close to passing common linting rules.
  • Clarity and Readability:
    • Prioritize clarity, readability, and maintainability over unnecessary "cleverness" or extreme brevity if it sacrifices understanding.
    • Write self-documenting code.
  • Follow the Principle of Least Surprise: code should behave in a way that users and other developers would naturally expect.
@juanpabloaj
juanpabloaj / main.go
Last active April 25, 2025 23:44
Testing of Goroutines with WaitGroup and time.After
package main
import (
"sync"
"testing"
"time"
)
type Actor interface {
Perform()
@juanpabloaj
juanpabloaj / m5stack_unitv2_obj_detection.py
Last active September 11, 2024 01:06
m5stack unitv2 object detection and rectangles drawing
import subprocess
import json
import os
from datetime import datetime
import logging
import base64
from io import BytesIO
from PIL import Image, ImageDraw
@juanpabloaj
juanpabloaj / m5stack_unitv2_object_recognition.py
Created September 10, 2024 02:33
M5stack unitv2 object_recognition example
'''
it shows a log message when an object is detected.
references
https://medium.com/@sebastiaan.panasj/occupancy-counting-with-unitv2-by-m5stack-d35455037882
'''
import subprocess
import json
@juanpabloaj
juanpabloaj / main.go
Created August 26, 2024 19:47
Go slog, example with context handler
package main
import (
"context"
"log/slog"
"os"
)
type contextKey string
@juanpabloaj
juanpabloaj / .gitignore
Last active May 18, 2024 19:43
track ethereum token
.env
*.db
@juanpabloaj
juanpabloaj / main.py
Last active October 15, 2024 00:44
looking for job using Linkedin API
import os
import sqlite3
from linkedin_api import Linkedin
import logging
def extract_id(urn):
return urn.split(":")[-1]
@juanpabloaj
juanpabloaj / main.go
Created July 2, 2023 22:13
heartbeats example
// package main example of the book Concurrency in Go by Katherine Cox-Buday
// it includes the patterns: orChannel, orDone, take, and bridge.
// newSteward monitors a goroutine and restarts it if it stops sending heartbeats
package main
import (
"log"
"time"
)
@juanpabloaj
juanpabloaj / send_telegram_message.py
Last active March 26, 2023 13:26
python3 send telegram message
import os
import urllib.request
import urllib.parse
TELEGRAM_TOKEN = os.environ["TELEGRAM_TOKEN"]
TELEGRAM_CHANNEL_ID = os.environ["TELEGRAM_CHANNEL_ID"]
telegram_url = f"https://api.telegram.org/bot{TELEGRAM_TOKEN}/sendMessage"
telegram_url += f"?chat_id={TELEGRAM_CHANNEL_ID}"