Skip to content

Instantly share code, notes, and snippets.

@zainengineer
zainengineer / mysql mariadb root password reset
Last active September 6, 2019 12:24
mysql mariadb root password reset
sudo mysql_secure_installation
#its sometimes enough
some time usual approach of passwords reset does not work
https://superuser.com/a/949768/366778
SELECT user, plugin FROM user;
UPDATE user SET plugin="";
@zainengineer
zainengineer / setup.sh
Last active July 3, 2019 06:29
drupal /magento digital ocean
#currently for drupal but can be easily be tested and improved for magento
apt-get install -y php-mbstring
apt-get install -y php-xmlwriter
apt-get install -y php-dom php-curl php-bz2
apt-get install -y zip unzip php7-zip
apt-get install -y zip unzip
apt-get install -y php-xml php-tidy
sudo service apache2 restart
<?php
/**
* InternalLog
*
*/
class InternalLog
{
const TIMER_ACTION_START = 1;
<global>
<session_save><![CDATA[db]]></session_save>
<cache>
<backend>database</backend>
</cache>
</global>
@zainengineer
zainengineer / composer
Created March 20, 2019 00:57
composer quickes
for private packages/magento modues consider using
"repositories": [
{"type":"artifact","url":"packages/"},
where packages/ has multiple zip files like vendor1_ext1.zip, vendor2_ext2.zip
and you just need to do composer require vendor1/ext1
composer will find in packages zipped files and get the required extensions
curl http://127.0.0.1 -H 'Host: example.com' -H 'X-Forwarded-Proto: https'
curl https://127.0.0.1/ -H 'Host: example.com' -H 'X-Forwarded-Proto: https' --insecure
curl http://httpbin.org/headers -H 'Host: httpbin.org' -H 'X-Forwarded-Proto: https'
//had NO EFFECT
$iStoreId = 9;
class_exists('\Kint',false) && (\Kint::$max_depth =3);
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
/** @var \Magento\Store\Model\StoreManagerInterface $storeManager */
$storeManager =$objectManager->create('\Magento\Store\Model\StoreManagerInterface');
//has NO EFFECT
$storeManager->setCurrentStore($iStoreId);
<?php
//n98-magerun2.phar dev:console
#useful for old multi-stock implementation for magento
#but can be skipped
$stockId = 7;
$storeId = 3;
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
@zainengineer
zainengineer / rsync_ruby.MD
Created February 17, 2017 06:44
vagrant rsync-auto ruby issues
@zainengineer
zainengineer / history.js
Last active February 16, 2017 11:27
youtube history remove bulk
#go to youtube history page and copy pate the javascript
#in history load videos roughly upto where you want to delete
#I use it so youtube does not suggest me nursery rhyms
removeHistory = function (){
this('.yt-uix-button-icon.yt-uix-button-icon-dismissal.yt-sprite').click();
window.setTimeout(function () {
this('.yt-uix-button-icon.yt-uix-button-icon-dismissal.yt-sprite').remove();
this('.yt-uix-button-icon.yt-uix-button-icon-dismissal.yt-sprite').scrollIntoView();
console.log('done');