Skip to content

Instantly share code, notes, and snippets.

View jcastellanos926's full-sized avatar

Jesús Castellanos jcastellanos926

View GitHub Profile
@jcastellanos926
jcastellanos926 / get_container_ip_address.md
Last active November 24, 2020 00:05
How to Get A Docker Container IP Address
@jcastellanos926
jcastellanos926 / stop-containers.md
Created November 21, 2020 17:19
STOP ALL DOCKER CONTAINERS

How to STOP ALL docker containers

docker stop $(docker ps -q)
@jcastellanos926
jcastellanos926 / git_aliases.md
Last active September 24, 2020 11:01
Git Aliases

Git aliases

Run the following commands in order to create some git aliases for our projects.

$ git config --global alias.co checkout
$ git config --global alias.br branch
$ git config --global alias.ci commit
$ git config --global alias.st status
@jcastellanos926
jcastellanos926 / bash_aliases.md
Last active September 24, 2020 11:04
Bash aliases

How to create .bash_aliases file

In order to keep ~/.bashrc file as clean as possible, we'll put our aliases into ~/.bash_aliases file. In some linux distributions, .bash_aliases file comes by default and it's already created. So first, let's check it out ~/.bashrc file and look for the following lines.

# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
@jcastellanos926
jcastellanos926 / tmux-cheatsheet.markdown
Last active September 24, 2020 10:44 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

Tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@jcastellanos926
jcastellanos926 / upgrading_magento_version.md
Last active September 24, 2020 10:44
Upgrading Magento 2 version

How to upgrade Magento 2 version

Its good to take a backup before doing any update

mysqldump -hdb -uroot -p magento > storm_yyyymmdd.sql

Make sure if you have any third party extension that is compatible with the latest version of magento 2 or download it and update it for the same.

@jcastellanos926
jcastellanos926 / replace-string-multiple-files.md
Last active September 24, 2020 11:02
Replace a string in multiple files

Replace a string in multiple files

Case sensitive:

find ./ -type f -exec sed -i 's/string1/string2/g' {} \;

Case insensitive:

find ./ -type f -exec sed -i 's/string1/string2/gI' {} \;
@jcastellanos926
jcastellanos926 / Handles.md
Last active September 24, 2020 11:06
M2: Get Handles

Print Magento 2 handles (Just for testing purposes)

protected $resultPageFactory;

public function __construct(
    Context $context,
    \Magento\Framework\View\Result\PageFactory $resultPageFactory
)
{
@jcastellanos926
jcastellanos926 / tar_files.md
Last active January 22, 2020 17:15
Tar files

Extract Files

tar -xvf file.tar
tar -xzvf file.tar.gz
tar -xjvf file.tar.bz2
tar -xf file.tar.xz

Note: you need xz-utils package for xz files

@jcastellanos926
jcastellanos926 / tmux_command_guide.md
Last active April 8, 2019 22:14
Tmux - Command Guide

Tmux - Command Guide

Non-interactive commands

$ tmux: Open a new session

$ tmux ls: List tmux sessions

$ tmux a: Attach the last session