Skip to content

Instantly share code, notes, and snippets.

View Sekiphp's full-sized avatar

Luboš Hubáček Sekiphp

View GitHub Profile
1. git rebase --interactive HEAD~10
2. pick commit and replace `pick` for "child" commits to `s` (it means squash)
3. save & force push
@Sekiphp
Sekiphp / mysql-config
Created April 9, 2021 08:46
Mysql command in shell: settings put to ~/.my.cnf
[mysql]
host=
port=
user=
password=
database=
# check if upstream is configured
git remote -v
git fetch # pull ahead commits from remote
git fetch upstream
git merge upstream/branch_name
git push
git log -n 5
@Sekiphp
Sekiphp / Git Aliases
Created May 20, 2020 15:17
Git Aliases
git config --global alias.cm 'commit -m'
git config --global alias.st status
@Sekiphp
Sekiphp / Magento1 _websiteFilter callback on collection
Created September 2, 2019 15:28
Filtering on collection where is used method addWebsiteNamesToResult()
protected function _websiteFilter($collection, $column)
{
if (!$value = $column->getFilter()->getValue()) {
return $this;
}
$stores = Mage::app()->getWebsite($value)->getStores();
foreach ($stores as $store) {
$collection->addStoreFilter($store);
}
@Sekiphp
Sekiphp / Automatically start ssh-agent on Windows
Created July 23, 2019 13:18
This code add to your .bashrc file. It is working for multiple sessions. Edited code of GitHub example.
env=~/.ssh/agent.env
agent_load_env () { test -f "$env" && . "$env" >| /dev/null ; }
agent_start () {
echo "Starting new SSH agent"
(umask 077; ssh-agent >| "$env")
. "$env" >| /dev/null ;
}
@Sekiphp
Sekiphp / Magento cron lister
Created June 18, 2019 08:56
This script lists all Magento cronjobs by this command: # clear && php /shell/cron_lister.php
<?php
require_once __DIR__ . '/../abstract.php';
/**
* @see https://gist.github.com/werdan/5827225
*/
class Mage_Shell_CronLister extends Mage_Shell_Abstract
{
public function run()
@Sekiphp
Sekiphp / get-all-store-ids.txt
Created April 2, 2019 09:59
Magento 1 - get all active store IDS
$allStores = Mage::getModel('core/store')
->getCollection()
->addFieldToFilter('is_active', ['eq' => 1])
->getAllIds();
var_dump(implode(',', $allStores));
var sumAdd = 0;
var sumRemoved = 0;
jQuery('.lines-added').each(function() {
sumAdd += parseInt((jQuery(this).html()), 10);
});
jQuery('.lines-removed').each(function() {
sumRemoved += parseInt((jQuery(this).html()), 10);
});
console.log(sumAdd);
console.log(sumRemoved);
tail -n0 -f ../logs/error.log | sed 's/\\n/\n/g'