Skip to content

Instantly share code, notes, and snippets.

View alonsoir's full-sized avatar
👋
time to learn SCADA.

@alonso_isidoro alonsoir

👋
time to learn SCADA.
View GitHub Profile
#open_deep_researcher.py
!pip install nest_asyncio
import nest_asyncio
nest_asyncio.apply()
import asyncio
import aiohttp
import json
import os
import ray
from langchain.chains import RetrievalQA
from langchain_core.prompts import PromptTemplate
from langchain_openai import ChatOpenAI, OpenAIEmbeddings
from langchain_community.vectorstores import FAISS
from langchain_community.document_loaders import PyPDFLoader, TextLoader
from langchain_text_splitters import RecursiveCharacterTextSplitter
from langchain_google_community import GoogleSearchAPIWrapper
from langchain_community.tools import Tool
import os
from langchain.chains import RetrievalQA
from langchain_core.prompts import PromptTemplate
from langchain_openai import ChatOpenAI, OpenAIEmbeddings
from langchain_community.vectorstores import FAISS
from langchain_community.document_loaders import PyPDFLoader, TextLoader
from langchain_text_splitters import RecursiveCharacterTextSplitter
from langchain_google_community import GoogleSearchAPIWrapper
from langchain_community.tools import Tool
import multiprocessing
import ipaddress
import subprocess
from scapy.all import sniff, IP
# Rango de IPs asignadas a China
china_ip_ranges = [
"36.0.0.0/8", "42.0.0.0/8", "58.0.0.0/7", "101.0.0.0/8",
"110.0.0.0/7", "120.0.0.0/8", "202.0.0.0/7"
]

(attendance-system-py3.10) ┌<▸> ~/g/attendance_system └➤ poetry add textblob

The following packages are already present in the pyproject.toml and will be skipped:

  • textblob

If you want to update it to the latest compatible version, you can use poetry update package. If you prefer to upgrade it to the latest available version, you can use poetry add package@latest.

@alonsoir
alonsoir / multi.py
Created January 22, 2025 10:43
Para tareas multicore, es mejor usar Pool que Parallel
from multiprocessing import Pool
from joblib import Parallel, delayed
import time
def medir_tiempo(func):
def wrapper(*args, **kwargs):
inicio = time.time()
resultado = func(*args, **kwargs)
fin = time.time()

(attendance-system-py3.10) ┌<▸> ~/g/attendance_system └➤ ./video_to_gif.sh Uso: ./video_to_gif.sh ruta/al/video.mp4 [nombre_del_gif] (attendance-system-py3.10) ┌<▪> ~/g/attendance_system └➤ ./video_to_gif.sh output.mp4 ffmpeg version 7.1 Copyright (c) 2000-2024 the FFmpeg developers built with Apple clang version 16.0.0 (clang-1600.0.26.4) configuration: --prefix=/usr/local/Cellar/ffmpeg/7.1_4 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags='-Wl,-ld_classic' --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libaribb24 --enable-libbluray --enable-libdav1d --enable-libharfbuzz --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enabl

import email
import quopri
from email import policy
from email.parser import BytesParser
def parse_email(file_path):
with open(file_path, 'rb') as file:
msg = BytesParser(policy=policy.default).parse(file)
print("From:", msg.get("From", "N/A"))
import re
def filter_text(text):
# Filter email addresses
emails = re.findall(r'\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b', text)
# Filter mentions (Twitter-style)
mentions = re.findall(r'@\w+', text)
# Filter hashtags
@alonsoir
alonsoir / calabi.c
Created January 20, 2025 13:05
how to create a calabi yau representation using shaders
#define GL_SILENCE_DEPRECATION
#include <GLFW/glfw3.h>
#include <OpenGL/gl3.h> // <-- Añade este header
#include <stdio.h>
#include <math.h>
// Shaders optimizados para macOS
const char* vertex_shader_code =
"#version 410 core\n"
"layout(location = 0) in vec3 position;"