Skip to content

Instantly share code, notes, and snippets.

View jalogut's full-sized avatar

Juan Alonso jalogut

View GitHub Profile
@jalogut
jalogut / tmux-cheatsheet.markdown
Created April 30, 2020 14:00 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@jalogut
jalogut / docker_space_cheat_sheet.md
Last active April 11, 2023 15:50
Cheat sheet to check disk usage on docker. Identify what takes most of your space

Total disk size configuration (Mac)

ls -klsh ~/Library/Containers/com.docker.docker/Data/vms/0/Docker.raw

Total disk usage (Mac)

du -h ~/Library/Containers/com.docker.docker/Data/vms/0/Docker.raw
@jalogut
jalogut / iterm2.sh
Created November 8, 2018 15:45
Execute bash command in a new window of iterm2
#!/bin/bash
#set -x
COMMAND=$@
osascript -e 'tell application "iTerm2"' \
-e 'create window with default profile command "bash -c \"echo " & "'"${COMMAND}"'" & " && " & "'"${COMMAND}"'" & " && read || read \""' \
-e 'end tell'
@jalogut
jalogut / magento2-deployer-plus-jenkinsfile.groovy
Last active June 8, 2018 14:12
magento2-deployer-plus Jenkinsfild pipeline
node {
// Clean workspace before doing anything
deleteDir()
def hostStage
def deployStatus
try {
stage ('Preparations') {
if (BRANCH_NAME == 'develop') {
@jalogut
jalogut / nginx-magento2-multiwebsite.conf
Last active April 4, 2018 12:44
Set up multiple websites or stores with nginx
map $http_host $MAGE_RUN_CODE {
hostnames; # indicates that values can be hostnames with prefix or suffix mask.
default base;
*.ch ch;
*.de de;
*.at at;
}
server {
@jalogut
jalogut / di.xml
Created March 18, 2018 13:01
Fix eavSetup in Compiled mode
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<!-- We create our own virtual class because original Magento\Setup\Module\DataSetup cannot be instantiated when compilation enabled. -->
<virtualType name="Vendor\Module\Setup\Module\DataSetup" type="Magento\Setup\Module\DataSetup">
<arguments>
<argument name="context" xsi:type="object">Magento\Framework\Module\Setup\Context</argument>
</arguments>
</virtualType>
<virtualType name="Vendor\Module\Eav\Setup\EavSetup" type="Magento\Eav\Setup\EavSetup">
<arguments>
<argument name="setup" xsi:type="object">Vendor\Module\Setup\Module\DataSetup</argument>
@jalogut
jalogut / .my.cnf
Last active March 15, 2018 12:16
Mysql ~/.my.cnf to fix MYSQL has gone away issue
[mysqld]
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
# https://expressionengine.com/blog/mysql-5.7-server-os-x-has-gone-away
interactive_timeout = 300
wait_timeout = 300
# https://github.com/Homebrew/legacy-homebrew/issues/47335
table_open_cache = 250
@jalogut
jalogut / External Tools.xml
Last active September 21, 2018 08:49
PHPStorm External Tools for Magento 2 (~/Library/Preferences/<product name><version number>/tools/External\ Tools.xml)
<!-- Local Setups -->
<toolSet name="External Tools">
<tool name="mg2 clear cache" showInMainMenu="true" showInEditor="false" showInProject="false" showInSearchPopup="false" disabled="false" useConsole="true" showConsoleOnStdOut="false" showConsoleOnStdErr="false" synchronizeAfterRun="false">
<exec>
<option name="COMMAND" value="bin/magento" />
<option name="PARAMETERS" value="cache:clean" />
<option name="WORKING_DIRECTORY" value="$ProjectFileDir$/magento" />
</exec>
</tool>
<tool name="mg2 generation flush" description="Flushs generated code like factories and proxies" showInMainMenu="true" showInEditor="false" showInProject="false" showInSearchPopup="false" disabled="false" useConsole="true" showConsoleOnStdOut="false" showConsoleOnStdErr="false" synchronizeAfterRun="true">
@jalogut
jalogut / magento2-config-dump-skip-system.xml
Last active September 27, 2018 15:37
Magento 2 skip dumping the whole core_config_data when using app:config:dump
<!-- module.xml -->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
<module name="VendorName_ModuleName" setup_version="0.0.1" >
<sequence>
<module name="Magento_Config"/>
</sequence>
</module>
</config>
<!-- di.xml -->
@jalogut
jalogut / magento2-config-dump-only-specific.php
Last active March 1, 2020 21:41
Magento 2 code to dump only specific system settings when executing app:config:dump
// module.xml
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
<module name="VendorName_ModuleName" setup_version="0.0.1" >
<sequence>
<module name="Magento_Config"/>
</sequence>
</module>
</config>
// di.xml