Skip to content

Instantly share code, notes, and snippets.

@yoeunes
Created August 5, 2020 08:04
Show Gist options
  • Save yoeunes/74641ed3886cbfd0082113fe1d5f21fe to your computer and use it in GitHub Desktop.
Save yoeunes/74641ed3886cbfd0082113fe1d5f21fe to your computer and use it in GitHub Desktop.
# Easier navigation: .., ..., ...., ....., ~ and -
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
alias ~="cd ~" # `cd` is probably faster to type though
alias -- -="cd -"
# Shortcuts
alias dropbox="cd ~/Documents/Dropbox"
alias downloads="cd ~/Downloads"
alias desktop="cd ~/Desktop"
alias projects="cd ~/projects"
alias yoeunes="cd ~/projects/yoeunes"
alias smile="cd ~/projects/smile"
alias sensiolabs="cd ~/projects/sensiolabs"
alias others="cd ~/projects/others"
alias solidaires="cd ~/projects/smile/ca-solidaires"
alias drmsuite="cd ~/projects/sensiolabs/drmsuite"
alias boyacars="cd ~/projects/yoeunes/boyacars"
alias elkenzi="cd ~/projects/elkenzi"
alias rentimo="cd ~/projects/elkenzi/rentimo"
alias apittp="cd ~/projects/elkenzi/tamtam/apittp"
alias home="cd ~/projects/elkenzi/tamtam/home"
alias api="cd ~/projects/elkenzi/tamtam/apittp/src/TTP/ApiBundle"
alias blog="cd ~/projects/elkenzi/tamtam/apittp/src/TTP/BlogBundle"
alias event="cd ~/projects/elkenzi/tamtam/apittp/src/TTP/EventBundle"
alias mailer="cd ~/projects/elkenzi/tamtam/apittp/src/TTP/MailerBundle"
alias mailing="cd ~/projects/elkenzi/tamtam/apittp/src/TTP/MailingBundle"
alias payment="cd ~/projects/elkenzi/tamtam/apittp/src/TTP/PaymentBundle"
alias rbac="cd ~/projects/elkenzi/tamtam/apittp/src/TTP/RbacBundle"
alias survey="cd ~/projects/elkenzi/tamtam/apittp/src/TTP/SurveyBundle"
alias talk="cd ~/projects/elkenzi/tamtam/apittp/src/TTP/TalkBundle"
alias wtb="cd ~/projects/elkenzi/tamtam/apittp/src/TTP/WtbBundle"
alias media="cd ~/projects/elkenzi/tamtam/apittp/src/TTP/MediaBundle"
alias billing="cd ~/projects/elkenzi/tamtam/apittp/src/TTP/BillingBundle"
alias membership="cd ~/projects/elkenzi/tamtam/apittp/src/TTP/MembershipBundle"
alias data="cd ~/projects/elkenzi/tamtam/apittp/src/TTP/DataBundle"
# Print each PATH entry on a separate line
alias path='echo -e ${PATH//:/\\n}'
# IP addresses
alias ip="dig +short myip.opendns.com @resolver1.opendns.com"
alias localip="ipconfig getifaddr en0"
alias ips="ifconfig -a | grep -o 'inet6\? \(addr:\)\?\s\?\(\(\([0-9]\+\.\)\{3\}[0-9]\+\)\|[a-fA-F0-9:]\+\)' | awk '{ sub(/inet6? (addr:)? ?/, \"\"); print }'"
# Show active network interfaces
alias ifactive="ifconfig | pcregrep -M -o '^[^\t:]+:([^\n]|\n\t)*status: active'"
# Intuitive map function
# For example, to list all directories that contain a certain file:
# find . -name .gitattributes | map dirname
alias map="xargs -n1"
# One of @janmoesen’s ProTip™s
for method in GET HEAD POST PUT DELETE TRACE OPTIONS; do
alias "${method}"="lwp-request -m '${method}'"
done
# Reload the shell (i.e. invoke as a login shell)
alias reload="exec ${SHELL} -l"
alias artisan="php artisan"
alias getweb="wget --recursive --no-clobber --page-requisites --html-extension --convert-links --no-parent"
alias hist="clear && history | sed 's/.[ ]*.[0-9]*.[ ]*//' | sort -u | uniq"
alias histg="clear && history | sed 's/.[ ]*.[0-9]*.[ ]*//' | sort -u | uniq | grep -i"
alias aliases='atom -a ~/.zshrc'
alias save_aliases='source ~/.zshrc'
alias gitatom='git config --global rerere.enabled 1; git config --add rebase.instructionFormat "(%an <%ae>) %s"; git config --global core.editor "atom --wait"'
alias gitnano='git config --global core.editor "nano"'
alias hostfile="sudo subl /etc/hosts"
alias clears="printf '\33c\e[3J'"
alias dsu='bin/console doctrine:schema:update'
alias nah='git reset --hard;git clean -df'
alias pbcopy='xclip -selection clipboard'
alias pbpaste='xclip -selection clipboard -o'
alias copyssh="pbcopy < $HOME/.ssh/id_rsa.pub"
alias reloadcli="source $HOME/.zshrc"
alias lxc='sudo lxc'
alias cdeploy='sudo cdeploy'
alias scopy="rsync -avz -P -e 'ssh'"
alias wip="git add .;git commit -am 'wip'"
alias preview="fzf --preview 'bat --color \"always\" {}'"
alias cat='bat'
alias top="sudo htop"
alias tldr="tldr"
alias help='tldr'
alias runphp='psysh'
alias please='fuck'
alias subinit='git submodule update --init --recursive'
alias subnah="git submodule foreach --recursive 'git reset --hard;git clean -df || :'"
alias subcheckout='git submodule foreach --recursive git checkout'
alias subpull='git submodule foreach --recursive git pull origin'
alias subfetch='git submodule foreach --recursive git fetch'
alias substatus='git submodule foreach --recursive git status'
alias phpunit='[ -f ./vendor/bin/simple-phpunit ] && ./vendor/bin/simple-phpunit || ./vendor/bin/phpunit'
alias phpcs="[ -f ./vendor/bin/phpcs ] && ./vendor/bin/phpcs || phpcs"
alias phpcbf="[ -f ./vendor/bin/phpcbf ] && ./vendor/bin/phpcbf || phpcbf"
alias rector="[ -f ./vendor/bin/rector ] && ./vendor/bin/rector || rector"
# URL-encode strings
alias urlencode='python -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1]);"'
# Merge PDF files, preserving hyperlinks
# Usage: `mergepdf input{1,2,3}.pdf`
alias mergepdf='gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=_merged.pdf'
alias deltadocker='docker-compose -f docker-compose-yoeunes.yml'
export EDITOR='vim';
export SSH_KEY_PATH="~/.ssh/rsa_id"
export SYMFONY_DEBUG=true
export DELTA_RM_MEMCACHED_PORT=127.0.0.1
export LC_ALL='en_US.UTF-8'
export LANG='en_US.UTF-8'
export PATH="$HOME/bin:$PATH"
export PATH="$HOME/.composer/vendor/bin:$PATH"
export PATH="/usr/local/bin:$PATH"
export PATH="/opt/firefox/firefox:$PATH"
export PATH="$HOME/.symfony/bin:$PATH"
export PATH="./vendor/bin:$PATH"
export PATH="/home/linuxbrew/.linuxbrew/bin:$PATH"
export MANPATH="/home/linuxbrew/.linuxbrew/share/man:$MANPATH"
export INFOPATH="/home/linuxbrew/.linuxbrew/share/info:$INFOPATH"
#export CATALINA_HOME="/opt/tomcat/current"
#export JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64"
#export JRE_HOME="/usr/lib/jvm/java-11-openjdk-amd64"
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
function clone() {
( hub clone $1 $1 )
}
function listening() {
if [ $# -eq 0 ]; then
sudo lsof -iTCP -sTCP:LISTEN -n -P
elif [ $# -eq 1 ]; then
sudo lsof -iTCP -sTCP:LISTEN -n -P | grep -i --color $1
else
echo "Usage: listening [pattern]"
fi
}
function datesync() {
sudo service ntp stop && sudo ntpd -gq && sudo service ntp start
}
dsf() { git diff --no-index --color "$@" | diff-so-fancy; }
function signmycommits() {
git filter-branch --commit-filter 'if [ "$GIT_COMMITTER_EMAIL" = "younes.khoubza@smile-maroc.com" ];
then git commit-tree -S "$@";
else git commit-tree "$@";
fi' HEAD
}
function gitusername() {
username=$1
email=$2
git config --global user.name "$username"
git config --global user.email "$email"
if [ ! -d .git ]; then
return 1
fi;
git config user.name "$username"
git config user.email "$email"
if [[ $(git submodule status) ]]; then
git submodule foreach --recursive git config user.name "$username"
git submodule foreach --recursive git config user.email "$email"
fi
}
alias gityoeunes='gitusername "Khoubza Younes" "younes.khoubza@smile-maroc.com"'
alias gitelkenzi='gitusername "Mohamed Amine EL KENZI" "elkenziamine@gmail.com"'
alias storageprod='rsync -r --info=progress2 --stats --ignore-existing -a -h -e "ssh -i ~/.ssh/prod-server.pem" ec2-user@api2.tamtam.pro:/home/ec2-user/plateforme/api/storage ~/projects/elkenzi/tamtam/apittp/web'
alias storageuat='rsync -r --info=progress2 --stats --ignore-existing -a -h -e "ssh -i ~/.ssh/uat-server.pem" ec2-user@uat2.api.tamtam.pro:/home/ec2-user/plateforme/api/storage ~/projects/elkenzi/tamtam/apittp/web'
alias storagedev='rsync -r --info=progress2 --stats --ignore-existing -a -h -e "ssh -i ~/.ssh/dev-server.pem" ec2-user@dev2.api.tamtam.pro:/home/ec2-user/plateforme/api/storage ~/projects/elkenzi/tamtam/apittp/web'
alias ciprod='git commit --allow-empty -m "[ci:base=splitup-prod] and [ci:env=prod]"'
alias ciuat='git commit --allow-empty -m "[ci:base=splitup-uat] and [ci:env=uat]"'
alias cidev='git commit --allow-empty -m "[ci:base=splitup] and [ci:env=develop]"'
alias circ='git commit --allow-empty -m "[ci:base=rc] and [ci:env=rc]"'
alias sshprod='ssh -i ~/.ssh/prod-server.pem ec2-user@52.16.83.192'
alias sshdev='ssh -i ~/.ssh/dev-server.pem ec2-user@dev2.api.tamtam.pro'
alias sshuat='ssh -i ~/.ssh/uat-server.pem ec2-user@uat2.api.tamtam.pro'
alias sshrc='ssh -i ~/.ssh/rc-server.pem ec2-user@rc.api.tamtam.pro'
# source ~/antigen.zsh
# source ~/.antigenrc
# bindkey '^[[A' history-substring-search-up
# bindkey '^[[B' history-substring-search-down
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
export ZSH=$HOME/.oh-my-zsh
ZSH_THEME="amuse"
#ZSH_THEME="typewritten"
#ZSH_THEME="spaceship"
#ZSH_THEME="miloshadzic"
# ZSH_THEME="robbyrussell"
if ! [ -d "${ZSH_CUSTOM:=~/.oh-my-zsh/custom}/plugins/zsh-completions" ]; then
git clone https://github.com/zsh-users/zsh-completions ${ZSH_CUSTOM:=~/.oh-my-zsh/custom}/plugins/zsh-completions
fi
if ! [ -d "${ZSH_CUSTOM:=~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions" ]; then
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
fi
if ! [ -d "${ZSH_CUSTOM:=~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting" ]; then
git clone https://github.com/zsh-users/zsh-syntax-highlighting ${ZSH_CUSTOM:=~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
fi
if ! [ -d "${ZSH_CUSTOM:=~/.oh-my-zsh/custom}/plugins/zsh-history-substring-search" ]; then
git clone https://github.com/zsh-users/zsh-history-substring-search ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-history-substring-search
fi
plugins=(
git
ssh-agent
zsh-completions
zsh-autosuggestions
zsh-syntax-highlighting
history-substring-search
colored-man-pages
fzf
git-prompt
gpg-agent
symfony
docker
docker-compose
)
source $ZSH/oh-my-zsh.sh
#bindkey '^[[A' history-substring-search-up
#bindkey '^[[B' history-substring-search-down
autoload -U compinit && compinit
# source ~/.deployer_completion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment