Some quick helper scripts that I use in Ubuntu; added in .bashrc
as aliases.
Updates the system packages, including Flatpak's and Snap's.
alias update='sudo apt update && sudo apt upgrade && sudo flatpak update && sudo snap refresh'
Cleans off various directories of temporary files and dependency accumulated update caches. Moreover, it does clean the system logs (keeping only the last 7 days') that could do accumulate size over time.
alias clean='sudo rm -rf /var/lib/snapd/cache/* && flatpak uninstall --unused && sudo rm -rf /tmp/* /var/tmp/* && sudo journalctl --vacuum-time=7d'
Attempts to recover from Gnome-Shell display manager (GDM) crashes... -Which usually fails anyway!
alias gdmres='sudo systemctl stop gdm3 && sudo systemctl restart display-manager && sudo systemctl start gdm3 && sudo loginctl terminate-user $(whoami) && sudo reboot now'
Dealing with Arabic strings.
Converts Arabic-to-Indian numerals and vice-versa.
Input:
aranum 1234
Output:
١٢٣٤
Strips away common Arabic tashkeel real quick.
Input:
arastrip "أَيُّ سَمَاءٍ تُظِلُّنِي ، أَوْ أَيُّ أَرْضٍ تُقِلُّنِي ، إِنْ أَنَا قُلْتُ فِي كِتابِ اللَّهِ مَا لَا أَعْلَمُ ؟"
Output:
أي سماء تظلني ، أو أي أرض تقلني ، إن أنا قلت في كتاب الله ما لا أعلم ؟
Resolves the situation of an accidental last push commit without checking for possible commits to pull them first; basically being stuck between pulling and pushing. And it works in 2 steps:
- Pulls in the latest changes from the correct remote repository.
- Rebases the local commits on top of those prior to keep the commit history clean.
alias oops='git pull --rebase origin $(git rev-parse --abbrev-ref HEAD)'
Removes files/folders from the cached version control, when they have been committed before.
alias girm='f() { git rm -r --cached "$1"; }; f'
Important
It obviously needs the correct path of a file/directory, passed as an argument, in order to be removed.
Stashes the current changes local changes properly; meaning that it's done including the untracked files. (New files that weren't committed from before!)
alias chest='git stash push -u'
Note
Who would have thought that this was not the default bahavior to git stash push
command, am I right?! (curbs furiousness)
When dealing with dev
-branch conflict resolving, this command eases out the default process by miles; since it accounts for the dev
branch to be the "source of truth" during the merging process.
alias grit='git merge -X theirs origin/dev'
Development - TALL Stack
Stands for composer dump-autoload
, which is a very common back-end packages stabalizer!
alias cda='composer dump-autoload'
The awesome shortcut for using Laravel's Artisan scripts runner.
alias art='php artisan'
Wipes out the current database content, using the art above.
alias wipe='php artisan db:wipe'
Cleans and migrates the database, using the art above.
alias fresh='php artisan migrate:fresh'
Stands for migrate-fresh and seed; bascially, doing the wipe and fresh together.
alias mfs='php artisan migrate:fresh --seed'
A shortcut for running optimize:clear
, which is another art to quickly clear all possible caching techniques in Laravel; ensuring there is no Cache driver failure that results "stuck" files and stuff!
alias opt='php artisan optimize:clear'
Quickly spins up ViteJS watcher to keep track of front-end asset changes; depending on your configuration file.
alias dev='bun run dev'
Another quick art to start listening and capturing Laravel's dumps, dies and logs within the terminal.
alias pail='php artisan pail'
Runs a Laravel's Queues worker real quick.
alias que='php artisan queue:work'
Executes a huge amount of processes regarding testing the TALL app, including:
- Formatting Laravel Blade files, via the superb, yet unofficial, Laravel Blade Formatter.
- Formatting CSS/JS files using Prettier.
- Formatting PHP files, using Laravel's official: Pint.
- Performing static-analysis over PHP files using Larastan.
- Running PestPHP for powerful and expressive PHP testing; in parallel mode, and while logging the results to a [phpunit.results.xml] file.
alias pest='f() { bunx blade-formatter --write "resources/views/**/*.blade.php"; bunx prettier --write "resources/js/**/*.js" "resources/css/**/*.css"; ./vendor/bin/pint; ./vendor/bin/phpstan; ./vendor/bin/pest "$1" --parallel --processes=8 --log-junit phpunit.results.xml; }; f'
Note
Possible pest
arguments can be passed to the command as well.
Calls Testbench's Artisan script that is used for simulating a Laravel environment and test packages.
alias bench='f() { ./vendor/bin/testbench "$1"; }; f'
It's just a shortcut to run lara-stacker CLI, in order to manage simultaneous development of TALL stack apps on Linux.
alias lara='cd /home/goodm4ven/Code/Scripts/lara-stacker && sudo ./lara-stacker.sh'
Typing codium
is much harder than just code
, where the latter is the official VSC's by default, sadly...
alias code='f() { codium "$1"; }; f'
Since I'm still on team-VSC, techincally, building VSIX packages is quite usual for me, hence the command.
alias vsix='bun install && vsce package'
- // TODO A command for "clearing" TALL apps
- // TODO A command for logging in the PHPUnit results log using Bash
- // TODO Adding it to the
pest
command, and running it right after the tests. - // TODO Meaning separating it to a full Bash script file
- // TODO Adding it to the
- // TODO A command to pull in and display a random aya, plus its transcriptive aathar
- // TODO A command to pull in and display a random hadeeth, plus its English translation
Support ongoing package maintenance as well as the development of other projects through sponsorship or one-time donations if you prefer.
And may Allah accept your strive; aameen.
This package is open-sourced software licensed under the MIT license.
- ChatGPT
- TALL Stack's Entire Community
- GNOME
- Ubuntu
- Linux
والحمد لله رب العالمين