A repository for sharing and managing configurations for the .zshrc file. This includes useful aliases, functions, and environment variable setups for a more efficient shell experience.
-
.env.example:
A template file to manage sensitive environment variables such as tokens and API keys. To use it:- Copy the file and rename it to
.env:cp .env.example .env
- Edit the
.envfile to add your variables (e.g.,GITHUB_TOKEN).
- Copy the file and rename it to
-
dotzshrc.txt:
Contains sample.zshrcconfigurations with useful aliases, functions, and support for environment variables. You can use it as a reference or directly copy parts of it to your own.zshrc. -
README.md:
This documentation file provides details about the repository's purpose, usage, and structure.
To get started, clone the repository to your local machine:
git clone https://github.com/masbekkk/zshrc.git
cd zshrc- Rename the
.env.examplefile to.env:cp .env.example .env
- Open the
.envfile and update it with your environment variables:For example:nano .env
GITHUB_TOKEN=your_personal_access_token
- Copy or integrate the configurations from
dotzshrc.txtinto your existing.zshrcfile:cat dotzshrc.txt >> ~/.zshrc
- Reload your
.zshrcto apply the changes:source ~/.zshrc
Manage sensitive tokens and API keys securely using an .env file, sourced in your shell configuration.
The dotzshrc.txt includes the following aliases to streamline your workflow:
- Reload
.zshrc:alias load='source ~/.zshrc' - Laravel-specific commands:
lri: Create a new Laravel project.lr: Clear Laravel cache and start the server.oc: Clear Laravel cache.mgr: Run migrations.dbs: Seed the database.mgrs: Run migrations with seeding.mgrsf: Fresh migrations with seeding.
Custom functions for Laravel, Git, and more:
-
Laravel Commands:
- Create a seeder:
scr "SeederName" - Create a controller:
ctcr "ControllerName" - Create a model with migration, controller, and resource:
mcr "ModelName" - Add a column via migration:
mmgc "column_name" "table_name"
- Create a seeder:
-
Git Utilities:
- Fetch changes:
gf - Commit with a message:
gcmsg "commit message" - Commit and push with a message:
gpmsg "commit message" - Push changes forcefully:
pf - Undo the last commit:
undocommit - Switch branches:
gsb "branch_name" - Switch and pull:
gsbp "branch_name" - Check the repository status:
gstat - View remotes:
grv - Get repository size:
gsp <owner/repo>
- Fetch changes:
The gsp function fetches and calculates the size of a GitHub repository:
function gsp() {
if [ -z "$1" ]; then
echo "Usage: gsp <owner/repo>"
return 1
fi
local repo=$1
if [ -z "$GITHUB_TOKEN" ]; then
echo "Error: GITHUB_TOKEN is not set. Please check your .env file."
return 1
fi
response=$(curl -s -H "Authorization: token $GITHUB_TOKEN" https://api.github.com/repos/$repo)
if echo "$response" | grep -q '"message": "Not Found"'; then
echo "Repository not found or you don't have access."
return 1
fi
size_kb=$(echo "$response" | grep '"size":' | awk '{print $2}' | tr -d ',')
size_mb=$(echo "scale=2; $size_kb / 1024" | bc)
size_gb=$(echo "scale=2; $size_mb / 1024" | bc)
echo "Repository Size for $repo:"
echo "- $size_kb KB"
echo "- $size_mb MB"
echo "- $size_gb GB"
}We welcome contributions to improve this repository! To contribute:
- Fork the repository.
- Create a new branch for your changes:
git checkout -b feature/your-feature
- Commit and push your changes:
git commit -m "Add your feature" git push origin feature/your-feature - Open a pull request.
This repository is licensed under the MIT License. Feel free to use, modify, and distribute the contents of this repository.
For any questions or suggestions, feel free to open an issue or reach out to me directly!
Enjoy customizing your shell! 🎉