Created
October 23, 2024 19:39
-
-
Save lorens-osman-dev/4095ca0b1e26423b725bd9817f1f34d0 to your computer and use it in GitHub Desktop.
Manage your favorite terminal commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#--------|[ Useful Commands ]|--------# | |
function useful_commands() { | |
# You need to export $commands_file so it can be accessible inside the preview shell | |
# Or use the full path instead of the variable | |
declare -x commands_file="${HOME}/lorens_linux_config/zsh/usefull_commands.txt" | |
header="CommandsList" | |
fzf_cool=( | |
--reverse | |
--pointer="➜" | |
--info=inline-right | |
--height 40% | |
--no-separator | |
--preview-window=down,20%,wrap | |
--color='dark,hl:red:regular,fg+:white:regular,hl+:red:regular:reverse,query:white:regular,info:#cb4b16,prompt:#dd4814:bold,pointer:#dd4814:bold' | |
) | |
case "$1" in | |
file) echo "Commands List file path is: $commands_file" && gnome-text-editor -i "$commands_file" ;; | |
add) echo "Commands List file path is: $commands_file" && gnome-text-editor "$commands_file" ;; | |
*) | |
selected_command=$(grep -v '^$' "$commands_file"| grep -v '^#'| sed -e 's/^[ \t]*//' | grep -v '^\*\*' | fzf "${fzf_cool[@]}" \ | |
--preview fzf --preview 'echo -e "\033[32m$(grep -xF -B1 {} "${commands_file}" | sed "s/^**//"| head -1)\033[0m"') | |
# the original --preview is :--preview 'grep -xF -B1 {} "${commands_file}" | sed "s/^**//"| head -1' ) | |
print -z $selected_command | |
;; | |
esac | |
} | |
alias uc="useful_commands" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# the lines that start with "#" and empty lines will ignored | |
# the lines that start with "**" is command's explanation and must be before the actual command | |
**Create VUE/VITE project with NPM in current folder | |
npm create vite@latest . | |
**Create VUE/VITE project with BUN in current folder | |
BUN create vite@latest . | |
*****#**install .deb file | |
sudo apt install ./path | |
**completely ignore all current changes and go back to last commit | |
git reset --hard HEAD | |
** generate assets from resources folder | |
npx capacitor-assets generate --android | |
**command to list and search all installed packages | |
apt list --installed 2>/dev/null | awk -F/ '{print $1}' | fzf | sed -e 's/^[ \t]*//' | |
**command to remove the apps using fzf , one app at the time | |
apt list --installed | awk -F/ '{print $1}' | fzf | xargs -I {} sudo apt remove {} -y | |
**command to remove the apps using fzf , multi apps , to select app press SHIFT | |
apt list --installed | awk -F/ '{print $1}' | fzf -m| xargs -I {} sudo apt remove {} -y | |
**remove any orphaned dependencies that were no longer needed after the main package was removed | |
sudo apt autoremove | |
**Mount google drive using ocamlFuse | |
google-drive-ocamlfuse /home/lorens/Documents/gObsidian | |
**command to know where starship bin filles installed | |
which starship | |
**make nested waylans session | |
dbus-run-session -- gnome-shell --nested --wayland | |
# mongoDB | |
**Start monogoDB server process (start | status | stop | restart ) // postgresql.service | |
sudo systemctl start mongod | |
**another way to Start postgresql server process (start | status | stop | restart ) // mongod | |
service postgresql start | |
**PORT pid number to kill / kill -9 <pid> | |
lsof -i :3000 | |
** generate random strings in node / node -> enter -> the command -> enter | |
require("crypto").randomBytes(64).toString("hex") | |
** watch ff.scss file and output ff.css file from it | |
sass -w ./ff.scss ./ff.css | |
** For loop | |
for file in *.woff2; do woff2_decompress "$file"; done | |
** vs code as root | |
sudo code --user-data-dir=/home/lorens/Pictures/background/ --no-sandbox | |
** ubuntu firewall | |
sudo ufw show rules | |
**default version that nvm will use automatically when you open a new termina | |
nvm alias default 18.18.2 | |
**root for vs code | |
sudo chown -R $(whoami) /usr/share/code | |
**static code analysis tool for detecting code and best practice violations in Vue.js | |
bunx vue-mess-detector analyze |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment