Skip to content

Instantly share code, notes, and snippets.

View jcastellanos926's full-sized avatar

Jesús Castellanos jcastellanos926

View GitHub Profile
@jcastellanos926
jcastellanos926 / config_bashrc.md
Last active April 8, 2019 15:16
How to create a config.d folder for SSH connections

Create a config.d folder for SSH connections

Prerequisites:

  • ssh version > 7.3

How to know ssh installed version:

  • Execute: $ ssh -V

Configure SSH to use includes from ~/.ssh/config.d directory

@jcastellanos926
jcastellanos926 / install-deb-packages.md
Last active March 18, 2019 17:40
How to install .deb packages from the terminal

Install .deb packages from terminal:

$ sudo dpkg -i <path/to/deb.deb>
$ sudo apt-get install -f
@jcastellanos926
jcastellanos926 / how_to_install_docker.md
Last active March 23, 2019 17:07
How to Install Docker

Although we can install Docker and Docker Compose from the official Ubuntu repositories, they are several minor versions behind the latest release. So, we'll install Docker following the official documentation page (https://docs.docker.com/install/linux/docker-ce/ubuntu/).

Installation steps of Docker CE:

# Uninstall old versions
$ sudo apt-get remove docker docker-engine docker.io containerd runc
@jcastellanos926
jcastellanos926 / generate_new_ed25519_key.md
Last active March 18, 2019 17:39
How to generate a new Ed25519 key

Generate a new Ed25519 key

$ ssh-keygen -o -a 100 -t ed25519
Generating public/private ed25519 key pair.
Enter file in which to save the key (/home/caste/.ssh/id_ed25519):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/gert/.ssh/id_ed25519.
Your public key has been saved in /home/gert/.ssh/id_ed25519.pub.
@jcastellanos926
jcastellanos926 / switch_php_versions.md
Created March 18, 2019 17:38
How to switch between PHP versions on ubuntu

swich-php-version

[linux] How to swich php version

  • Switch php7.1 to php5.6:

    • Apache: sudo a2dismod php7.1 ; sudo a2enmod php5.6 ; sudo service apache2 restart ;
    • CLI: sudo update-alternatives --set php /usr/bin/php5.6 ;
  • Switch php5.6 to php7.1:

@jcastellanos926
jcastellanos926 / tmux_install.md
Last active April 8, 2019 22:13
How to install the latest version of tmux (Installation script)

Tmux installation bash script

#!/usr/bin/env bash

sudo apt update

sudo apt-get install -y git automake build-essential pkg-config libevent-dev libncurses5-dev

git clone https://github.com/tmux/tmux.git /tmp/tmux
@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

@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 / 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 / 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' {} \;