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
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
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 June 30, 2022 13:38
Creating a Patches

Creating a Patch

Checking the diff

diff -Naur vendor/magento/module/original-file.php vendor/magento/module/modified-file.php

Creating a patch file

CSS Media queries in Magento 2

It’s highly unlikely that there are some frontend developers involved in a responsive website development who are not familiar with the concept of CSS Media queries. In this post, I’ll be looking at Magento 2 way of implementing this functionality in its default theme development workflow.

How do Magento 2 media queries work?

In the heart of Magento 2 media queries mechanism, defined in Magento UI library, is a .media-width() mixin.

.media-width(<@extremum>, <@break>);
@tiagosampaio
tiagosampaio / README.md
Last active January 2, 2023 16:18
List of Countries without a Postcode

List of Countries without a Postcode

Here is a list of countries that do not have postcodes. Yeah, not all the countries have postcodes. For more information, check the references in the end of this document.

  • Angola
  • Antigua and Barbuda
  • Aruba
  • Ascension island
  • Bahamas
  • Belize
@tiagosampaio
tiagosampaio / README.md
Last active January 11, 2023 23:47
This gist shows how to create custom loggers in Magento 2 in an easy way.

Creating a Custom Logger in Magento 2

We first need to create a virtual type for the custom log handler.

    <virtualType name="MyModule\CustomLogger\Log\Handler" type="Magento\Framework\Logger\Handler\Base">
        <arguments>
            <argument name="fileName" xsi:type="string">/var/log/my_custom_log.log</argument>
        </arguments>
    </virtualType>
@tiagosampaio
tiagosampaio / README.md
Last active January 18, 2023 13:55
Change Docker root directory /var/lib/docker to another location

Change Docker root directory /var/lib/docker to another location

By default, Docker stores most of its data inside the /var/lib/docker directory on Linux systems. There may come a time when you want to move this storage space to a new location. For example, the most obvious reason might be that you’re running out of disk space.

In this tutorial, we’ll show you how to change the storage directory for Docker to some other location on your Linux system. Most of the configuration that will need done is with systemd, and then moving the directory to a new location. Follow the step by step instructions below to get started.

In this tutorial you will learn:

  • How to edit systemd to accommodate new Docker location
  • How to move your Docker installation to a new location
@tiagosampaio
tiagosampaio / README.md
Created February 27, 2023 15:01
Breaking Linux files into pieces with the split command

Breaking Linux files into pieces with the split command

Some simple Linux commands allow you to break up files and reassemble them as needed in order to accommodate size restrictions on file size for storage or email attachments

image

Linux systems provide a very easy-to-use command for breaking files into pieces. This is something that you might need to do prior to uploading your files to some storage site that limits file sizes or emailing them as attachments. To split a file into pieces, you simply use the split command.

$ split bigfile
@tiagosampaio
tiagosampaio / iterm2.md
Created June 25, 2023 15:12 — forked from squarism/iterm2.md
An iTerm2 Cheatsheet

Tabs and Windows

Function Shortcut
New Tab + T
Close Tab or Window + W (same as many mac apps)
Go to Tab + Number Key (ie: ⌘2 is 2nd tab)
Go to Split Pane by Direction + Option + Arrow Key
Cycle iTerm Windows + backtick (true of all mac apps and works with desktops/mission control)
@tiagosampaio
tiagosampaio / Database Fix for AUTO_INCREMENT exceeds max value.md
Created February 15, 2024 15:16 — forked from JesKingDev/Database Fix for AUTO_INCREMENT exceeds max value.md
Data fix for the scenarios where gaps in a table's auto_increment result in the next value exceeding the max size of an INT. Specifically helps address the Magento Issue - AUTO_INCREMENT grows on every INSERT ... ON DUPLICATE on InnoDB tables #28387 ttps://github.com/magento/magento2/issues/28387

AUTO_INCREMENT grows on every INSERT ... ON DUPLICATE on InnoDB tables #28387

magento/magento2#28387

Symptom:

General system exception happened. SQLSTATE[22003]: Numeric value out of range: 167 Out of range value for column 'value_id' at row 1, query was: INSERT INTO catalog_product_entity_varchar (row_id,attribute_id,store_id,value) VALUES (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?), (