This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # auto activate virtualenvs ------------------ | |
| # I suspect this could be rewritten to just use VIRTUAL_ENV directly, | |
| # without needing the $parentdir variable at all. | |
| function cd() { | |
| builtin cd "$@" | |
| # If we move out of a previous parentdir, deactivate the previous venv | |
| if [[ -n "$parentdir" && "$PWD"/ != "$parentdir"/* ]]; then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Ubuntu prefers the Firefox snap. Use the apt instead. | |
| sudo snap remove --purge firefox | |
| sudo add-apt-repository ppa:mozillateam/ppa | |
| sudo apt update | |
| sudo apt install firefox | |
| # Also prefer the apt in future updates | |
| sudo tee /etc/apt/preferences.d/firefox <<EOF |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| from time import time | |
| # If we iterate a million times, | |
| # then results per-call are in micro seconds. | |
| ITERS = 1_000_000 | |
| UNIT = "µs" | |
| # If our first loop below ONLY measures calls to time(), | |
| # then the second loop below (which is to measure loop overhead) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # display red exit value if it isn't zero | |
| PROMPT_COMMAND='EXITVAL=$?; '$PROMPT_COMMAND | |
| GET_EXITVAL='$(if [[ $EXITVAL != 0 ]]; then echo -n "\[\e[37;41;01m\] $EXITVAL \[\e[0m\] "; fi)' | |
| export PS1="$GET_EXITVAL$PS1" |