Awesome Git aliases

Copy and paste the code below at your terminal.

echo “Adding git pull/push aliases”
git config –global alias.pop “push origin production”
git config –global alias.plp “pull origin production”
git config –global alias.pom “push origin master”
git config –global alias.plm “pull origin master”

echo “Adding git aliases”
git config –global alias.br branch
git config –global alias.ci commit

git config –global alias.co checkout
git config –global alias.st status
git config –global alias.df diff
git config –global alias.undo “reset –soft HEAD^”
echo “Adding git log aliases”
git config –global alias.gl “log –graph –pretty=oneline –abbrev-commit”
git config –global alias.lg “log –graph –pretty=format:’%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset’ –abbrev-commit –date=relative”

echo “Adding git colors”
git config –global color.branch auto
git config –global color.diff auto
git config –global color.interactive auto
git config –global color.status auto
git config –global color.ui auto

How to easily find slow queries at MongoDB

Enable profiling

First, you have to enable profiling.

> db.setProfilingLevel(1)

Now let it run for a while. It collects the slow queries ( > 100ms) into a capped collections, so queries go in and if it’s full, old queries go out, so don’t be surprised that it’s a moving target.

Find the most recent slow query

> db.system.profile.find().sort({$natural: -1}).limit(1)

Find the single slowest query in the capped system.profile collection right now

> db.system.profile.find().sort({millis: -1}).limit(1)