2023-12-08
WSL
.bashrc
webstorm()
{
/mnt/c/Program\ Files/JetBrains/WebStorm\ 2023.2.5/bin/webstorm64.exe .
}
Usage: Run webstorm in terminal
Mac
.zshrc
webstorm() {
open -na "WebStorm.app" --args "$@"
}
Usage: Run webstorm . in terminal
Docs WSL & Mac
https://www.jetbrains.com/help/webstorm/working-with-the-ide-features-from-command-line.html
2024-02-06
Run "npm run build" 10 times
for i in {1..10}; do npm run build; done
Wait beetween commands
for i in {1..10}; do npm run build && sleep 1; done
2024-02-15
- Stdin 0< or <
- Stdout 1 or >
- Stderr 2>
2025-08-11
Reverse apply changes from old commit
git checkout <commit-hash>
git log
git diff <previous-commit-hash> > diff.patch
git checkout <main-or-up-to-date-branch>
git apply diff.patch --reverse
Create new commit that revert last commit
git revert <last-commit-hash>
2025-12-02
git checkout another-local-branch path/to/file.js
2025-12-02
git checkout HEAD^
git checkout HEAD@{1}
Go forward
List ancestry (later) commits
From HEAD (older commit) to main branch (up-to-date)
git log --reverse --ancestry-path HEAD^..main
2026-01-08
bash script.sh iii
if [[ "$1" == "iii" ]]; then
echo "første parameter er iii"
else
echo "første parameter er ikke iii"
fi
2026-01-09
https://gist.github.com/JBlond/2fea43a3049b38287e5e9cefc87b2124
2026-01-09
bash entry i docker-compose
service-name:
stdin_open: true
tty: true
Exec bash i Dockerfile / docker run:
Start interactive shell on container:
docker run -it?
Already running container:
docker exec -it [container-name] /bin/bash
2026-03-03
Check if prepush is activated or not
lsprepush() {
if [[ -f ".git/hooks/pre-push" ]]; then
echo ".git/hooks/pre-push was found:"
echo "pre-push is activated"
else
if [[ -f ".git/hooks/pre-push.sample" ]]; then
echo ".git/hooks/pre-push was not found:"
echo "but .git/hooks/pre-push.sample was found:"
echo "pre-push is deactivated"
else
echo "Hmmmmm"
fi
fi
}