Skip to content

Instantly share code, notes, and snippets.

View tiagosampaio's full-sized avatar
🎯
Focusing

Tiago Sampaio tiagosampaio

🎯
Focusing
View GitHub Profile
@tiagosampaio
tiagosampaio / README.md
Created February 7, 2022 17:14
Compressing Magento 2 Media Directory

Compressing Magento 2 Media Directory

Let's say you have something like this on your media structure.

pub/
|-- errors
|-- media
|   |-- catalog
| | |-- category
@tiagosampaio
tiagosampaio / README.md
Last active February 2, 2022 11:40
Managing Your SSH Keys

Managing Your SSH Keys

Here are some examples of how you can manage your SSH Keys.

Generating SSH Keys

The possible algorithms you can use to generate SSH keys are:

  • dsa
@tiagosampaio
tiagosampaio / README.md
Last active January 24, 2022 17:27
Setup Source Guardian for PHP

Setup Source Guardian for PHP

Run the following commands to install SourceGuardian Loader

PHP 7.2

sudo su
mkdir /usr/local/sourceguardian
cd /usr/local/sourceguardian
@tiagosampaio
tiagosampaio / README.md
Created January 7, 2022 23:41
Upgrade Your SSH Key to Ed25519

Upgrade Your SSH Key to Ed25519

If you’re a DevOps engineer or a web developer, there’s a good chance that you’re already familiar and using the SSH key authentication on a daily basis. Whether it’s for logging into the remote server or when pushing your commit to the remote repository. It provides us with better security than the traditional password-based authentication.

But, when is the last time you created or upgraded your SSH key? And did you use the latest recommended public-key algorithm? If it was more than five years ago and you generated your SSH key with the default options, you probably ended up using RSA algorithm with key-size less than 2048 bits long.

Check Available SSH Keys on Your Computer

To check all available SSH keys on your computer, run the following command on your terminal:

Remove DEFINER clause from MySQL Dumps

sed -i 's/DEFINER=[^*]*\*/\*/g' mydump.sql

In macOS:

sed -i '' 's/DEFINER=[^*]*\*/\*/g' mydump.sql
@tiagosampaio
tiagosampaio / README.md
Last active May 22, 2024 20:05
MySQL: Operations Cheat Sheet

MySQL Operations Cheat Sheet

Making backup all databases:

mysqldump -u user -p --all-databases > dump.sql

Making backup only one database:

@tiagosampaio
tiagosampaio / difference.md
Last active February 13, 2024 15:28
PHP: Ternary Operator vs Null Coalescing Operator

Ternary Operator vs Null Coalescing Operator in PHP

?: (Elvis Operator)

The elvis operator (?:) is actually a name used for shorthand ternary (which was introduced in PHP 5.3). It has the following syntax:

// PHP 5.3+
expr1 ?: expr2;
@tiagosampaio
tiagosampaio / README.md
Created March 3, 2021 13:46 — forked from leek/_Magento2_DeleteTestData.md
Magento 2 - Delete All Test Data

These set of scripts are for Magento 2. For Magento 1, see this Gist.

@tiagosampaio
tiagosampaio / destroy.sh
Last active August 2, 2020 23:34
Valet+ Destroy
#!/usr/bin/env bash
#styles
VP_NONE='\033[00m'
VP_RED='\033[01;31m'
VP_GREEN='\033[01;32m'
VP_YELLOW='\033[01;33m'
VP_PURPLE='\033[01;35m'
VP_CYAN='\033[01;36m'
VP_WHITE='\033[01;37m'
@tiagosampaio
tiagosampaio / starulm.md
Created January 23, 2019 16:11 — forked from DrYazid/starulm.md
StarUml 3.0 full version

StarUML 3.0

  • 1- install staruml. : staruml
  • 2- install node.js : node.js
  • 3- go to ...\AppData\Local\Programs\StarUML\resources
  • 4- open CMD As admin
  • 5- execute