This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
print(sys.version.split()[0]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Enable-WindowsOptionalFeature -FeatureName "Containers-DisposableClientVM" -All -Online |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from urllib.request import urlopen | |
import json | |
import pprint | |
url = 'https://ipinfo.io/json' | |
result = urlopen(url) | |
data = json.load(result) | |
pprint.pprint(data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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)): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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') |
NewerOlder