Languages
9,960 gist results
9,960 gist results
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
| env=~/.ssh/agent.env | |
| agent_load_env () { test -f "$env" && . "$env" >| /dev/null ; } | |
| agent_start () { | |
| (umask 077; ssh-agent >| "$env") | |
| . "$env" >| /dev/null ; } | |
| agent_load_env |
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
| # bash theme - partly inspired by https://github.com/ohmyzsh/ohmyzsh/blob/master/themes/robbyrussell.zsh-theme | |
| __bash_prompt() { | |
| local userpart='`export XIT=$? \ | |
| && [ ! -z "${GITHUB_USER:-}" ] && echo -n "\[\033[0;32m\]@${GITHUB_USER:-} " || echo -n "\[\033[0;32m\]@\h " \ | |
| && [ "$XIT" -ne "0" ] && echo -n "\[\033[1;31m\]➜" || echo -n "\[\033[0m\]➜"`' | |
| local gitbranch='`\ | |
| if [ "$(git config --get devcontainers-theme.hide-status 2>/dev/null)" != 1 ] && [ "$(git config --get codespaces-theme.hide-status 2>/dev/null)" != 1 ]; then \ | |
| export BRANCH="$(git --no-optional-locks symbolic-ref --short HEAD 2>/dev/null || git --no-optional-locks rev-parse --short HEAD 2>/dev/null)"; \ | |
| if [ "${BRANCH:-}" != "" ]; then \ | |
| echo -n "\[\033[0;36m\](\[\033[1;31m\]${BRANCH:-}" \ |
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
| # ~/.bashrc | |
| # By Matthew Fritz | |
| # This is primarily for Git Bash and also for my own purposes so your mileage may vary | |
| # | |
| # Current script version (GitHub Gist): | |
| # https://gist.github.com/matthewfritz/0c379b45593b432867894cb4c7da07d6 | |
| HOME_DIR="/c/Users/mattf" | |
| SSH_DIR="$HOME_DIR/.ssh" | |
| GITHUB_SSH_KEY="$SSH_DIR/github_id_ed25519" |
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
| # 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=10000000 | |
| HISTFILESIZE=20000000 |
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
| # ~/.bashrc: executed by bash(1) for non-login shells. | |
| # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) | |
| # for examples | |
| # If not running interactively, don't do anything | |
| case $- in | |
| *i*) ;; | |
| *) return;; | |
| esac |
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
| RESET="\033[0m" # Normal | |
| RED="\033[1m\033[1;31m" # Red | |
| GREEN="\033[1m\033[1;32m" # Green | |
| WHITE="\033[1m\033[1;37m" # White | |
| pyvenv() { | |
| local venv_name=${1:-$(read -p "Enter the virtual environment name: " name && echo "$name")} | |
| local venv_home="$HOME/python-virtual-environs/$venv_name" | |
| if [[ -z "$venv_name" ]]; 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
| [ -z "\$PS1" ] && return | |
| HISTCONTROL=ignoredups:ignorespace | |
| shopt -s histappend | |
| HISTSIZE=10000 | |
| HISTFILESIZE=20000 | |
| HISTTIMEFORMAT="%F %T " | |
| shopt -s checkwinsize | |
| case "\$TERM" in | |
| xterm-color) color_prompt=yes;; | |
| esac |
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
| // .bashrc | |
| alias gita="git add -u" | |
| alias gitp="git push" | |
| alias gitpr="git pull --rebase" | |
| alias gitpf="git push --force-with-lease" | |
| alias gitd="git diff" | |
| alias git-="git checkout -" # check out previous branch | |
| alias gitb="git for-each-ref --count=15 --sort=-committerdate refs/heads --format='%(authordate:short) %(color:red)%(objectname:short) %(color:yellow)%(refname:short)%(color:reset) (%(color:green)%(committerdate:relative)%(color:reset))'" | |
| alias pop="notify-send 'check it out'" |
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
| export PATH="/usr/local/opt/openssl/bin:$PATH" | |
| export LDFLAGS="-L/usr/local/opt/openssl/lib" | |
| export CPPFLAGS="-I/usr/local/opt/openssl/include" | |
| export PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig" |
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
| # Red background if previous command failed | |
| get_err_color() { | |
| if [ $? -ne 0 ]; then | |
| echo -e "\033[41m" | |
| fi | |
| } | |
| # Red background if on master/main | |
| get_git_branch_color() { | |
| branch=$(__git_ps1 %s) |