Skip to content

Instantly share code, notes, and snippets.

@programgames
Last active November 5, 2021 13:35
Show Gist options
  • Save programgames/8bb6253bd83aed2089bff4b26dc80fca to your computer and use it in GitHub Desktop.
Save programgames/8bb6253bd83aed2089bff4b26dc80fca to your computer and use it in GitHub Desktop.
My current dev stack 05/02/2021

Current MAC OS dev stack :

Softwares :

  1. PhpStorm : https://www.jetbrains.com/fr-fr/phpstorm/?rss
  2. Google chrome : https://www.google.com/intl/fr_fr/chrome/
  3. Lepton : https://www.electronjs.org/apps/lepton
  4. Slack : https://slack.com/intl/fr-fr/
  5. TeamViewer : https://www.teamviewer.com/fr/
  6. Java 11 ( For ES ) : https://medium.com/w-logs/installing-java-11-on-macos-with-homebrew-7f73c1e9fadf
  7. Kibana 7.10.1 : https://www.elastic.co/guide/en/kibana/current/brew.html
  8. ElasticSearch 7.10.1 : https://www.elastic.co/guide/en/kibana/current/brew.html
  9. Postgres 9.6 : https://apple.stackexchange.com/questions/304024/how-do-you-install-an-older-version-of-postgres-9-6-using-homebrew
  10. Mailcatcher (Need ruby) : https://mailcatcher.me/
  11. NPM 6.12.1 : https://blog.teamtreehouse.com/install-node-js-npm-mac
  12. NodeJs v12.13.1 https://github.com/nvm-sh/nvm
  13. RabbitMQ 3.8.9 : https://www.rabbitmq.com/install-homebrew.html
  14. ChromeDriver 87.0.4280.88 ( brew cask install chromedriver)
  15. Xdebug v3.0.2 : https://xdebug.org/docs/install

Bash aliases :

# shellcheck shell=sh
#Prompt commands
export PS1="_____________________________\n| \w \n| => "
export PS2="| => "

