Skip to content

Instantly share code, notes, and snippets.

View ErnestoCobos's full-sized avatar

Ernesto Cobos ErnestoCobos

View GitHub Profile
@ErnestoCobos
ErnestoCobos / .zshrc
Created February 20, 2024 14:38
The idea is to show here the configuration fragment that is used in .zshrc (mac) for the configuration of the script
# ##############################################
# ## DYNAMIC GIT CONFIGURATOR FOR ZSH SHELL ##
# ## Automates Git configuration on-the-fly ##
# ## based on the current working directory ##
# ## and user-defined scripts. ##
# ##############################################
# ## - Auto-loads with Zsh
# ## - Hooks into directory change events
# ## - Executes Git configuration scripts
# ## - Allows manual addition of Git configs
@ErnestoCobos
ErnestoCobos / addGitConfig.sh
Created February 20, 2024 14:27
Bash script to manage project-specific Git configurations in a JSON file. Easily add or update Git name and email for each working directory. Ideal for developers working on multiple projects with different Git identities. Utilizes jq for safe JSON manipulation.
#!/bin/bash
# This script updates Git configurations for different projects stored in a JSON file within the user's .config directory
# Define the path to the JSON configuration file located in the .config directory of the user's home directory
CONFIG_FILE="$HOME/.config/git-configs.json"
# Check if the configuration file exists. If it does not, create a new JSON file with empty object initialization
if [ ! -f "$CONFIG_FILE" ]; then
echo "{}" > "$CONFIG_FILE"
@ErnestoCobos
ErnestoCobos / DynamicGitConfigurator.sh
Last active February 20, 2024 14:19
Git configuration automation script to apply specific user settings per project based on the current directory. Includes detailed setup instructions for Zsh users, ensuring consistent and correctly attributed commits across client projects.
#!/bin/bash
# Git Configuration Automation Script with Directory Management
# -------------------------------------------------------------
# This enhanced script automates the process of applying Git configurations
# based on the current working directory, ensuring all repositories for a specific
# client use the correct Git user name and email settings. It is essential for maintaining
# consistent commit metadata across projects and minimizing the risk of commits being
# attributed to the wrong user. Additionally, it now includes functionality to detect
# when a project (repository) is deleted from or re-added to the client's directory,
@ErnestoCobos
ErnestoCobos / download_channel.sh
Created December 1, 2023 05:15
This Bash script automates the process of downloading videos from a specified YouTube channel, uploading them to a designated Dropbox folder, and notifying the user upon completion via AWS SNS. It is designed to run on a Linux environment and utilizes yt-dlp for downloading videos, Dropbox-Uploader for uploading to Dropbox, and awscli for sendin…
#!/bin/bash
# Configurar ARN de tu tema SNS de AWS y URL del canal de YouTube
sns_topic_arn="arn:aws:sns:region:account:id-name"
youtube_channel_url="$1"
dropbox_folder="$2"
# Verificar que se proporcionen ambos argumentos
if [ "$#" -ne 2 ]; then
echo "Uso: $0 URL_DEL_CANAL /ruta/en/Dropbox"