Last active
January 8, 2024 01:43
-
-
Save pythoninthegrass/eb44ae6719607d75caadbd0c02b9abc6 to your computer and use it in GitHub Desktop.
WSL Ubuntu .bashrc
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
export ASDF_DIR="$HOME/.asdf" | |
[[ -f "$ASDF_DIR/asdf.sh" ]] && . "$ASDF_DIR/asdf.sh" | |
[[ -f ~/.fzf.bash ]] && . ~/.fzf.bash | |
export BUN_INSTALL="$HOME/.bun" | |
export PATH=$BUN_INSTALL/bin:$PATH | |
lg() { | |
export LAZYGIT_NEW_DIR_FILE=~/.lazygit/newdir | |
lazygit "$@" | |
if [ -f $LAZYGIT_NEW_DIR_FILE ]; then | |
cd "$(cat $LAZYGIT_NEW_DIR_FILE)" | |
rm -f $LAZYGIT_NEW_DIR_FILE > /dev/null | |
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
[[ -s ~/.bashrc ]] && source ~/.bashrc |
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
# Verify that shell is interactive | |
if [[ $- != *i* ]]; then return; fi | |
# shellcheck disable=all | |
# # .bashrc profiling start | |
# exec 5> >(ts -i "%.s" >> /tmp/bashrc.log) | |
# PS4=":${BASH_SOURCE[0]##*/}:$LINENO+"; set -x | |
# PATH | |
export N_PREFIX="$HOME/.n"; [[ :$PATH: == *":$N_PREFIX/bin:"* ]] || PATH+=":$N_PREFIX/bin" | |
export GOPATH=$HOME/go | |
export GEM_HOME="$HOME/gems" # Install Ruby Gems to ~/gems | |
export PATH="$HOME/.local/bin:$N_PREFIX/bin:$HOME/bin:/usr/bin:/usr/local/bin:/usr/local:/usr/local/sbin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:$GOPATH/bin:/usr/local/opt/ruby/bin:$HOME/gems/bin:$PATH" | |
export PATH=$(echo -n $PATH | awk -v RS=: -v ORS=: '!x[$0]++' | sed "s/\(.*\).\{1\}/\1/") | |
# shell completions | |
[[ -f "$HOME/.fzf.bash" ]] && . "$HOME/.fzf.bash" | |
# Vim Default Editor | |
export EDITOR='/usr/bin/vim' | |
# set DISPLAY variable to the IP automatically assigned to WSL2 | |
set_x11() { export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2; exit;}'):0.0; } | |
unset_x11() { unset DISPLAY; } | |
# Automatically start dbus | |
# sudo /etc/init.d/dbus start &> /dev/null | |
# PS1 Prompt | |
export PROMPT_DIRTRIM=4 | |
# export PS1="[ \u@\H \w ] \\$\[$(tput sgr0)\] " | |
# Forward search in bash (step forward via ctrl-s) | |
stty -ixon | |
# Set default blocksize for ls, df, du | |
export BLOCKSIZE=1k | |
# python | |
# alias python3='python' | |
export PYTHONSTARTUP="$HOME/.config/startup.py" | |
pip_install() { python -m pip install --user $@; } | |
pip_uninstall() { python -m pip uninstall -y $@; } | |
eval "$(register-python-argcomplete pipx)" | |
export PIPX_DEFAULT_PYTHON="$ASDF_DIR/shims/python" | |
# thefuck | |
eval "$(thefuck --alias)" | |
alias f='fuck' | |
export THEFUCK_RULES='sudo:no_command' | |
export THEFUCK_REQUIRE_CONFIRMATION='false' | |
# k8s | |
alias k="kubectl" | |
alias kc="kubectl config use-context" | |
alias kns='kubectl config set-context --current --namespace' | |
alias kgns="kubectl config view --minify --output 'jsonpath={..namespace}' | xargs printf '%s\n'" | |
# ALIAS | |
alias mkdir='mkdir -pv' # Preferred 'mkdir' implementation | |
alias ll='ls -FGlAhp' # Preferred 'ls' implementation | |
alias ..='cd ../' # Go back 1 directory level | |
alias ...='cd ../../' # Go back 2 directory levels | |
alias diff='diff -W $(( $(tput cols) - 2 ))' # Full Terminal Width in Side-by-Side Mode | |
alias ip="ifconfig | grep 'inet ' | grep -v '127.0.0.1' | awk '{print \$2;exit}'" # Private IP address | |
alias ex-ip='curl icanhazip.com' # Your public IP address | |
alias open-ports='sudo lsof -i | grep LISTEN' # All listening connections | |
alias show-blocked='sudo ipfw list' # All ipfw rules inc/ blocked IPs | |
alias code='flatpak run com.visualstudio.code' | |
# FUNCTIONS | |
cd() { builtin cd "$@"; ll; } # Always list directory contents upon 'cd' | |
iface() { route get 0.0.0.0 2>/dev/null | awk '/interface: / {print $2}'; } # Network interface | |
# don't put duplicate lines or lines starting with space in the history. | |
# See bash(1) for more options | |
HISTCONTROL=ignoreboth | |
# append to the history file, don't overwrite it | |
shopt -s histappend | |
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) | |
HISTSIZE=1000 | |
HISTFILESIZE=2000 | |
# check the window size after each command and, if necessary, | |
# update the values of LINES and COLUMNS. | |
shopt -s checkwinsize | |
# If set, the pattern "**" used in a pathname expansion context will | |
# match all files and zero or more directories and subdirectories. | |
#shopt -s globstar | |
# make less more friendly for non-text input files, see lesspipe(1) | |
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" | |
# set variable identifying the chroot you work in (used in the prompt below) | |
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then | |
debian_chroot=$(cat /etc/debian_chroot) | |
fi | |
# set a fancy prompt (non-color, unless we know we "want" color) | |
case "$TERM" in | |
xterm-color|*-256color) color_prompt=yes;; | |
esac | |
# uncomment for a colored prompt, if the terminal has the capability; turned | |
# off by default to not distract the user: the focus in a terminal window | |
# should be on the output of commands, not on the prompt | |
#force_color_prompt=yes | |
if [ -n "$force_color_prompt" ]; then | |
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then | |
# We have color support; assume it's compliant with Ecma-48 | |
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such | |
# a case would tend to support setf rather than setaf.) | |
color_prompt=yes | |
fi | |
fi | |
if [ "$color_prompt" = yes ]; then | |
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\] \nλ ' | |
else | |
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w \nλ ' | |
fi | |
unset color_prompt force_color_prompt | |
# If this is an xterm set the title to user@host:dir | |
case "$TERM" in | |
xterm*|rxvt*) | |
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" | |
;; | |
*) | |
;; | |
esac | |
# enable color support of ls and also add handy aliases | |
if [ -x /usr/bin/dircolors ]; then | |
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" | |
alias ls='ls --color=auto' | |
#alias dir='dir --color=auto' | |
#alias vdir='vdir --color=auto' | |
alias grep='grep --color=auto' | |
alias fgrep='fgrep --color=auto' | |
alias egrep='egrep --color=auto' | |
fi | |
# colored GCC warnings and errors | |
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' | |
# # .bashrc profiling end | |
# set +x |
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
ansible-core==2.14.4 ; python_version >= "3.11" and python_version < "4.0" | |
ansible-lint==6.14.3 ; python_version >= "3.11" and python_version < "4.0" and platform_system != "Windows" | |
ansible==7.3.0 ; python_version >= "3.11" and python_version < "4.0" | |
appnope==0.1.3; sys_platform == "darwin" and python_version >= "3.8" | |
asttokens==2.1.0; python_version >= "3.8" | |
backcall==0.2.0; python_version >= "3.8" | |
colorama==0.4.6; python_version >= "3.8" and python_full_version < "3.0.0" and sys_platform == "win32" or sys_platform == "win32" and python_version >= "3.8" and python_full_version >= "3.7.0" | |
commonmark==0.9.1; python_full_version >= "3.6.3" and python_full_version < "4.0.0" | |
cryptography==40.0.1 ; python_version >= "3.11" and python_version < "4.0" | |
filelock==3.10.7 ; python_version >= "3.11" and python_version < "4.0" and platform_system != "Windows" | |
decorator==5.1.1; python_version >= "3.8" | |
executing==1.2.0; python_version >= "3.8" | |
icecream==2.1.3 | |
ipython==8.11.0; python_version >= "3.8" | |
jedi==0.18.1; python_version >= "3.8" | |
jinja2==3.1.2 ; python_version >= "3.11" and python_version < "4.0" | |
matplotlib-inline==0.1.6; python_version >= "3.8" | |
numpy==1.23.4; python_version >= "3.10" | |
pandas==1.5.1; python_version >= "3.8" | |
parso==0.8.3; python_version >= "3.8" | |
pathvalidate==2.5.2; python_version >= "3.6" | |
pexpect==4.8.0; sys_platform != "win32" and python_version >= "3.8" | |
pickleshare==0.7.5; python_version >= "3.8" | |
pipx==1.2.0 ; python_version >= "3.11" and python_version < "4.0" | |
prompt-toolkit==3.0.32; python_full_version >= "3.6.2" and python_version >= "3.8" | |
ptyprocess==0.7.0; sys_platform != "win32" and python_version >= "3.8" | |
pure-eval==0.2.2; python_version >= "3.8" | |
pygments==2.13.0; python_full_version >= "3.6.3" and python_full_version < "4.0.0" and python_version >= "3.8" | |
python-dateutil==2.8.2; python_version >= "3.8" and python_full_version < "3.0.0" or python_full_version >= "3.3.0" and python_version >= "3.8" | |
pytz==2022.6; python_version >= "3.8" | |
pyyaml==6.0 ; python_version >= "3.11" and python_version < "4.0" | |
rich==13.3.3 ; python_version >= "3.11" and python_version < "4.0" and platform_system != "Windows" | |
six==1.16.0; python_version >= "3.8" and python_full_version < "3.0.0" or python_full_version >= "3.3.0" and python_version >= "3.8" | |
stack-data==0.6.0; python_version >= "3.8" | |
traitlets==5.5.0; python_version >= "3.8" | |
wcwidth==0.2.5; python_full_version >= "3.6.2" and python_version >= "3.8" | |
yamllint==1.30.0 ; python_version >= "3.11" and python_version < "4.0" and platform_system != "Windows" | |
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
#!/usr/bin/env python3 | |
# https://ipython.readthedocs.io/en/stable/interactive/reference.html#ipython-as-your-default-python-environment | |
# https://github.com/Textualize/rich#rich-repl | |
import os, IPython | |
from rich.jupyter import print | |
os.environ['PYTHONSTARTUP'] = '' # Prevent running this again | |
IPython.start_ipython() | |
raise SystemExit | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment