Skip to content

Instantly share code, notes, and snippets.

View Sekiphp's full-sized avatar

Luboš Hubáček Sekiphp

View GitHub Profile
@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 / 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 / Git Aliases
Created May 20, 2020 15:17
Git Aliases
git config --global alias.cm 'commit -m'
git config --global alias.st status
# 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 / mysql-config
Created April 9, 2021 08:46
Mysql command in shell: settings put to ~/.my.cnf
[mysql]
host=
port=
user=
password=
database=
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 / Fix changes in submodule (-dirty commits)
Created May 18, 2022 10:45
Fix changes in submodule (-dirty commits)
cd submodule
git reset --hard HEAD
git clean -fd .
cd ..
git submodule update --init --recursive
# GIT bash integration
if [[ -e /usr/lib/git-core/git-sh-prompt ]]; then
source /usr/lib/git-core/git-sh-prompt
export GIT_PS1_SHOWCOLORHINTS=true
export GIT_PS1_SHOWDIRTYSTATE=true
export GIT_PS1_SHOWUNTRACKEDFILES=true
export GIT_PS1_SHOWUPSTREAM="auto"
@Sekiphp
Sekiphp / change_git_remotes.sh
Last active December 13, 2022 16:18
Mass change of git remotes for more repositories in same folder. Can be used for Magento 2 repositories located in app/code/Namespace/
#!/bin/bash
clear
prefix=""
ls -d */ | while read -r folder;
do
cd "$folder"
echo "Before:"
git config --global push.default current