Skip to content

Instantly share code, notes, and snippets.

View alonsoir's full-sized avatar
👋
time to learn python by doing experiments with AI.

@alonso_isidoro alonsoir

👋
time to learn python by doing experiments with AI.
View GitHub Profile
from rembg import remove
from PIL import Image
## Path for input and output image
input_img = 'spiderman_with_bg.jpeg'
output_img = 'spiderman_without_bg.png'
## loading and removing background
inp = Image.open(input_img)
output = remove(inp)
@alonsoir
alonsoir / fileToSpeech.py
Created August 26, 2024 17:09
It will use say native osx command to read and make a speach about the content.
import PyPDF2
import subprocess
# Open the PDF file (Enter Path To Your PDF)
file = open('fullnotes_lagrangiano_modelo_estandar.pdf', 'rb')
readpdf = PyPDF2.PdfReader(file)
# Iterate over each page in the PDF
for pagenumber in range(len(readpdf.pages)):
# Extract text from the page
@alonsoir
alonsoir / open_links.py
Created August 26, 2024 17:07
a tool to open links in your browser...
@alonsoir
alonsoir / create_fake_data.py
Created August 26, 2024 17:06
faker sample
import pandas as pd
from faker import Faker
import random
fake = Faker()
def generate_fake_data(num_entries=10):
data = []
@alonsoir
alonsoir / analyze.py
Created August 26, 2024 17:00
running of pylint and flake...
import os
import subprocess
def analyze_code(directory):
# List Python files in the directory
python_files = [file for file in os.listdir(directory) if file.endswith('.py')]
if not python_files:
print("No Python files found in the specified directory.")
return
@alonsoir
alonsoir / output whisper commands.txt
Created August 1, 2024 11:05
Esta es una sesion de uso del framework openai whisper.
https://github.com/openai/whisper
(whisper_env) ┌<▸> ~/g/openai-whisper-test
└➤ ffmpeg -f avfoundation -list_devices true -i ""
ffmpeg version 7.0.1 Copyright (c) 2000-2024 the FFmpeg developers
built with Apple clang version 15.0.0 (clang-1500.3.9.4)
configuration: --prefix=/usr/local/Cellar/ffmpeg/7.0.1 --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 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable
#define BUF_SIZE 1024
#define L_BACKLOG 5
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
@alonsoir
alonsoir / Dockerfile.jlink-with-jdeps.temurin
Created July 30, 2024 09:27
Como usar jdeps y jlink para construir una imagen optimizada con el JRE y las dependencias necesarias únicamente. Debería crear una imagen con 57 MB, donde 20 MB es la app en sí. docker build -t user-service:jlink-with-jdeps.temurin -f Dockerfile.jlink-with-jdeps.temurin . --platform=linux/amd64
@alonsoir
alonsoir / tcp-client.c
Created July 7, 2024 21:36
a tcp client and server sample in c.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#define BUFFER_SIZE 1024
@alonsoir
alonsoir / SHODAN python
Last active July 5, 2024 16:13
Un script para interactuar con shodan. Requiere un api key que debes dejar en un fichero .env. pip install shodan. https://github.com/achillean/shodan-python
SHODAN_API_KEY=