3.1 KiB
3.1 KiB
FAQ
Scripting
Search all duplicate file recursively in given directory
find . -type f -printf '%p/ %f\n' | sort -k2 | uniq -f1 --all-repeated=separate
Search all duplicate directory recursively in given directory
find . -type d -printf '%p/ %f\n' | sort -k2 | uniq -f1 --all-repeated=separate
Networking
Show all open port
sudo lsof -i -P -n | grep LISTEN
or
sudo netstat -lpnt | grep LISTEN
or
sudo ss -lpnt | grep LISTEN
Git
Configuration
Prefer to use Vim when editing?
git config --global core.editor "vim"
Prefer to use Meld when resolving conflit?
git config --global merge.tool meld
Prefer to us Meld to show difference?
git config --global diff.tool meld
git config --global difftool.prompt false
Retroactively applying format code to existing branches
Adapt this command to your situation, this is an example:
git rebase --strategy-option=theirs --exec 'cd ../../ && ./script/maintenance/black.sh ./addons/ERPLibre_erplibre_theme_addons/website_snippet_all/ && cd - && git add --all && git commit --amend --no-edit' HEAD~47
Unshallow git
By example, the repo Odoo use a depth clone. If you need all the clone repo, use this command on right directory:
git fetch REMOTE --unshallow
Amend several commits in Git to change author
git rebase -i HEAD~4 -x "git commit --amend --author 'Author Name <author.name@mail.com>' --no-edit"
Cherry-pick a merged commit with conflict
git cherry-pick -m 1 --strategy-option theirs HASH
git-repo
error.GitError fatal bad revision
Example:
error.GitError: manifests rev-list (u'^2736dfd46e8a30cf59a9cd6e93d9e56e87021f2a', 'HEAD', '--'): fatal: bad revision 'HEAD'
Did you modify files in .repo?
To reset files from your branch into .repo:
cd .repo/manifests
git branch -av
> remotes/m/rel/8953/zd552kl/7.1.1-11.40.208 -> origin/rel/8953/zd552kl/7.1.1-11.40.208
> remotes/origin/dev/ze550kl/asus/5.0.0-20150208 11a37fe set dev/ze550kl/asus/5.0.0-20150208
> remotes/origin/rel/8953/zd552kl/7.1.1-11.40.208 2736dfd Remove opencv3 from the manifest
# To reset the "remotes/origin" use the same as "remotes/m"
git reset --hard REF_OF_REMOTES/m
> git reset --hard remotes/origin/rel/8953/zd552kl/7.1.1-11.40.208
OSX installation
Docker installation
This guide works in the past, but it's now broken
echo "\n--- Installing docker --"
brew install minikube docker docker-compose docker-machine
brew cask install virtualbox
docker-machine create --driver virtualbox default
docker-machine env default
eval "$(docker-machine env default)"
Run error current limit exceeds maximum limit
When you got
File "/Users/test/Desktop/ERPLibre/odoo/odoo/service/server.py", line 83, in set_limit_memory_hard
resource.setrlimit(rlimit, (config['limit_memory_hard'], hard))
ValueError: current limit exceeds maximum limit
Add line at the end of config.conf
limit_memory_hard = 0