Skip to content

Instantly share code, notes, and snippets.

View carloslme's full-sized avatar
🐈

Carlos Mejia carloslme

🐈
View GitHub Profile
@carloslme
carloslme / docker-compose.yaml
Created May 13, 2024 19:57
docker-compose for exercise 2
services:
  server:
    depends_on:
      - "mongodb"
    build: .
    ports:
      - "3030:3030"
    volumes:
      - .:/usr/src/app
  command: air ./cmd/main.go -b 0.0.0.0
@carloslme
carloslme / Dockerfile
Created May 13, 2024 19:55
Dockerfile for exercise 2
# syntax=docker/dockerfile:1
# Comments are provided throughout this file to help you get started.
# If you need more help, visit the Dockerfile reference guide at
# https://docs.docker.com/engine/reference/builder/
################################################################################
# Create a stage for building the application.
ARG GO_VERSION=1.22.0
FROM golang:${GO_VERSION} AS build
@carloslme
carloslme / webscrapper_refactored.py
Last active September 22, 2023 04:44
Refactored webscrapper
import requests
from pathlib import Path
from urllib.parse import urlparse
from bs4 import BeautifulSoup
MAIN_LINK = 'https://datos.cdmx.gob.mx/dataset/afluencia-diaria-de-metrobus-cdmx'
def download_data(link_path: str = "www.google.com", i: int = 0) -> str:
@carloslme
carloslme / webscrapper.py
Last active September 21, 2023 23:12
Spaguetti webscrapper
from bs4 import BeautifulSoup
from urllib.parse import urlparse
import requests
from pathlib import Path
import json
main_link = 'https://datos.cdmx.gob.mx/dataset/inmuebles-catalogados'
r = requests.get(main_link)
@carloslme
carloslme / flake8-lint.yml
Last active May 14, 2022 16:28
YML to check coding style
# This is a basic workflow to help you implement flake8, tool that will help you to
# check your code base against coding style (PEP8), programming errors
# (like “library imported but unused” and “Undefined name”) and to check cyclomatic complexity.
name: flake8 Lint
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ docker ]
@carloslme
carloslme / docker-compose.yml
Created May 13, 2022 19:47
Docker Compose YAML file for FastAPI
version: "3"
services:
api:
build: ./
image: myimage
command: uvicorn main:app --reload --workers 1 --host 0.0.0.0 --port 8000
ports:
- 8000:8000
networks:
@carloslme
carloslme / Dockerfile
Last active May 13, 2022 19:39
Dockerfile for FastAPi
FROM python:3.8
WORKDIR /app
COPY requirements.txt ./
RUN pip3 install --no-cache-dir -r requirements.txt
COPY . .
EXPOSE 8000
@carloslme
carloslme / main.py
Last active October 29, 2022 16:52
FastAPI main.py example
import logging
from typing import Optional
from fastapi import FastAPI
logging.basicConfig(filename='api_logs.log', level=logging.DEBUG,
format='%(asctime)s:%(name)s:%(module)s:%(levelname)s:%(message)s')
app = FastAPI()
@carloslme
carloslme / pep8_cheatsheet.py
Created November 25, 2021 18:24 — forked from RichardBronosky/pep8_cheatsheet.py
PEP-8 cheatsheet
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""This module's docstring summary line.
This is a multi-line docstring. Paragraphs are separated with blank lines.
Lines conform to 79-column limit.
Module and packages names should be short, lower_case_with_underscores.
Notice that this in not PEP8-cheatsheet.py