#Paths
PATH="$HOME/.config/composer/vendor/bin:$PATH"
export PATH="/usr/local/bin:$PATH"
export PATH="/usr/local/opt/ruby/bin:$PATH"
export PATH="/usr/local/sbin:$PATH"
export PATH="/Users/julien/PhpstormProjects/orodev/bin:$PATH"
export JAVA_8_HOME=$(/usr/libexec/java_home -v1.8)
export JAVA_11_HOME=$(/usr/libexec/java_home -v11)
export PATH="/usr/local/opt/postgresql@9.6/bin:$PATH"
alias java8='export JAVA_HOME=$JAVA_8_HOME'
alias java11='export JAVA_HOME=$JAVA_11_HOME'
java11
export PATH=$JAVA_HOME/bin:$PATH
export EDITOR=/usr/bin/nano
export PATH="/usr/local/opt/php@7.4/sbin:$PATH"
export PATH="/usr/local/opt/php@7.3/sbin:$PATH"
export PATH="/usr/local/opt/php@8.0/sbin:$PATH"
export PATH="/usr/local/opt/php@7.2/sbin:$PATH"
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
#Fonctions
function changePhpTo(){
version=`php -v | grep ^PHP | cut -d' ' -f2 | cut -c 1-3`
brew unlink php@$variable
brew link php@$0
}
function changexdebugscript() {

  cat << "EOF"
                           _      _
                          | |    | |
                  __  ____| | ___| |__  _   _  __ _
                  \ \/ / _` |/ _ \ '_ \| | | |/ _` |
                   >  < (_| |  __/ |_) | |_| | (_| |
                  /_/\_\__,_|\___|_.__/ \__,_|\__, |
                                               __/ |
                                              |___/
EOF
    php=$(php -v | tail -r | tail -n 1 | cut -d " " -f 2 | cut -c 1-3)
    if grep -R ";\+zend_extension" /usr/local/etc/php/"$php"/conf.d/ext-xdebug.ini
        then
            echo "Activation de xDebug pour PHP "$php
            sed -i -e "s/;zend_extension/zend_extension/g" /usr/local/etc/php/"$php"/conf.d/ext-xdebug.ini
        else
            echo "Désactivation de xDebug pour PHP "$php
            sed -i -e "s/zend_extension/;zend_extension/g" /usr/local/etc/php/"$php"/conf.d/ext-xdebug.ini
    fi
}
function openxdebugconfig() {
    php=$(php -v | tail -r | tail -n 1 | cut -d " " -f 2 | cut -c 1-3)
    phpstorm /usr/local/etc/php/"$php"/conf.d/ext-xdebug.ini
}
function changepcovscript() {
    php=$(php -v | tail -r | tail -n 1 | cut -d " " -f 2 | cut -c 1-3)
    if grep -R ";\+zend_extension" /usr/local/etc/php/"$php"/conf.d/ext-xdebug.ini
        then
            echo "Activation de xDebug pour PHP "$php
            sed -i -e "s/;extension="pcov.so"/g" /usr/local/etc/php/"$php"/conf.d/ext-xdebug.ini
        else
            echo "Désactivation de xDebug pour PHP "$php
            sed -i -e "s/extension="pcov.so"/;extension="pcov.so"/g" /usr/local/etc/php/"$php"/conf.d/ext-xdebug.ini
    fi
}

function poulefunction() {
    cat << "EOF"
                ██        ██
              ██▒▒██    ██▒▒██
            ██▒▒▒▒▒▒████▒▒▒▒▒▒██
        ▓▓████▒▒▒▒▒▒▓▓▒▒▒▒▒▒▒▒▓▓██
      ▓▓▒▒▒▒██▒▒▒▒██████▒▒▒▒▒▒▒▒▓▓
      ██▒▒▒▒▒▒▒▒██▒▒▒▒▒▒██▒▒▒▒▒▒██
    ▓▓████▒▒▒▒██▒▒░░▒▒░░▒▒████▒▒██
    ██▒▒▒▒▒▒██▒▒░░░░░░░░░░░░░░████
    ██████████▒▒██░░▒▒░░░░░░░░░░██
  ██░░░░░░██▒▒░░░░░░░░░░░░░░░░░░░░██
██░░░░░░░░██▒▒░░▒▒░░▒▒░░░░░░░░░░░░██
  ██░░░░░░██▒▒▒▒░░░░░░░░░░░░░░░░░░░░██
    ████░░██▒▒▒▒░░░░░░░░░░░░░░░░░░░░░░██
        ████▒▒▒▒░░▒▒░░░░░░░░░░░░░░░░░░██
          ██▒▒▒▒░░░░░░░░░░░░░░░░░░░░░░██
            ██▒▒▒▒░░▒▒░░░░░░░░░░░░░░░░░░██
            ██▒▒░░░░░░░░░░░░░░░░░░▒▒░░░░██
            ██▒▒░░▒▒░░░░░░▒▒░░░░░░░░▒▒░░▒▒▒▒                                  ▓▓
            ██▒▒▒▒░░▒▒░░░░░░▒▒░░░░░░░░▒▒░░░░▓▓██                            ▓▓░░██
            ██▒▒▒▒░░░░▒▒░░░░▒▒▒▒░░░░▒▒██▒▒▒▒░░░░██                        ██░░░░██
              ██▒▒░░░░░░▒▒░░▒▒██▒▒░░▒▒██████▒▒▒▒▒▒██                    ██░░░░░░██
              ██▒▒▒▒░░░░▒▒░░▒▒██▒▒░░▒▒██░░░░██████░░██████          ████░░░░░░██
            ▓▓▒▒▒▒▓▓▒▒▒▒▓▓▒▒▒▒██▓▓▒▒▒▒██░░░░▒▒░░▓▓░░▓▓▓▓▒▒░░▓▓▓▓░░▓▓▓▓▒▒░░░░▓▓██▓▓
            ██▒▒▓▓██▒▒▓▓██▒▒▒▒██▒▒▓▓▒▒██░░▓▓▓▓▓▓████▓▓██▓▓░░░░░░▒▒░░░░░░░░░░░░░░▒▒▓▓
            ██▓▓▒▒██▒▒██▒▒▓▓▒▒██░░▒▒▓▓░░▓▓▓▓▓▓▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░▓▓░░
          ▓▓▒▒▒▒░░▒▒▓▓▒▒░░▒▒██▒▒░░░░▒▒▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▒▒▓▓░░░░░░░░░░░░░░░░██
          ██░░░░░░░░▒▒░░░░░░▒▒░░░░░░░░██▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██░░░░░░░░░░░░▓▓▓▓
          ██░░░░░░░░░░░░░░░░░░░░░░░░░░██▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██░░░░░░░░░░░░░░▓▓
          ██░░░░░░░░░░░░░░░░░░░░░░░░░░░░██▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██░░░░░░░░░░░░░░██
            ██░░░░░░░░░░░░░░░░░░░░░░░░░░██▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓██░░░░░░░░░░██
            ██░░░░░░░░░░░░░░░░░░░░░░░░░░██▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▓▓████░░░░░░░░░░██
            ██░░░░░░░░░░░░░░░░░░░░░░░░░░██▓▓▓▓▓▓████▓▓▓▓▒▒▓▓▓▓██░░░░░░░░██
            ██░░░░░░░░░░░░░░░░░░░░░░░░░░░░██▓▓▓▓██░░██▓▓▓▓████░░░░░░▒▒░░██
            ▒▒▓▓░░░░░░░░░░░░░░░░░░░░░░░░░░░░████░░░░░░████░░░░░░░░░░░░░░██
              ██░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██
                ██░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██
                ██░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██
                  ████░░░░░░░░░░░░░░░░░░░░██░░░░░░░░░░░░░░░░░░░░░░██
                    ██░░░░░░░░░░░░░░░░░░░░░░██░░░░░░░░░░░░░░░░░░██
                      ████░░░░░░░░░░░░░░░░░░░░██░░░░░░░░░░░░░░██
                        ██░░░░░░░░░░░░░░░░░░░░░░██░░░░░░██████
                          ██████████░░░░░░░░░░░░░░██░░██
                            ██░░██  ████████████████████
                        ██████░░██                ██░░██
                      ██░░░░░░░░░░██          ██████░░██
                        ████░░░░██░░▓▓      ██░░░░░░░░░░██
                        ██▒▒██░░██▓▓          ████░░░░██░░▓▓
                        ██████░░██            ██░░██░░████
                              ██              ██████░░██
                                                    ██

EOF
git pull
}
#Alias generals
alias comparecomposer='composer-lock-diff.js'
alias cd..='cd ../'                         # Go back 1 directory level (for fast typers)
alias ..='cd ../'                           # Go back 1 directory level
alias ...='cd ../../'                       # Go back 2 directory levels
alias .3='cd ../../../'                     # Go back 3 directory levels
alias .4='cd ../../../../'                  # Go back 4 directory levels
alias .5='cd ../../../../../'               # Go back 5 directory levels
alias .6='cd ../../../../../../'            # Go back 6 directory levels
alias f='open -a Finder ./'                 # f:            Opens current directory in MacOS Finder
alias ~="cd ~"                              # ~:            Go Home
alias issou='kill -9'
alias ls='ls -GFh'

#Alias Oro
alias workflow='sf oro:workflow:definitions:load'
alias updateoro='git pull && composer install && cache && update && sf ca:wa && sf ca:wa --env=prod'
alias c='chromedriver --url-base=wd/hub --port=4444'
alias behatinstall='bin/console oro:install  --drop-database --user-name=admin --user-email=admin@example.com  \
   --application-url=http://localhost:8010 --user-firstname=John --user-lastname=Doe \
   --user-password=admin  --organization-name=ORO --env=prod --sample-data=n --timeout=3000 \
   --formatting-code=en --language=en'
alias b='bin/behat'
alias bs='bin/behat --step-through'
alias fix='bin/php-cs-fixer fix'
alias dev0='ssh kiboko@dev0.kiboko.io'
alias dev1='ssh kiboko@dev1.kiboko.io'
alias data='bin/console oro:migration:data:load'
alias migrations='sf oro:migration:load --force --timeout=0'
alias update='sf oro:platform:update --force'
alias lightupdate='sf oro:platform:update --force --skip-search-reindexation --skip-download-translations --skip-translations --skip-assets'
alias install='composer install;rm -rf var/cache/*;bin/console oro:install --env=dev --timeout=0 --drop-database'
alias installprod='bin/console oro:install --env=prod --timeout=0 --drop-database'
alias bf='blackfire run'
alias v="php -v"
alias assets='sf asset:install && bin/console oro:asset:build'
alias watch='sf asset:install --symlink && bin/console oro:asset:build --watch'
alias symlink='php bin/console oro:assets:install  --symlink'
alias cache='rm -rf var/cache'
alias dev='python --mwebbrowser http://127.0.0.1:8000/index_dev.php/'
alias editalias='/Users/julien/phpstorm1 ~/.bash_profile && source ~/.bash_profile'
alias phpstorm='/Users/julien/phpstorm1'
alias mq='bin/console oro:message-queue:consume'
alias oro='./oro.sh'
alias run='sf server:run'
alias sf='php bin/console'
alias start='bin/console server:start'
alias stop='bin/console server:stop'
alias up='docker-compose up'
alias websocket='sf gos:websocket:server'
alias xdebug=changexdebugscript
alias pcov=changepcovscript
alias installtest='bin/console oro:install --env=test --organization-name=Oro --user-name=admin --user-email=admin@example.com --user-firstname=John --user-lastname=Doe --user-password=admin --sample-data=n --application-url=http://localhost --language=en_US --formatting-code=en_US --timeout=0'
alias trans='sf oro:translation:load --languages=en --languages=fr --rebuild-cache && sf oro:translation:dump && bin/console oro:localization:dump'

alias fixassets='cd vendor/oro/platform/build && nvm use v12 && npm rebuild node-sass && .4 && composer install && assets'
alias k='orodev kill'
alias stopcontainers='docker stop $(docker ps -a -q)'
alias mdp='bin/console oro:user:update admin --user-password admin'
alias poule=poulefunction
export PATH="/usr/local/opt/elasticsearch@6/bin:$PATH"
export PATH="/usr/local/opt/elasticsearch-full/bin:$PATH"
alias s="bin/satellite build"
alias loadenv='export $(cat .env)'
alias sourcebash='source ~/.bash_profile'
function cleanbehat() {
DB_PATTERN=".*behatdb.*"
PGUSER="julien"
PGPASSWORD=""
DBS="$(psql -U $PGUSER -l)"
for db in $DBS; do

if [[ "$db" =~ $DB_PATTERN ]]; then
    echo "Deleting $db"
    dropdb $db
fi

done
}
alias cleanbehatdatabases=cleanbehat
export PATH="/usr/local/opt/postgresql@12/bin:$PATH"
alias back='open -a "Google Chrome" http://localhost:8000/index_dev.php/admin'
alias front='open -a "Google Chrome" http://localhost:8000/index_dev.php'
if command -v pyenv 1>/dev/null 2>&1; then
  eval "$(pyenv init -)"
fi
alias tmetric='open -a "Google Chrome" https://app.tmetric.com/#/tracker/29825/'
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"
if [ -n "$PS1" -a -n "$BASH_VERSION" ]; then source ~/.bashrc; fi
eval "$(pyenv init -)"
alias 7.2=changeto7.2
function changeto7.2 {
brew unlink php
brew unlink php@7.4
brew unlink php@7.3
brew link php@7.2
}
alias 7.4=changeto7.4
function changeto7.4 {
brew unlink php
brew unlink php@7.2
brew unlink php@7.3
brew link php@7.4
}
alias 8=8.0
alias 8.0=changeto8.0
function changeto8.0 {
brew unlink php@7.4
brew unlink php@7.2
brew unlink php@7.3
brew link php
}
alias 7.3=changeto7.3
function changeto7.3 {
brew unlink php@7.4
brew unlink php@7.2
brew unlink php
brew link php@7.3
}
alias compose=composer
alias 1='composer self-update --1'
alias 2='composer self-update --2'
alias phpstan4='phpstan analyse -l 4'
alias phpstan7='phpstan analyse -l 7'
nvm use v12
alias changexdebugconfig=openxdebugconfig
alias cafe='echo "☕☕☕☕☕☕☕☕☕☕☕☕☕" && sf ca:wa'
alias 12='brew unlink postgresql@9.6 && brew link postgresql@12 && brew services stop postgresql@9.6 && brew services start postgresql@12 && psql --version'
alias 9.6='brew unlink postgresql@12 && brew link postgresql@9.6 && brew services stop postgresql@12 && brew services start postgresql@9.6 && psql --version'

if [[ $(find "/home/$USER/.aws/credentials" -mmin +59 -print) ]]; then

gimme-aws-creds --username <prenom.nom>

fi

Somes commands :

Front-end :

Reload asset js translations

  • sf asset:install && bin/console oro:asset:build
  • sf oro:translation:load --languages=en --languages=fr --rebuild-cache
  • sf oro:translation:dump && bin/console oro:localization:dump

Load a javascript file

  • sf asset:install && bin/console oro:asset:build
  • sf oro:requirejs:build

Use translations key in javascript :

  • sf asset:install && bin/console oro:asset:build && bin/console oro:translation:load --languages=en --languages=fr --rebuild-cache
  • sf oro:translation:dump && bin/console oro:localization:dump

Apply Javascript routes

  • sf fos:js-routing:dump
  • sf oro:requirejs:build

Fix assets

  • cd vendor/oro/platform/build && nvm use v12 && npm rebuild node-sass && .4 && composer install && assets

Back-end

Migrations

  • sf oro:migration:load --force --timeout=0
  • sf oro:migration:data:load

Create installer :

  • sf doctrine:cache:clear-metadata
  • sf doctrine:cache:clear-query
  • sf doctrine:cache:clear-result
  • sf doctrine:cache:clear-metadata
  • sf doctrine:schema:update --dump-sql
  • sf doctrine:schema:update --force
  • sf oro:migration:dump --bundle AppBundle > src/AppBundle/Migrations/Schema/AppBundleInstaller.php

Config

Restore a dump using psql :

  • psql -U user -d bdd -1 -f file.sql

Change password oro :

  • php bin/console oro:user:update admin --user-password admin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment