Open ~/.bash_profile
in your favorite editor and add the following content to the bottom.
# Git branch in prompt.
parse_git_branch() {
Every so often I have to restore my gpg keys and I'm never sure how best to do it. So, I've spent some time playing around with the various ways to export/import (backup/restore) keys.
Gotten from the RedHat GPG migration manual
## Export all public keys
gpg -a --export >mypubkeys.asc
Note: Unix-like systems only.
code --list-extensions | sed -e 's/^/code --install-extension /' > my_vscode_extensions.sh
/** | |
* Add two string time values (HH:mm:ss) with javascript | |
* | |
* Usage: | |
* > addTimes('04:20:10', '21:15:10'); | |
* > "25:35:20" | |
* > addTimes('04:35:10', '21:35:10'); | |
* > "26:10:20" | |
* > addTimes('30:59', '17:10'); | |
* > "48:09:00" |
git log --graph --oneline --decorate ( git fsck --no-reflog | awk '/dangling commit/ {print $3}' )
This will show you all the commits at the tips of your commit graph which are no longer referenced from any branch or tag – every lost commit, including every stash commit you’ve ever created, will be somewhere in that graph.
/** | |
* Return an environment variable typed value from `process.env`. | |
* It also supports a default value in case of `undefined`. | |
* | |
* The function will follow these steps to take a typed value: | |
* 1. First it will try to get the env value from `process.env`. | |
* 2. Then if `undefined` then it try with the default environment variable value if defined. | |
* 3. Otherwise if the default value is `undefined` then it will return the Javascript default values: | |
* - Boolean: `false` | |
* - String: `""` |