Skip to content

Instantly share code, notes, and snippets.

View rodrigobertin's full-sized avatar

RNB Developer rodrigobertin

View GitHub Profile
{
"$schema": "https://biomejs.dev/schemas/1.9.3/schema.json",
"vcs": {
"enabled": false,
"clientKind": "git",
"useIgnoreFile": false
},
"files": {
"ignoreUnknown": false,
"ignore": [".angular", "node_modules"]
@rodrigobertin
rodrigobertin / storages.py
Last active September 17, 2024 23:57
Django 5.1 Storages
AWS_S3_ENDPOINT_URL = f'https://{os.environ.get("BUCKET_NAMESPACE")}.compat.objectstorage.{os.environ.get("BUCKET_REGION")}.oraclecloud.com'
STORAGES = {
"default": {
"BACKEND": "storages.backends.s3.S3Storage",
"OPTIONS": {
"access_key": os.environ.get('BUCKET_KEY'),
"secret_key": os.environ.get('BUCKET_SECRET'),
"bucket_name": os.environ.get('BUCKET_NAME'),
"region_name": os.environ.get('BUCKET_REGION'),
stages:
- build
- replace
- deploy
variables:
SERVER: root@<server>
FOLDER: /PANEL/WEBSITES/<folder>
POSTGRES_DB: <database>
POSTGRES_USER: <user>
import requests
def obtener_latitud_longitud(address):
# Construir la URL de la API de OpenStreetMap
url = f"https://nominatim.openstreetmap.org/search.php?q={address}&format=jsonv2"
# Realizar la solicitud GET a la API de OpenStreetMap
response = requests.get(url)
# Verificar si la solicitud fue exitosa
export DB=base
export PASS=pass
export USER=user
docker exec -ti mongo mongodump --username=$USER --password=$PASS --authenticationDatabase=admin --db=$DB --out /tmp/backups
"scripts": {
"start": "ts-node-dev src/app.ts",
"build": "tsc",
"typeorm": "typeorm-ts-node-commonjs ",
"t:generate": "pnpm run typeorm -d ./src/config/data-source.ts migration:generate ./src/migrations/migrate",
"t:migrate": "pnpm run typeorm -d ./src/config/data-source.ts migration:run",
"t:migrations": "pnpm run t:generate && pnpm run t:migrate",
"t:create-entity": "pnpm run typeorm entity:create"
},
## Build angular site
- name: build
pull: if-not-exists
image: node:16.18.1-alpine
when:
branch:
- master
event:
- push
commands:
@rodrigobertin
rodrigobertin / .dockerignore
Last active May 28, 2023 23:34
Dockerized Angular app
node_modules
.angular
@rodrigobertin
rodrigobertin / check-token.ts
Created March 6, 2023 13:13
Chekc token Express
import {NextFunction, Request, Response} from "express";
import Users from "../apps/users/users";
export const checkToken = async (req: Request, res: Response, next: NextFunction) => {
const headers = req.headers;
if (!headers.authorization) {
res.status(401).json({
message: "No token send!!!"
})
return
@receiver(post_delete, sender=Image)
def post_save_image(sender, instance, *args, **kwargs):
""" Clean Old Image file """
try:
instance.img.delete(save=False)
except:
pass