Skip to content

Instantly share code, notes, and snippets.

@atishgoswami
atishgoswami / .hyper.js
Last active September 29, 2022 05:08
Hyper Config File
"use strict";
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// choose either `'stable'` for receiving highly polished,
// or `'canary'` for less polished but more frequent updates
updateChannel: 'stable',
// default font size in pixels for all tabs
@atishgoswami
atishgoswami / custom-cron.md
Last active July 10, 2020 09:05
Adding a custom job using cron:install

To install/register magento cron jobs to crontab of our envirnoments we normally use php bin/magento cron:install, which ends up registering your cronjobs the system crontab

crontab -l

/var/www/html/bin/magento cron:run | grep -v "Ran jobs by schedule" >> /var/www/html/var/log/magento.cron.log
/var/www/html/update/cron.php >> /var/www/html/var/log/update.cron.log
/var/www/html/bin/magento setup:cron:run >> /var/www/html/var/log/setup.cron.log
@atishgoswami
atishgoswami / quick-logger.php
Created April 2, 2020 13:26
Quick Logging with Magento2
<?php
// FYI : This is just to implement quick logging
// for debugging purposes on local not fix
// for production level application logging
❌ // Don't Use Zend Logger
$logger = new \Zend\Log\Logger();
$logger->addWriter(new \Zend\Log\Writer\Stream(BP . '/var/log/test.log'));
$logger->info('Your text message');
@atishgoswami
atishgoswami / mysql_dump.sh
Created August 22, 2017 06:59
MySQL Dump exclude Tables
#!/bin/bash
PASSWORD=XXXXXX
HOST=XXXXXX
USER=XXXXXX
DATABASE=databasename
DB_FILE=dump.sql
EXCLUDED_TABLES=(
table1
table2
table3
@atishgoswami
atishgoswami / laravel.php
Created November 15, 2016 03:42
Laravel Query Logger
DB::listen(function($query){var_dump($query->sql)});
@atishgoswami
atishgoswami / credential-checker.sh
Created October 6, 2016 20:05
Magento2 Enterprise credential checker
curl -u [Public Key]:[Private Key] https://repo.magento.com/packages.json | grep --color="auto" "magento\\\\/product-enterprise-edition"
@atishgoswami
atishgoswami / .htaccess
Created January 6, 2016 13:25
Magento2 Profiler
#HTML Profile Output
SetEnv MAGE_PROFILER html
#CSV Profile Output
SetEnv MAGE_PROFILER csvfile
@atishgoswami
atishgoswami / env.php
Last active January 18, 2016 09:10
Magento2 DB Profiler
<?php
//app/etc/env.php
//Add following to default connection config array
[
'profiler' => [
'class' => '\Magento\Framework\DB\Profiler',
'enabled' => true,
],
]
@atishgoswami
atishgoswami / magento2-test.php
Last active March 5, 2023 20:41
Magento 2 Test App Page
<?php
use Magento\Framework\App\Bootstrap;
require __DIR__ . '../../../app/bootstrap.php';
class TestApp extends \Magento\Framework\App\Http implements \Magento\Framework\AppInterface
{
public function launch()
{
@atishgoswami
atishgoswami / mysql-backup.sh
Last active November 19, 2015 10:40
Backup all databases in MYSQL server
#!/bin/bash
USER="root"
PASSWORD="root"
OUTPUTDIR="backups"
echo "Deleting all files inside $OUTPUTDIR"
#rm "./$OUTPUTDIR/*" > /dev/null 2>&1
ExcludeDatabases="Database|(information|performance)_schema|mysql"