sudo yum install zshRestart your terminal. Choose option 2 for Z Shell configuration.
Don't forget to migrate your previous configurations from.bashrcto.zshrc
sudo yum install zshRestart your terminal. Choose option 2 for Z Shell configuration.
Don't forget to migrate your previous configurations from.bashrcto.zshrc
| # Railscast | |
| http://railscasts.com/episodes/308-oh-my-zsh | |
| # Install Zsh | |
| sudo apt-get update && sudo apt-get install zsh | |
| # Install Oh-my-zsh | |
| wget –no-check-certificate https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O – | sh | |
| # Make ZSH default shell |
| # Create database owner | |
| createuser -U postgres --createdb --createrole ${DB_OWNER}; | |
| psql --dbname ${DB_NAME} -c "ALTER USER '${DB_OWNER}' WITH PASSWORD '${DB_OWNER_PASSWORD}';" | |
| # Create database | |
| createdb -U ${DB_OWNER} ${DB_NAME}; | |
| # List databases | |
| psql -U ${DB_OWNER} --list |
| # In case "docker rmi" displaying the following message : | |
| # Error response from daemon: conflict: unable to delete 599a1a74e98d (cannot be forced) - image has dependent child images | |
| IMAGE_ID=xxxx | |
| for i in $(docker images -q) | |
| do | |
| docker history $i | grep -q $IMAGE_ID && echo $i | |
| done | sort -u | |
| # Then "docker rmi" the resulted images |
| ./ansible.sh -i inventories/dev -c local -m template -a "src=file.j2 dest=file.txt" 127.0.0.1 | |
| # Online tool | |
| https://cryptic-cliffs-32040.herokuapp.com/ | |
| # https://stackoverflow.com/questions/35407822/how-can-i-test-jinja2-templates-in-ansible |
| # Script to switch between HTTP and SSH git remote URL | |
| gitswitch () { | |
| if [[ "$(git remote -v)" == "" ]] | |
| then | |
| echo "No remote configured. Use 'git remote add' to set one" | |
| return | |
| fi | |
| remoteRoot=$(git remote -v | head -1 | grep root) |
| # Adapted from <https://superuser.com/questions/332252/creating-and-formating-a-partition-using-a-bash-script> | |
| ( | |
| echo d # Delete sda2 partition table | |
| echo 2 # Default = sda2 | |
| echo n # Add a new sda2 partition | |
| echo p # Primary partition | |
| echo 2 # Partition number | |
| echo # First sector (Accept default: 2099200) | |
| echo # Last sector (Accept default: varies, e.g 104857599) |
| # Example : waiting for DB and Elasticsearch to be ready before launching a service | |
| # The svc docker image must contain the start-when-ready.sh script | |
| services: | |
| svc: | |
| image: svc | |
| environment: | |
| READINESS_CONDITION: '[ $$(curl --write-out %{http_code} --silent --output /dev/null http://elasticsearch:9200/_cat/health?h=st) = 200 ] && nc -w 1 -z $$DB_HOST $$DB_PORT 2>/dev/null' | |
| READINESS_SLEEP: 5 |
| --- | |
| - hosts: localhost | |
| vars: | |
| docker_machine_version: v0.14.0 | |
| tasks: | |
| - name: Install Docker Machine | |
| get_url: | |
| url: "https://github.com/docker/machine/releases/download/{{ docker_machine_version }}/docker-machine-linux-x86_64" |
| # List of top processes ordered by RAM and CPU use in descendant form | |
| ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem | head |