Last active
April 16, 2022 05:19
-
-
Save czlee/3e1bb5159da638c61312842a7d6b7666 to your computer and use it in GitHub Desktop.
Preference files on WSL
This file contains 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
alias gs='git status' | |
alias gd='git diff' | |
alias gdh='git diff HEAD' | |
alias gdw='git diff --ignore-all-space' | |
alias gdcw='git diff --color-words' | |
alias gdcc='git diff --color-words=.' | |
alias gl='git log --oneline -10' | |
alias notebook='BROWSER=~/jupyter-notebook-browser.sh jupyter notebook' | |
alias juplab='BROWSER=~/jupyter-notebook-browser.sh jupyter lab' | |
alias venv='source venv/bin/activate' | |
# Tabbycat shortcuts | |
bgtabbycat() { | |
sudo service postgresql start 13 | |
./downloads/redis-6.0.3/src/redis-server | |
} | |
fgtabbycat() { | |
export PGUSER=tabbycat PGPASSWORD=[password] PGHOST=localhost LOCAL_DEVELOPMENT=1 | |
cd /home/czlee/tabbycat/ | |
source venv/bin/activate | |
cd tabbycat | |
} |
This file contains 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
# This just lists additions to .bashrc, not the whole file. | |
## 1. Uncomment the force_color_prompt=yes line | |
## 2. [On WSL 1] | |
## (a) Change the color prompt PS1 line to this: | |
PS1='${debian_chroot:+($debian_chroot)}\[\033[07;32m\]\u@\h\[\033[27;02;90m\]:\[\033[01;34m\]\w\[\033[00m\]\033[01;35m$(parse_git_branch)\033[00m\n\[\033[90m\]\D{%H:%M}\[\033[00m\] \$ ' | |
## (b) Add this somewhere: | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ \1/' | |
} | |
## 2. [On WSL 2] | |
## (a) Change the color prompt PS1 line to this: | |
PS1='${debian_chroot:+($debian_chroot)}\[\033[07;36m\]\u@\h\[\033[27;02;90m\]:\[\033[01;32m\]\w\[\033[00m\]\n\[\033[90m\]\D{%H:%M}\[\033[00m\] \$ ' | |
## (b) Install https://github.com/magicmonty/bash-git-prompt | |
## (c) Add this somewhere: | |
# git prompt | |
if [ -f "$HOME/.bash-git-prompt/gitprompt.sh" ]; then | |
GIT_PROMPT_ONLY_IN_REPO=1 | |
GIT_PROMPT_START="_LAST_COMMAND_INDICATOR_ \[\033[07;36m\]\u@\h\[\033[27;02;90m\]:\[\033[01;32m\]\w\[\033[00m\]" | |
GIT_PROMPT_END_USER=" \n\[\033[90m\]\D{%H:%M}\[\033[00m\] $ " | |
GIT_PROMPT_END_ROOT=" \n\[\033[90m\]\D{%H:%M}\[\033[00m\] # " | |
source $HOME/.bash-git-prompt/gitprompt.sh | |
fi | |
## 3. Add this somewhere: | |
# For gpg-agent | |
GPG_TTY=$(tty) | |
export GPG_TTY | |
# For ssh-agent | |
# source: https://www.scivision.dev/ssh-agent-windows-linux/ | |
if [ -z "$(pgrep ssh-agent)" ]; then | |
rm -rf /tmp/ssh-* | |
eval $(ssh-agent -s) > /dev/null | |
else | |
export SSH_AGENT_PID=$(pgrep ssh-agent) | |
export SSH_AUTH_SOCK=$(find /tmp/ssh-* -name agent.*) | |
fi |
This file contains 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
[core] | |
autocrlf = input | |
editor = vim | |
excludesfile = /home/czlee/.gitignore | |
[user] | |
name = Chuan-Zheng Lee | |
email = czlee@alumni.stanford.edu | |
[push] | |
default = simple | |
[grep] | |
lineNumber = true | |
patternType = extended | |
[diff] | |
colorMoved = zebra | |
[alias] | |
rebase-fix = rebase --autosquash --interactive | |
# courtesy of https://gist.github.com/bkeepers/4986257 | |
fixup = !sh -c 'REV=$(git rev-parse $1) && git commit --fixup $@ && git rebase --interactive --autosquash $REV^' - |
This file contains 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
*.sublime-project | |
*.sublime-workspace |
This file contains 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
set number smarttab smartindent expandtab tabstop=4 shiftwidth=4 | |
highlight ExtraWhitespace ctermbg=red guibg=red | |
match ExtraWhitespace /\s\+$/ | |
autocmd BufWinEnter * match ExtraWhitespace /\s\+$/ | |
autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/ | |
autocmd InsertLeave * match ExtraWhitespace /\s\+$/ | |
autocmd BufWinLeave * call clearmatches() |
This file contains 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
#!/bin/bash | |
# This file should be executable (chmod +x juypter-notebook-browser.sh) | |
file=$(echo "$1" | sed 's/file:\/\///') | |
url=$(grep -oP 'href="\K([^"]*localhost[^"]+)' "$file") | |
wslview "$url" |
This file contains 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
# This file goes in the ~/.jupyter directory | |
# WebIO will probably add other stuff to this file when installed | |
# avoid conflict with other apps that use port 8888 | |
c.ServerApp.port = 8889 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment