Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion aliases
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ alias rdc='rails db:create'
alias rdm='rails db:migrate'

# rails db:seed
alias rds='rails db:seed'
# alias rds='rails db:seed'


# rails db:seed db:create db:migrate
Expand Down Expand Up @@ -275,3 +275,11 @@ function vnc() {
#$ print -rl -- $TMP
#=>cat
# question code snippet : #read -q "REPLY?Enter COMMIT?"

# Development Server Aliases
alias rds="$HOME/code/AzCez/dotfiles/scripts/rds.sh" # Start both Rails and Vite servers
alias crs="$HOME/code/AzCez/dotfiles/scripts/crs.sh" # Check server status
alias krs="$HOME/code/AzCez/dotfiles/scripts/krs.sh" # Kill Rails server only
alias kvs="$HOME/code/AzCez/dotfiles/scripts/kvs.sh" # Kill Vite server only
alias rvs="$HOME/code/AzCez/dotfiles/scripts/rvs.sh" # Start just Vite server
alias kas="$HOME/code/AzCez/dotfiles/scripts/kas.sh" # Kill all servers
285 changes: 285 additions & 0 deletions aliases.backup
Original file line number Diff line number Diff line change
@@ -0,0 +1,285 @@
# ----
# Custom aliases
# Rails + npm workflow: see ./dev.sh and README-dev.md for full docs
# Key commands: dev (both), devs (status), devk (stop)
# ----
#
# Get External IP / local IPs
alias ip="curl ipinfo.io/ip"
alias ips="ifconfig -a | perl -nle'/(\d+\.\d+\.\d+\.\d+)/ && print $1'"
alias speedtest="wget -O /dev/null http://speedtest.wdc01.softlayer.com/downloads/test10.zip"





#Python


# Quickly serve the current directory as HTTP
alias serve='ruby -run -e httpd . -p 8000' # Or python -m SimpleHTTPServer :)

#pyton vitual env activated Le Wagon
alias penv='pyenv activate lewagon'

#open jupyter notebook
alias jnote='jupyter notebook'


#kill port processes
alias kp='npx kill-port' #<PortNumber>

#List running server
alias wsr='lsof -nP +c 15 | grep LISTEN'

# Server port 3000
alias s3='rails s'

# Server port 4000
alias s4='rails s -p 4000'

# Server port 5000
alias s5='rails s -p 5000'

# Server port 6000
alias s6='rails s -p 6000' s

# Server port 7000
alias s7='rails s -p 7000'

# Server port 8000
alias s8='rails s -p 8000'


# Rails + npm Development Aliases
# Make sure dev.sh is executable: chmod +x dev.sh

# Development script aliases
alias dev-rails='./dev.sh rails'
alias dev-npm='./dev.sh npm'
alias dev-both='./dev.sh both'
alias dev-build='./dev.sh build'
alias dev-watch='./dev.sh watch'
alias dev-stop='./dev.sh stop'
alias dev-status='./dev.sh status'

# Quick development shortcuts
alias dev='./dev.sh both' # Start both Rails and npm watch
alias devs='./dev.sh status' # Show status
alias devk='./dev.sh stop' # Kill all processes

# Enhanced Rails server aliases (building on your existing ones)
alias s3dev='RAILS_PORT=3000 ./dev.sh rails'
alias s4dev='RAILS_PORT=4000 ./dev.sh rails'
alias s5dev='RAILS_PORT=5000 ./dev.sh rails'

# Enhanced npm aliases
alias npm-dev='./dev.sh npm'
alias npm-build='./dev.sh build'
alias npm-watch='./dev.sh watch'


# Webpack compile
alias wpc='webpack-dev-server'

#open ngrok
Alias ngrok='./ngrok'

# Rails/Vite server management (moved from zshrc to keep upstream zshrc clean)
# Note: we keep existing `rds` for rails db:seed; do not reuse that name here.
alias krs="echo 'Killing Rails server...' && pkill -f 'rails server' 2>/dev/null && echo '✅ Rails server killed' || echo 'ℹ️ Rails server not running'"
alias kvs="echo 'Killing Vite server on port 3036...' && (lsof -ti:3036 | xargs kill -9 2>/dev/null || true); pkill -f 'vite' 2>/dev/null; pkill -f 'npm exec vite' 2>/dev/null; echo '✅ Vite server killed'"
alias crs="echo '=== SERVER STATUS CHECK ==='; echo; if lsof -i :3000 >/dev/null 2>&1; then echo '✅ Rails (3000): running (PID '$(lsof -ti :3000 | head -1)')'; else echo '❌ Rails (3000): not running'; fi; echo; if lsof -i :3036 >/dev/null 2>&1; then echo '✅ Vite (3036): running (PID '$(lsof -ti :3036 | head -1)')'; else echo '❌ Vite (3036): not running'; fi; echo; echo 'URLs:'; echo ' Rails: http://localhost:3000'; echo ' Vite: http://localhost:3036'"
alias rvs="npx vite --port 3037"

# Ruby

alias ru='ruby cd \"${fileDirname}\"\u000D'


# RoR



# rails db:drop
alias rdd='rails db:drop'

# rails db:create
alias rdc='rails db:create'

# rails db:migrate
alias rdm='rails db:migrate'

# rails db:seed
# alias rds='rails db:seed'


# rails db:seed db:create db:migrate
alias rdb='rdd rdc rdm'


#Push your code to Heroku
alias gph='git push heroku master'

alias hpass='git push chateaupass master'
alias hdm='heroku run rails db:migrate --app chateaupass'
alias hrc='heroku run rails c --app chateaupass'
alias hlogs='heroku logs --tail --app chateaupass'


# GIT

# remove .git
alias rmgit='rm -rf .git'

#git create repo + ignore DS_Store
alias repo='git init; hub create -p; find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch;echo .DS_Store >> .gitignore;git add .gitignore;git commit -m ".DS_Store banished!";git push origin master; ga; comthis "first push on repo"; gor'

#git generic commit
alias nocom='ga;comthis "generic commit either for test purpose or just lasy...";gor'

#git ignore DS_Store
alias ds=' find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch;echo .DS_Store >> .gitignore;git add .gitignore;git commit -m ".DS_Store banished!";git push --set-upstream origin $(git rev-parse --abbrev-ref HEAD)'


# one-line git log with 24h date+time
alias lo="git log --abbrev-commit --pretty=format:'%h %ad %s' --date=format-local:'%Y-%m-%d %H:%M'"


#git remote remove origin
alias grr='git remote remove origin'

#git log --oneline
#alias com='git log --oneline'
#or
alias com='git lg'

# git fetch
alias gf='git fetch'

# git pull
alias gp='git pull'

# git fetch then pull
alias gfp='gf; gp'

# git add .
alias ga='git add .'

#git commit -m ....
alias comthis='git commit -m'

#Git add/status/commit with question prompt in terminal
function gcom() {
git add .
gst
read REPLY\?"Type commit => "
print ""
print ">> commit is: \"${REPLY}\""
print ""
git commit -m "${REPLY}"
}

#Git add/status/commit/push with question prompt in terminal
function cg() {
git add .
gst
read REPLY\?"Type commit => "
print ""
print ">> commit is: \"${REPLY}\""
print ""
git commit -m "${REPLY}"
git push --set-upstream origin $(git rev-parse --abbrev-ref HEAD)
print ""
print ">> Git STATUS after commit and push origin:"
print ""
gst
}

# git status then git add . then git status
function gsa() {
gst
ga
gst
}


#git checkout master
alias gcm='git checkout main'

#git checkout branch
alias gcb='git checkout'

# git push origin
alias gpo='git push origin'

#git push origin ....
alias gor='git push --set-upstream origin $(git rev-parse --abbrev-ref HEAD)'

#reset git ignore

alias resig='git rm -r --cached .; git add .; git commit -m "fixed untracked files"; gst'


#LOCAL
# 11. Reload shortcut
alias reload='source ~/.zshrc' # one-word command to re-source your config

# Show alias file content in terminal
alias al='cat /Users/ces/code/AzCez/dotfiles/aliases'

# Open your dotfiles in VS Code with:
alias dotfiles='code /Users/ces/code/AzCez/dotfiles'

# open in visual studio
alias vsc='open . -a "Visual Studio Code"'

# go to Local to CODE folder
alias codef='cd /Users/ces/code'


# go to code folder in cloud
alias icloud='cd /Users/ces/Library/Mobile\ Documents/com~apple~CloudDocs'

# go to mobeetravel folder in cloud
alias mt='cd /Users/ces/Library/Mobile\ Documents/com~apple~CloudDocs/code/Mobeetravel'

# 1. Open files or folders in the Cursor IDE
# c() { open -a "Cursor" "$@"; } # defines `c` to launch the Cursor app with given file/dir

#ZSH test

function vnc() {
open vnc://"$USER"@"$1"
}
function question() {
git add .
gst
read REPLY\?"Type commit =>"
print ""
print ">> commit is: ${REPLY}"
print ""
git commit -m "${REPLY}"
}








#ZSH Interpolation
#TMP=" hello ${:-=cat}"
#$ TMP="${:-=cat}"
#$ print -rl -- $TMP
#=>cat
# question code snippet : #read -q "REPLY?Enter COMMIT?"

# Development Server Aliases
alias rds="$HOME/code/AzCez/dotfiles/scripts/rds.sh" # Start both Rails and Vite servers
alias crs="$HOME/code/AzCez/dotfiles/scripts/crs.sh" # Check server status
alias krs="echo "Killing Rails server on port 3000..." && lsof -ti:3000 | xargs kill -9 2>/dev/null; pkill -f "rails" 2>/dev/null; pkill -f "puma" 2>/dev/null; pkill -f "bundle exec rails" 2>/dev/null; echo "✅ Rails server killed"" # Kill Rails server only
alias kvs="echo "Killing Vite server on port 3036..." && lsof -ti:3036 | xargs kill -9 2>/dev/null; pkill -f "vite" 2>/dev/null; pkill -f "npm exec vite" 2>/dev/null; echo "✅ Vite server killed"" # Kill Vite server only
alias rvs="$HOME/code/AzCez/dotfiles/scripts/rvs.sh" # Start just Vite server
alias kas="$HOME/code/AzCez/dotfiles/scripts/kas.sh" # Kill all servers
58 changes: 58 additions & 0 deletions scripts/crs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/bin/bash
echo "=== SERVER STATUS CHECK ==="
echo ""

# Check Rails server
RAILS_RUNNING=false
if lsof -i :3000 >/dev/null 2>&1; then
PID=$(lsof -ti :3000 | head -1)
echo "✅ Rails server (port 3000): Running locally on IPv4 & IPv6 (localhost only). PID $PID."
RAILS_RUNNING=true
else
echo "❌ Rails server (port 3000): Not running"
fi

echo ""

# Check Vite server
VITE_RUNNING=false
if lsof -i :3036 >/dev/null 2>&1; then
PID=$(lsof -ti :3036 | head -1)
echo "✅ Vite dev server (port 3036): Running and listening on all interfaces (*). PID $PID."
VITE_RUNNING=true
else
echo "❌ Vite dev server (port 3036): Not running"
fi

echo ""
echo "Related processes:"

# Check for npm exec vite
NPM_PID=$(ps aux | grep "npm exec vite" | grep -v grep | awk '{print $2}' | head -1)
if [ ! -z "$NPM_PID" ]; then
echo " 📦 npm exec vite helper, PID $NPM_PID."
fi

# Check for ruby_lsp_rails
RUBY_PID=$(ps aux | grep "ruby_lsp_rails" | grep -v grep | awk '{print $2}' | head -1)
if [ ! -z "$RUBY_PID" ]; then
echo " 🔧 ruby_lsp_rails language server, PID $RUBY_PID."
fi

echo ""
echo "🌐 Access URLs:"
if [ "$RAILS_RUNNING" = true ]; then
echo " Rails: http://localhost:3000"
fi
if [ "$VITE_RUNNING" = true ]; then
echo " Vite: http://localhost:3036"
fi

echo ""
echo "🔧 Management commands:"
echo " rds # Start both Rails and Vite servers"
echo " crs # Check server status (this command)"
echo " krs # Kill Rails server only"
echo " kvs # Kill Vite server only"
echo " rvs # Start just Vite server"
echo " kas # Kill all servers"
27 changes: 27 additions & 0 deletions scripts/kas.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash
echo "🛑 Killing all development servers..."
echo ""

echo "Stopping Rails server (port 3000)..."
lsof -ti:3000 | xargs kill -9 2>/dev/null
pkill -f "rails" 2>/dev/null
pkill -f "puma" 2>/dev/null
pkill -f "bundle exec rails" 2>/dev/null

echo "Stopping Vite server (port 3036)..."
lsof -ti:3036 | xargs kill -9 2>/dev/null
pkill -f "vite" 2>/dev/null
pkill -f "npm exec vite" 2>/dev/null

sleep 1

echo ""
echo "✅ All servers killed!"
echo ""
echo "🔧 Management commands:"
echo " rds # Start both Rails and Vite servers"
echo " crs # Check server status"
echo " krs # Kill Rails server only"
echo " kvs # Kill Vite server only"
echo " rvs # Start just Vite server"
echo " kas # Kill all servers (this command)"
Loading