Last active
August 4, 2020 06:09
-
-
Save jimathyp/be02753c512005b41ef1334a63b7789e to your computer and use it in GitHub Desktop.
bash_profile
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
| # WSL ~/.bash_profile | |
| echo "Function 'login <aws_vault_profile_name>'" | |
| login() { | |
| echo '$(date) login to $1' | tee --append ~/aws_logins.log | |
| # aws-vault version 5 | |
| aws-vault login -s $1 | xargs nohup chrome.exe --incognito &> ~/chrome.nohup.out | |
| } | |
| echo "Function 'login-link <aws_vault_profile_name>'" | |
| login-link() { | |
| echo '$(date) login to $1' | tee --append ~/aws_logins.log | |
| echo | |
| # aws-vault version 5 | |
| aws-vault login -s $1 | tee /dev/tty | clip.exe | |
| echo | |
| echo 'Link is in clipboard' | |
| } | |
| echo 'function "neatogv"' | |
| neatogv(){ | |
| file=$(basename "$1" .gv) | |
| echo $file | |
| neato -Tpng $file.gv -o $file.png && chrome.exe $file.png | |
| } | |
| echo 'function "dotgv"' | |
| dotgv() { | |
| # name=$(echo "$filename" | cut -f 1 -d '.') | |
| #filename=$(basename -- "$1") | |
| #extension="${filename##*.}" | |
| #filename="${filename%.*}" | |
| file=$(basename "$1" .gv) | |
| echo $file | |
| dot -Tpng $file.gv -o $file.png && chrome.exe $file.png | |
| } | |
| echo 'aliases: explorer clip chrome start gst gbr gll gls glg' | |
| alias explorer='explorer.exe' | |
| alias clip='clip.exe' | |
| alias chrome='chrome.exe' | |
| alias start='explorer.exe' | |
| alias gst='git status --ignored' | |
| alias gbr='git branch -a' | |
| alias gll='git log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat' | |
| alias gld='git log --pretty=format:"%C(yellow)%h\\ %C(green)%ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short --graph' | |
| alias gls='git log --pretty=format:"%C(green)%h\\ %C(yellow)[%ad]%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=relative' | |
| alias glg='git log --graph --decorate --date=relative' | |
| echo 'Function "doc-watcher"' | |
| # start doc watcher | |
| doc-watcher() { | |
| cd docs | |
| while true; do NOW=$(find src -newer some_path); if [[ "${NOW}x" != "x" ]]; then make html; fi; echo $(date +%H:%M:%S) "- Waiting for changes. CTRL+C to stop."; sleep 5; done | |
| } | |
| # for vcxsrv (eg x11, matplotlib) | |
| echo 'Exporting DISPLAY' | |
| DISPLAY=:0.0 | |
| export DISPLAY | |
| echo 'Exporting BROWSER' | |
| export BROWSER=/mnt/c/Program\ Files\ \(x86\)/Google/Chrome/Application/chrome. | |
| echo 'Function "graphviz-watcher"' | |
| graphviz-watcher() { | |
| echo 'must be in directory, only checks *.gv files' | |
| #while true; do NOW=$(find src -newer *.gv); if [[ "${NOW}x" != "x" ]]; then make html; fi; echo $(date +%H:%M:%S) "- Waiting for changes. CTRL+C to stop."; sleep 5; done | |
| while true; do NOW=$(find src -newer *.gv); if [[ "${NOW}x" != "x" ]]; then make html; fi; echo $(date +%H:%M:%S) "- Waiting for changes. CTRL+C to stop."; sleep 5; done | |
| } | |
| echo 'Function "watch-gv"' | |
| watch-gv() { | |
| while true; do res=$(find . -name '*.gv' -newermt '-5 seconds'); if [[ "${res}x" != "x" ]]; then dotgv $res; echo $res; fi; echo "Waiting..."; sleep 5; done | |
| } | |
| echo 'Fix "wsl colours"' | |
| # fix terrible WSL highlight colours - bold (01) cyan (36) dir names with black (40) background | |
| LS_COLORS='ow=01;36;40' | |
| export LS_COLORS | |
| # GIT BRANCH FOR PS1 PROMPT | |
| #export PS1="\\w\$(__git_ps1 '(%s)') \$ " | |
| # settings for simple-git-prompt | |
| #SIMPLE_GIT_PROMPT_WINDOW_TITLE="Some title" # Uncomment to set a window title | |
| #SIMPLE_GIT_PROMPT_MAX_PWD_LEN=24 # Uncomment to set a maximum length of current path (PWD). Use 0 to not display $PWD at all | |
| #SIMPLE_GIT_PROMPT_PREFIX="@\h" # Uncomment to change the standard prefix of this prompt | |
| #SIMPLE_GIT_PROMPT_SUFFIX="-->" # Uncomment to change the standard postfix of this prompt | |
| #source ~/.simple-git-prompt/simplegitprompt.sh | |
| # Chi Thuc Nguyen git prompt | |
| echo 'Add git branch to PS1' | |
| parse_git_branch() { | |
| git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' | |
| } | |
| #export PS1="\u@\h \[\e[32m\]\w \[\e[91m\]\$(parse_git_branch)\[\e[00m\]$ " | |
| export PS1="\[\e[32m\]\w \[\e[91m\]\$(parse_git_branch)\[\e[00m\]$ " | |
| # use view instead of less for colours (opens vim in Readonly: vim -R) | |
| echo 'Exporting SPARK_LOCAL_IP=127.0.1.1' | |
| export SPARK_LOCAL_IP=127.0.1.1 | |
| echo "Run if required:" | |
| echo " ssh-agent" | |
| echo " sudo service postgresql start|status|stop" | |
| echo " sudo -u postgres psql" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment