Skip to content

Instantly share code, notes, and snippets.

View vitorcalvi's full-sized avatar
🎯
Focusing

Carlos Vitor Botti Calvi vitorcalvi

🎯
Focusing
View GitHub Profile
@vitorcalvi
vitorcalvi / gist:e623ac64ef0c7f49713181848dda5f14
Last active July 15, 2024 14:34
Install Jupyter Notebook on Android Mobile
# Step 1: Install the Termux app
# Download and install the Termux app from Google Play Store or F-Droid
# Step 2: Open Termux and run the following commands
# Update and upgrade existing packages
apt update && apt upgrade -y
# Install necessary packages
apt install clang python fftw libzmq freetype libpng pkg-config libcrypt -y
@vitorcalvi
vitorcalvi / docker-install.md
Created June 20, 2024 07:58 — forked from ebta/docker-install.md
Installing docker (latest version) on Ubuntu 20.04

Installing docker on Ubuntu 20.04 / 22.04

Full reference here: https://docs.docker.com/engine/install/ubuntu/

Setup the repository

sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release

Add Docker’s official GPG key:

Shrink code
Requirements:
Combined import statements into a single line where possible.
Removed unnecessary whitespace and comments.
Inlined some logic to reduce the number of lines.
Used list comprehensions and generator expressions to simplify the code.
Shortened variable names where readability was not compromised.
@vitorcalvi
vitorcalvi / create_conda_env.sh
Created June 8, 2024 06:51
Create and activate a Conda environment named after the latest directory in ~/Desktop/webllama, then optionally install packages from requirements.txt
NAME=$(basename "$(ls -td ~/Desktop/webllama/*/ | head -1)") && conda create -n "$NAME" python=3.10 -y && conda activate "$NAME" && read -p "Install packages from requirements.txt? (yes/no): " choice && [[ "$choice" == "yes" ]] && pip install -r requirements.txt
@vitorcalvi
vitorcalvi / convertPytorchGGUF.py
Last active May 30, 2024 14:47
Model Conversion and Upload to Hugging Face Hub
import os
import json
import argparse
from huggingface_hub import snapshot_download, HfApi
# Parse command-line arguments
parser = argparse.ArgumentParser(description="Convert and upload a model to Hugging Face Hub.")
parser.add_argument("--hf_token", type=str, required=True, help="Hugging Face token")
parser.add_argument("--model_id", type=str, required=True, help="Model ID on Hugging Face Hub")
parser.add_argument("--outtype", type=str, required=True, help="Output type for the conversion (e.g., q8_0, f16, f32)")
@vitorcalvi
vitorcalvi / cuda_11.8_installation_on_Ubuntu_22.04
Last active June 12, 2024 16:19 — forked from MihailCosmin/cuda_11.8_installation_on_Ubuntu_22.04
Instructions for CUDA v11.8 and cuDNN 8.7 installation on Ubuntu 22.04 for PyTorch 2.0.0
#!/bin/bash
### steps ####
# verify the system has a cuda-capable gpu
# download and install the nvidia cuda toolkit and cudnn
# setup environmental variables
# verify the installation
###
# Function to print messages
@vitorcalvi
vitorcalvi / auto_env.bash
Last active May 26, 2024 15:58
env creat
# Version 1
#env_name='mlx-chat-app';
#conda deactivate && conda remove --name "$env_name" --all -y && \
#conda create -n "$env_name" python=3.10 -y && conda activate "$env_name" &&
# pip install tensorflow-macos tensorflow-metal &&
# pip install -r requirements.txt
read -p "Enter the name of the conda environment: " env_name && conda deactivate && conda remove --name "$env_name" --all -y && conda create -n "$env_name" python=3.10 -y && conda activate "$env_name" && pip install -r requirements.txt
@vitorcalvi
vitorcalvi / gist:b6f12c9cd6512de5f75ebb31e8047340
Last active May 26, 2024 18:03
LLma + Benchmark (for Cloud servers)
#!/bin/bash
sudo apt update && sudo apt full-upgrade -y
# Install cockpit and its components, netdata, git-lfs, and npm
sudo apt install "cockpit" "cockpit-machines" "cockpit-storaged" "cockpit-packagekit" "cockpit-networkmanager" "cockpit-system" -y
sudo apt install netdata -y && sudo apt install git-lfs -y && sudo apt install npm -y
@vitorcalvi
vitorcalvi / macM1Install.bash
Last active July 17, 2024 17:10
Comprehensive Bash script to automate macOS developer setup: installs essential apps with Homebrew, sets up Zsh with Oh My Zsh and Powerlevel10k, downloads FlutterFlow, updates /etc/hosts, sets up a conda environment, and installs Anaconda.
#!/bin/bash
set -eo pipefail
# Function to install Xcode Command Line Tools
install_xcode_cli() {
echo "Installing Xcode Command Line Tools..."
xcode-select --install
}
@vitorcalvi
vitorcalvi / remove_all.sh
Created May 15, 2024 16:02
List and remove all conda env
# List all Conda environments
conda env list
# Capture the list of environment names and loop through them
while IFS= read -r line; do
# Extract the environment name from each line
name=$(echo "$line" | cut -d ' ' -f 1)
# Skip the first line (header) and the base environment
if [ "$name" != "#" ] && [ "$name" != "base" ]; then