Created
March 11, 2020 07:25
-
-
Save mcindea/6caf124bcce28ea7fe61c906f9731523 to your computer and use it in GitHub Desktop.
my personal .bashrc for dailly life
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
# .bashrc | |
# Source global definitions | |
if [ -f /etc/bashrc ]; then | |
. /etc/bashrc | |
fi | |
# User specific environment | |
PATH="$HOME/.local/bin:$HOME/bin:$PATH" | |
export PATH | |
# Refresh gpg-agent tty in case user switches into an X session | |
# New config that works with Yubikeys | |
# Set SSH to use gpg-agent | |
unset SSH_AGENT_PID | |
if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then | |
#export SSH_AUTH_SOCK="/run/user/$UID/gnupg/S.gpg-agent.ssh" | |
SSH_AGENT="/usr/bin/gpg-agent --daemon" | |
export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) | |
fi | |
# Start the gpg-agent if not already running | |
if ! pgrep -x -u "${USER}" gpg-agent >/dev/null 2>&1; then | |
gpg-connect-agent /bye >/dev/null 2>&1 | |
fi | |
#export GPG_TTY=$(tty) | |
function attach() { | |
docker exec -it $1 sh | |
} | |
function rpass() { | |
# LENGTH=${1:-42} | |
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w ${1:-42} | head -n 1 | |
} | |
function codeship-extract() { | |
cat $1 | jq -c .service_log[].payload | tr -d \" | base64 -d | |
} | |
function aws-search-by-ip(){ | |
aws --profile production ec2 describe-network-interfaces --filters Name=addresses.private-ip-address,Values=$1 | |
} | |
alias ykrestart='gpgconf --kill gpg-agent && gpgconf --launch gpg-agent' | |
alias yd="cd ~/personal/mp3/youtube;youtube-dl -x --audio-quality 0 --add-metadata --audio-format mp3" | |
alias ssh3='ssh -i ~/prv8/ssh_keys/3dhubs-master-key' | |
# Encryption | |
# My keys and my coworkers' | |
alias 3dencrypt='gpg2 --encrypt -r 26A957E737C4D932C3E7A601EAECDEF62352320F -r 854D79D64630D2A57BFC81216AF0BC0C82E8D9C6 -r 957F8768371A5FA393998D49CAA44E47EA44A979' | |
# Both personal yubikeys | |
alias prv8encrypt='gpg2 --encrypt -r 26A957E737C4D932C3E7A601EAECDEF62352320F -r 957F8768371A5FA393998D49CAA44E47EA44A979' | |
# Dacia proxy | |
alias proxy-dacia='ssh -D 3129 -f -C -q -N [email protected] -p 1336' | |
# Easy command to hibernate (from kaputt) | |
alias ka='/bin/systemctl hibernate -i' | |
# 3D Printing | |
alias cura='~/printing/Ultimaker_Cura-4.5.0.AppImage' | |
alias 3dhubs='/home/mihai/.local/venvs/3dhubs-v2/.venv/bin/3dhubs' | |
# Extend aws-mfa to the max lifetime | |
alias aws-mfa='aws-mfa --duration 129600' | |
# Terraform shortcuts | |
alias ta='terraform apply "apply.tfplan"' | |
alias tp='terraform plan -out=apply.tfplan' | |
# Vault | |
complete -C /usr/bin/vault vault | |
# Some History hacks for a longer bash history | |
export HISTTIMEFORMAT="%h %d %H:%M:%S " | |
export HISTSIZE=100000 | |
shopt -s histappend | |
PROMPT_COMMAND='history -a' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment