{"id":15209474,"url":"https://github.com/devjosef/zsh-scripts-showcase","last_synced_at":"2026-03-07T22:03:19.925Z","repository":{"id":247210439,"uuid":"825264510","full_name":"Devjosef/zsh-scripts-showcase","owner":"Devjosef","description":"Welcome to the ZSH scripts Showcase. The repository is a collection of useful scripts that you can run within the ZSH shell. The scripts are designed to enhance your productivity, and automate repetitive tasks.","archived":false,"fork":false,"pushed_at":"2024-07-12T11:13:09.000Z","size":42,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-09T12:55:41.522Z","etag":null,"topics":["macosx","practical","shell","shell-scripts","zsh","zsh-scripts"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Devjosef.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-07T09:46:40.000Z","updated_at":"2024-08-05T06:37:52.000Z","dependencies_parsed_at":"2024-09-19T09:02:20.406Z","dependency_job_id":null,"html_url":"https://github.com/Devjosef/zsh-scripts-showcase","commit_stats":null,"previous_names":["devjosef/zsh-scripts-showcase"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Devjosef%2Fzsh-scripts-showcase","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Devjosef%2Fzsh-scripts-showcase/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Devjosef%2Fzsh-scripts-showcase/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Devjosef%2Fzsh-scripts-showcase/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Devjosef","download_url":"https://codeload.github.com/Devjosef/zsh-scripts-showcase/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242692349,"owners_count":20170228,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["macosx","practical","shell","shell-scripts","zsh","zsh-scripts"],"created_at":"2024-09-28T07:40:22.410Z","updated_at":"2026-03-07T22:03:19.881Z","avatar_url":"https://github.com/Devjosef.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Useful Zsh scripts for macOS users.\n\nA collection of scripts and automations that you can run within the zsh shell!.\n\nThese scripts showcase the versatility and power of Zsh for various fun \nand practical tasks. Feel free to try them out and modify them to suit \nyour needs. Happy scripting!\n\n#  Set Random Wallpaper\n\nScript\n\n`!/bin/zsh`\n\n`Directory containing wallpapers`\n\n`WALLPAPER_DIR=\"$HOME/Pictures/Wallpapers\"`\n\n`Get a random wallpaper`\n\n`RANDOM_WALLPAPER=$(ls $WALLPAPER_DIR | sort -R | tail -1)`\n\n`Set the wallpaper using feh (change to your preferred tool)`\n\n`feh --bg-scale \"$WALLPAPER_DIR/$RANDOM_WALLPAPER\"`\n\n`chmod +x random_wallpaper.sh`\n\n`./random_wallpaper.sh`\n\nDEPENDENCIES\n `feh` (or preferred wallpaper setting tool)\n\nUsage\nSets a random wallpaper from a specified directory. each time you run the script. Perfect for keeping the desktop fresh.\n\n\n# DIRECTORY BOOKMARKS\n\nDescription:\nCreate, list, and jump to directory bookmarks, making navigation across \nfrequently used directories seamless.\n\nScript\n\n`!/bin/zsh`\n\n`Bookmarks file`\n`BOOKMARKS_FILE=\"$HOME/.dir_bookmarks\"`\n\n`Function to add a bookmark\nbookmark_add() {\n    echo \"$1=$PWD\" \u003e\u003e $BOOKMARKS_FILE\n    echo \"Bookmark added: $1 -\u003e $PWD\"\n}`\n\n`Function to list bookmarks\nbookmark_list() {\n    cat $BOOKMARKS_FILE\n}`\n\n`Function to jump to a bookmark\nbookmark_jump() {\n    local DEST=$(grep \"^$1=\" $BOOKMARKS_FILE | cut -d '=' -f 2-)\n    if [ -n \"$DEST\" ]; then\n        cd \"$DEST\"\n    else\n        echo \"Bookmark not found: $1\"\n    fi\n}`\n\n`Alias for ease of use\nalias badd=bookmark_add\nalias blist=bookmark_list\nalias bjump=bookmark_jump`\n\nUsage\nAdd a bookmark: badd bookmark_name\nList bookmarks: blist\nJump to a bookmark: bjump bookmark_name\n\n# WEATHER INFO FETCHER\n\nDescription:\nFetch and display current weather information for a specified city using a \ncommand-line weather API.\n\nScript\n\n`!/bin/zsh`\n\n`Function to get weather\nget_weather() {\n    local CITY=\"$1\"\n    local API_KEY=\"your_api_key_here\"\n    local RESPONSE=$(curl -s \n\"http://api.openweathermap.org/data/2.5/weather?q=$CITY\u0026appid=$API_KEY\u0026units=metric\")`\n\n    local TEMP=$(echo $RESPONSE | jq '.main.temp')\n    local DESC=$(echo $RESPONSE | jq -r '.weather[0].description')\n\n    echo \"Current weather in $CITY: $TEMP°C, $DESC\" \n    }\n\nUsage\nReplace your_api_key_here with your actual API key from OpenWeatherMap.\nRun the script with a city name:\nsh\nget_weather \"London\"\n\n# Dependencies\n`curl`\n`jq`\n\n# GIT BRANCH CLEANER\n\nDescription:\nList and delete local branches that have been merged into the current \nbranch to keep your git repository clean.\n\nScript\n\n`!/bin/zsh`\n\n`Function to delete merged branches\nclean_merged_branches() {\n    git branch --merged | grep -v '^\\*' | xargs -n 1 git branch -d\n}`\n\nUsage\nRun the script to delete merged branches:\nsh\nclean_merged_branches\n\n# TIMER\n\nDescription:\nA simple timer script to count down from a specified number of seconds. \nGreat for time management and focused work sessions. can be used as a \npomodoro timer!\n\nScript\n`!/bin/zsh`\n\n`Function to start a timer\ntimer() {\n    local SECONDS=$1\n    while [ $SECONDS -gt 0 ]; do\n        echo -ne \"$SECONDS\\033[0K\\r\"\n        sleep 1\n        : $((SECONDS--))\n    done\n    echo \"Time's up!\"\n}`\n\nUsage\nRun the script with the number of seconds to count down:\nsh\ntimer 10\n\n# Command History Search\n\nDescription:\nQuickly search your command history for a specific term, making it easier \nto find and reuse past commands.\n\nScript\n`!/bin/zsh`\n \n`Function to search command history\nhistory_search() {\n    history | grep \"$1\"\n}`\n\nUsage\nRun the script with the term you want to search for:\nsh\nhistory_search \"git\"\n\n# Temporary HTTP Server\n\nDescription:\nQuickly start a temporary HTTP server to serve files from a directory. \nUseful for sharing files or testing locally.\n\nScript\n\n`!/bin/zsh`\n\n`Function to start a temporary HTTP server\nstart_http_server() {\n    local PORT=${1:-8000}\n    echo \"Starting HTTP server on port $PORT...\"\n    python -m http.server $PORT\n}`\n\nUsage\nRun the script with the desired port number:\nsh\nstart_http_server 8000\n\n# Dependencies\n`python`\n\n# Automated Backup Script\n\nDescription:\n\nAutomate the backup of important files or directories to a specified \nlocation.\n\nScript\n`!/bin/zsh`\n\n`Source and destination directories\nSOURCE_DIR=\"$HOME/Documents\"\nDEST_DIR=\"$HOME/Backup\"`\n\n`Create destination directory if it doesn't exist\nmkdir -p \"$DEST_DIR\"`\n\n`Rsync to backup files\nrsync -av --delete \"$SOURCE_DIR/\" \"$DEST_DIR/\"`\n\n`echo \"Backup completed at $(date)\"`\n\nUsage\nSave script as `backup.sh`, and make it executable with `chmod +x \nbackup.sh` run it to perform the backup.\n\n# Automated System Update\n\nDescription:\nAutomatically update your system packages.\n\nScript\n`!/bin/zsh`\n\n`Update package lists\nsudo apt update`\n\n`Upgrade installed packages\nsudo apt upgrade -y`\n\n`echo \"System update completed at $(date)\"`\n\nUsage\nSave the script as `update_system.sh` make it executable by running `chmod \n+x update_system.sh` and run it to update your system.\n\n# Automated Email Notification\n\nDescription:\nSend an email notification after a long-running task is completed.\n\nScript\n`!/bin/zsh`\n\n`Your email address\nEMAIL=\"your-email@example.com\"`\n\n`Long-running task (e.g., data processing)\necho \"Starting long-running task...\"\nsleep 60  # Simulate a long-running task with sleep`\n\n`Send email notification\necho \"The long-running task has completed.\" | mail -s \"Task Completed\" \n\"$EMAIL\"`\n\n`echo \"Notification sent to $EMAIL\"`\n\nUsage\nSave the script as `notify.sh` make it executable `chmod +x notify.sh` and \nrun it to perform the task and send the notification.\n\n# Automated File Organizer\n\nDescription:\nAutomatically organize files in a directory based on their type.\n\nScript\n`!/bin/zsh`\n\n`Source directory\nSOURCE_DIR=\"$HOME/Downloads\"`\n\n`File type directories\nIMAGE_DIR=\"$SOURCE_DIR/Images\"\nDOCUMENT_DIR=\"$SOURCE_DIR/Documents\"\nVIDEO_DIR=\"$SOURCE_DIR/Videos\"\nOTHER_DIR=\"$SOURCE_DIR/Others\"`\n\n`Create directories if they don't exist\nmkdir -p \"$IMAGE_DIR\" \"$DOCUMENT_DIR\" \"$VIDEO_DIR\" \"$OTHER_DIR\"`\n\n`Move files to corresponding directories\nfor FILE in \"$SOURCE_DIR\"/*; do\n    if [[ -f \"$FILE\" ]]; then\n        case \"$(file --mime-type -b \"$FILE\")\" in\n            image/*) mv \"$FILE\" \"$IMAGE_DIR\" ;;\n            text/*|application/pdf) mv \"$FILE\" \"$DOCUMENT_DIR\" ;;\n            video/*) mv \"$FILE\" \"$VIDEO_DIR\" ;;\n            *) mv \"$FILE\" \"$OTHER_DIR\" ;;\n        esac\n    fi\ndone`\n\n`echo \"Files organized at $(date)\"`\n\nUsage\nSave this script as `organize_files.sh` make it executable `chmod +x \norganize_files.sh` and run it to organize files in your Downloads \ndirectory.\n\n# Automated Git Commit and Push\n\nDescription:\nAutomatically commit and push changes to a Git repository.\n\nScript\n`!/bin/zsh`\n\n`Change to the repository directory\nREPO_DIR=\"$HOME/projects/my-repo\"\ncd \"$REPO_DIR\"`\n\n`Add all changes\ngit add .`\n\n`Commit changes with a message\nCOMMIT_MESSAGE=\"Automated commit at $(date)\"\ngit commit -m \"$COMMIT_MESSAGE\"`\n\n`Push changes to the remote repository\ngit push origin main`\n\n`echo \"Changes committed and pushed at $(date)\"`\n\nUsage\nSave this script as `auto_commit_push.sh` make it executable ` chmod +x \nauto_committ_push.sh` and run it to automatically commit and push changes \nto your repository.\n\n# Running Automations on Schedule\n\nDescription:\nYou can use cron to schedule these scripts to run at specific intervals.\n\nScript\n\n`Edit the crontab:\nsh\ncrontab -e`\n\n`Add a cron job to run the script\nsh\nRun backup script daily at 2am\n0 2 * * * /path/to/backup.sh`\n\n`Run system update script weekly on Sundays at 3am\n0 3 * * 0 /path/to/update_system.sh`\n\n`Run file organizer script hourly\n0 * * * * /path/to/organize_files.sh`\n\n\n\n\nThese scripts showcase the versatility and power of Zsh for various fun \nand practical tasks. Feel free to try them out and modify them to suit \nyour needs. Happy scripting!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevjosef%2Fzsh-scripts-showcase","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevjosef%2Fzsh-scripts-showcase","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevjosef%2Fzsh-scripts-showcase/lists"}