Skip to content

Instantly share code, notes, and snippets.

View MefhigosetH's full-sized avatar
:octocat:
Making a serverless-alpine docker image...

Victor Villarreal MefhigosetH

:octocat:
Making a serverless-alpine docker image...
View GitHub Profile
@juliooa
juliooa / main.py
Last active April 15, 2025 03:13
Query your database with LLMs natural language
import json
import logging
import os
from fastapi import FastAPI
from openai import BaseModel
from dotenv import load_dotenv
import os
from typing import Any
import openai
@breadchris
breadchris / hybrid.py
Last active February 5, 2025 12:18
BM25 and FAISS hybrid search example
import numpy as np
from rank_bm25 import BM25Okapi
from sentence_transformers import SentenceTransformer
import faiss
class HybridSearch:
def __init__(self, documents):
self.documents = documents
# BM25 initialization
@V-Juarez
V-Juarez / Entorno de Desarrollo para php usando Docker.md
Last active March 10, 2025 02:28
Configuración de docker, php y nginx

Entorno de Desarrollo para php usando Docker 🐳

Quieres aprender php, pero las configuraciones te han abrumado y el deseo de aprender van mermando. No, no detengas tu aprendizaje, siempre existe una solución a los problemas. Instalar php, configurar un servidor web en Windows es muy sencillo, en Linux y macOS es otra situación. Debes conocer sobre la terminal, un editor de código, vim, nano, ser avanzado... y mucho más.

La herramienta que vamos a utilizar y que permite trabajar con php, un servidor web y la terminal es Docker.

Docker: Es una plataforma de software que permite crear, probar e implementar aplicaciones rápidamente.

Docker-compose: Es una herramienta para definir y ejecutar aplicaciones; es multicontenedor que permite simplificar el uso de Docker a partir de archivos YAML, de esta forma es más sencillo generar contendores que se relacionen entre sí, conectarlos, habilitar puertos, volúmenes, etc.

@tanaikech
tanaikech / submit.md
Created January 5, 2021 06:59
Downloading and Uploading File to Google Drive without Saving File with Stream and Resumable Upload using Node.js

Downloading and Uploading File to Google Drive without Saving File with Stream and Resumable Upload using Node.js

This is a sample script of Node.js for downloading the data and uploading the data to Google Drive with the resumable upload without saving it as a file. The downloaded data is uploaded to Google Drive with the stream.

Sample script

Before you use this, please set the variables of accessToken, url, fileSize, mimeType and filename. In this case, fileSize is required to set because the data is uploaded with the resumable upload.

const request = require("request");
@intelguasoft
intelguasoft / push_notifications_with_nodejs.md
Created April 30, 2020 02:15
Notificaciones Push de Firebase a Android con NodeJS

Notificaciones Push de Firebase a Android con NodeJS

Entonces, está desarrollando una aplicación móvil y se da cuenta de que necesita una forma de comunicarse con sus usuarios de una manera rápida y rentable. En este punto, estoy seguro de que has pensado en las notificaciones push. Ahí es donde entra Firebase Cloud Messaging (FCM).

Firebase Cloud Messaging (FCM) proporciona una conexión confiable y eficiente de la batería entre su servidor y dispositivos que le permite entregar y recibir mensajes y notificaciones en iOS, Android y la web sin costo alguno. Puedes leer más sobre esto aquí.

Ahora que hemos terminado con la introducción, vamos a sumergirnos en todo este vergueo.

Primero, debe iniciar sesión con su cuenta de Google en firebase. Luego haga clic en el enlace "Ir a la consola" que se encuentra junto al avatar de su cuenta y será redirigido a la consola del tablero de instrumentos, donde

@angeloxx
angeloxx / modsec-clamscan.lua
Last active July 16, 2024 15:13
ModSecurity ClamAV integration script (LUA)
#!/usr/bin/lua
--[[
This script can be used to inspect uploaded files for viruses
via ClamAV. To implement, use with the following ModSecurity rule:
SecRule FILES_TMPNAMES "@inspectFile /opt/modsecurity/bin/modsec-clamscan.lua" "phase:2,t:none,log,deny"
Author: Angelo Conforti (based on Josh Amishav-Zlatin code)
Requires the clamav-server and clamav-scanner
WINDNS %{NUMBER:log_date} %{TIME:log_time} %{WORD:dns_thread_id} %{WORD:dns_context}%{SPACE}%{WORD:dns_packet_id} %{WORD:dns_ip_protocol} %{WORD:dns_direction} %{IP:dns_client_address}%{SPACE}%{WORD:dns_xid}%{SPACE}(?:Q|R|U) ?(Q|R|U)?%{SPACE}[%{GREEDYDATA:dns_hex_flags}%{SPACE}%{WORD:dns_response}]%{SPACE}%{WORD:dns_recordtype}%{SPACE}([1-9][0-9]?)%{GREEDYDATA:dns_query_name}
@plentz
plentz / nginx.conf
Last active May 3, 2025 05:27
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@jfinstrom
jfinstrom / asterisk.py
Last active July 14, 2021 14:37
Example of using the Asterisk Manager API in python...
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# asterisk.py
#
# Copyright 2014 James Finstrom<jfinstrom at gmail>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
@zhangtaihao
zhangtaihao / mysqltmpfs
Created August 30, 2012 02:44
Debian init script to set up MySQL data on tmpfs
#!/bin/sh
### BEGIN INIT INFO
# Provides: mysqltmpfs
# Required-Start: $local_fs $remote_fs $syslog
# Required-Stop: $local_fs $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# X-Start-Before: mysql
# X-Stop-After: mysql
### END INIT INFO