Skip to content

Instantly share code, notes, and snippets.

View idcesares's full-sized avatar
:octocat:
Keep on hacking!

Isaac D'Césares idcesares

:octocat:
Keep on hacking!
View GitHub Profile
@idcesares
idcesares / bulk_docx_to_pdf.py
Created April 16, 2025 17:20
Converts all docx files in a folder to pdf using LibreOffice CLI
import os
import subprocess
import platform
def convert_docx_to_pdf(input_folder, output_folder):
"""Converts all docx files in the input folder to pdf and saves them in the output folder.
Args:
input_folder: The path to the folder containing the docx files.
output_folder: The path to the folder where the converted pdf files will be saved.
@idcesares
idcesares / video_to_gif.py
Created February 24, 2025 17:10
🎬 A Python script to convert a VIDEO to GIF using the moviepy library
# video_to_gif.py
# -------------------------------------------------
# 🏃 This script converts any video file to an HD GIF.
# 📚 It uses the moviepy library for video processing.
# 🎨 Includes options for resizing, trimming, and optimizing.
# -------------------------------------------------
# Step 1: Install dependencies (run these in your terminal if needed)
# pip install moviepy
@idcesares
idcesares / check_python_version.py
Created November 9, 2024 02:26
Check Python version
import sys
print(sys.version.split()[0])
@idcesares
idcesares / fancy_hello_world.py
Created August 14, 2024 19:37
Fancy Hello World in Python the using Rich Library
# Install the Rich library: ```pip install rich```
from rich.console import Console
from rich.text import Text
from time import sleep
console = Console()
# Create a Text object for the animated text
animated_text = Text("", style="bold")
@idcesares
idcesares / .ps1
Created June 21, 2024 02:31
Enable Windows Sandbox
Enable-WindowsOptionalFeature -FeatureName "Containers-DisposableClientVM" -All -Online
@idcesares
idcesares / download_pdf_google_drive.py
Created July 4, 2023 20:45
Script to download multiple files on Google Drive with Colab and save
# Mount Google Drive
from google.colab import drive
drive.mount('/gdrive')
# Script to download multiple files on Google Drive with Colab
import requests
import os
def download_file_from_google_drive(id, destination):
URL = "https://docs.google.com/uc?export=download"
@idcesares
idcesares / whats_my_ip.py
Created January 6, 2022 17:58
fund out what's your IP Address using Python and ipinfo.io
from urllib.request import urlopen
import json
import pprint
url = 'https://ipinfo.io/json'
result = urlopen(url)
data = json.load(result)
pprint.pprint(data)
@idcesares
idcesares / pdf-to-image.py
Created August 11, 2021 16:26
Convert a PDF file to image using poppler and pdf2image
# Install poppler using chocolatey
# choco install poppler
# Imports
import pdf2image
import os
# Function to convert PDF to image (JPEG)
def to_image(path):
images = convert_from_path(path)
for i in range(len(images)):
@idcesares
idcesares / cidades_ibge.py
Created July 5, 2021 15:15
Exportar cidades brasileiras da api do IBGE para csv
import pandas as pd
import requests
response = requests.get('https://servicodados.ibge.gov.br/api/v1/localidades/municipios')
df = pd.read_json(response.text)
cidades = df['nome']
cidades.to_csv("cidades.csv", index=False)
@idcesares
idcesares / tensorflow_simple_neural_network.py
Created May 29, 2021 15:06
Simple Neural Network using Tensorflow
# Imports
import tensorflow as tf
import numpy as np
from tensorflow import keras
# Define and compile the Neural Network (NN)
model = tf.keras.Sequential([keras.layers.Dense(units=1, input_shape=[1])]) # Only 1 neuron
# Compile the NN
model.compile(optimizer='sgd', loss='mean_squared_error')