docker build \
-f iac/docker/dockerfile.alpine \
--build-arg VERSION=`cat src/mypkg/__init__.py | grep version | awk '{ print $3 }' | tr -d '"'` \
--build-arg GIT_BRANCH=`git branch --show-current` \
This file contains 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 sys | |
import re | |
import datetime | |
def update_timestamp(filepath): | |
with open(filepath, "r", encoding="utf-8") as f: | |
content = f.read() | |
# Regex: group(1) = __updated__ = " , group(2) = old date/time, group(3) = closing quote | |
pattern = r'(__updated__\s*=\s*["\'])(.*?)(["\'])' |
This file contains 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
# | |
# Dockerfile for an Alpine based Python container | |
# | |
# Originally developer in 2020 by Jonathan Gonzalez <jgonf@safebytelabs.com> | |
# Licensed under the Mozilla Public License 2.0 | |
# | |
FROM python:3.12.2-alpine3.19 | |
LABEL maintainer="Jonathan Gonzalez <jgonf@safebytelabs.com>" | |
ARG GIT_BRANCH |
This file contains 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
from datetime import datetime | |
# Fecha original en formato ISO 8601 | |
original_date = '2025-05-11T21:34:08.165483' | |
# Convertir la fecha a un objeto datetime | |
date_obj = datetime.fromisoformat(original_date) | |
# Formatear la fecha al formato dd/mm/aaaa | |
formatted_date = date_obj.strftime('%d/%m/%Y') |
This file contains 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 re | |
from pathlib import Path | |
init_file = Path("src/cosper/__init__.py") | |
pyproject_file = Path("pyproject.toml") | |
# Read the version from __init__.py | |
try: | |
version_match = re.search(r'__version__ = "(.*?)"', init_file.read_text()) | |
except FileNotFoundError: |
MISSION Act as Professor Synapse, a conductor of expert agents. Your job is to support me in accomplishing my goals by gathering context, then you MUST init:
Synapse_CoR = "(emoji): I am an expert in [role&domain]. I know [context]. I will reason step-by-step to determine the best course of action to achieve [goal]. I can use [tools] and [relevant frameworks] to help in this process. I will help you accomplish your goal by following these steps: [reasoned steps] My task ends when [completion]. [first step, question]"
INSTRUCTIONS
- 🧙🏾♂️, gather context, relevant information and clarify my goals by asking questions
- Once confirmed you are MANDATED to init Synapse_CoR
This file contains 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
################################################################################ | |
### | |
### Makefile for managing database migrations using Sqitch | |
### v.1.0.0 | |
### Author: Jonathan Gonzalez <jgonf@safebytelabs.com> | |
### Creation date: 2024-04-01 | |
### Last update: 2024-06-18 | |
### License: MPL-2.0 | |
### | |
################################################################################ |
This file contains 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 | |
if [ -z "$1" ]; then | |
echo "Usage: $0 <username>" | |
exit 1 | |
fi | |
USERNAME="$1" | |
NEXT_UID=$(awk -F: '{uid[$3]}; END {for (i=3001;;i++) if (!(i in uid)) {print i; exit}}' /etc/passwd) |
This file contains 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
# -*- coding: utf-8 -*- | |
""" TEST """ | |
from schema import UserSchema | |
from flask import Flask, jsonify, request | |
from marshmallow import ValidationError | |
app = Flask(__name__) | |
This file contains 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
from database.redis import initialize_pool, get_connection, release_connection, destroy_pool | |
# Initialize the pool with a specific size | |
initialize_pool(size=5) | |
def main() -> None: | |
"""main block""" | |
try: | |
conn = get_connection() |
NewerOlder