Skip to content

Instantly share code, notes, and snippets.

View Sekiphp's full-sized avatar

Luboš Hubáček Sekiphp

View GitHub Profile
@Sekiphp
Sekiphp / gist:33ae83e0713dd95cefc90c076cff73da
Created September 3, 2018 12:52
GIT: Number of changed rows
git diff --stat HEAD
@Sekiphp
Sekiphp / update_repo.sh
Last active September 27, 2018 08:27
Cleanup of remote developer repository
#!/bin/bash
clear
git fetch
git reset --hard
git checkout master
git checkout -- .
git clean -fd .
rm -rf media
git pull
git config --list
git remote -v
git remote set-url origin https://_LOGIN_@bitbucket.org/_PATH/TO/REPOSITORY_.git
$ git remote -v
$ git remote set-url origin https://login@bitbucket.org/organization/repository
@Sekiphp
Sekiphp / gist:e82bf56427af6bd2106796d2d0f9a994
Created November 23, 2018 15:11
Count of lines in current dir
find . -type f | xargs cat | wc -l
tail -n0 -f ../logs/error.log | sed 's/\\n/\n/g'
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);
@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));
User@DESKTOP-QSKO7HF MINGW64 /c/useful-scripts (master)
$ echo "alias gch=/c/useful-scripts/git/commit_helper.sh" >> ~/.bashrc
$ echo "alias gbu=/c/useful-scripts/git/branch_update.sh" >> ~/.bashrc
$ echo "alias gbc=/c/useful-scripts/git/branch_create.sh" >> ~/.bashrc
$ echo "alias gcb=/c/useful-scripts/git/branch_create.sh" >> ~/.bashrc
User@DESKTOP-QSKO7HF MINGW64 /c/useful-scripts (master)
$ cat ~/.bashrc
alias gch=/c/useful-scripts/git/commit_helper.sh
alias gbu=/c/useful-scripts/git/branch_update.sh
@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 ;
}