Skip to content

Instantly share code, notes, and snippets.

View ivansaul's full-sized avatar

ivansaul

View GitHub Profile
@ivansaul
ivansaul / read_excel_from_git_lab.py
Created February 7, 2021 04:31
Read Excel file (.xlsx) into pandas data frame from GitLab url
import pandas as pd
import requests
url= 'https://gitlab.com/username/repo/-/raw/master/data.xlsx'
myfile = requests.get(url)
df=pd.read_excel(myfile.content)
print(df)
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 5.
Rank,Title,Genre,Description,Director,Actors,Year,Runtime (Minutes),Rating,Votes,Revenue (Millions),Metascore
1,Guardians of the Galaxy,"Action,Adventure,Sci-Fi",A group of intergalactic criminals are forced to work together to stop a fanatical warrior from taking control of the universe.,James Gunn,"Chris Pratt, Vin Diesel, Bradley Cooper, Zoe Saldana",2014,121,8.1,757074,333.13,76
2,Prometheus,"Adventure,Mystery,Sci-Fi","Following clues to the origin of mankind, a team finds a structure on a distant moon, but they soon realize they are not alone.",Ridley Scott,"Noomi Rapace, Logan Marshall-Green, Michael Fassbender, Charlize Theron",2012,124,7,485820,126.46,65
3,Split,"Horror,Thriller",Three girls are kidnapped by a man with a diagnosed 23 distinct personalities. They must try to escape before the apparent emergence of a frightful new 24th.,M. Night Shyamalan,"James McAvoy, Anya Taylor-Joy, Haley Lu Richardson, Jessica Sula",2016,117,7.3,157606,138.12,62
4,Sing,"Animation,Comedy,Family","In a city of humano
@ivansaul
ivansaul / split_concat_videos.md
Last active November 10, 2020 17:53
Split and Concat Videos With this Python Script

MoviePy

Source: MoviePy

Installation:

pip install moviepy

Python script:

from moviepy.editor import VideoFileClip, concatenate_videoclips
@ivansaul
ivansaul / CodigoIdiomas.csv
Last active September 16, 2024 15:38
Google translate language codes ISO-639-1 || Códigos de idioma del traductor de Google ISO-639-1
Código ISO-639-1 Idioma
af Afrikáans
sq Albanés
am Amárico
ar Árabe
hy Armenio
az Azerí
eu Vasco
be Bielorruso
bn Bengalí
@ivansaul
ivansaul / GoogleTransPython.py
Last active November 6, 2020 17:56
Fix error in result (AttributeError: 'NoneType' object has no attribute 'group') GoogleTrans Python
'''
After making more than 10,000 queries, I realized that
each successful query takes a maximum of 15 iterations,
taking an average 1 second.
'''
import googletrans
from googletrans import Translator
def en_es(palabra):
translator = Translator()
@ivansaul
ivansaul / discordDM.py
Last active June 13, 2022 04:14
Welcome direct message discord python
import discord
from discord.ext import commands
#add this line
intents=intents=discord.Intents.all()
#if the above don't work, try with this
#intents = discord.Intents()
#intents.members = True
@ivansaul
ivansaul / SplitRangePDF.py
Created October 15, 2020 15:58
Split PDF by range with Python v3.x and pypdf2
#!/usr/bin/python
from PyPDF2 import PdfFileReader, PdfFileWriter
#split range
pgi=30 #start
pgf=37 #end
pdf_document = "test.pdf"
pdf = PdfFileReader(pdf_document)
pdf_writer = PdfFileWriter()
for page in range(pgi-1,pgf):