diff --git a/00_aliases b/00_aliases new file mode 100644 index 0000000..fdbbb0f --- /dev/null +++ b/00_aliases @@ -0,0 +1,18 @@ +function ts() { + date +%Y-%m-%d_%H:%M:%S +} + +function check_ssl { + if [[ -z "$1" ]]; then + printf 'usage:\n\ncheck_ssl SITE \n' >&2 + return 1 + else + site="$1" + fi + if [[ -z "$2" ]]; then + port=443 + else + port="$2" + fi + echo | openssl s_client -showcerts -servername "$site" -connect "$site":"$port" 2>/dev/null | openssl x509 -inform pem -noout -text +} diff --git a/bashrc b/bashrc index b6795f9..a817ea3 100644 --- a/bashrc +++ b/bashrc @@ -104,7 +104,7 @@ fi ssh_auth_link="${auth_sock_dir}/ssh_auth_sock" pgrep ssh-agent &>/dev/null if [[ "$?" == "1" ]]; then - eval "$(ssh-agent &>"$auth_sock_log")" + . <(ssh-agent | sed 's/echo/#echo/' | tee "$auth_sock_log") if [[ -L "$ssh_auth_link" ]]; then rm "$ssh_auth_link" fi @@ -114,6 +114,25 @@ if [[ "$?" == "1" ]]; then else ln -s "$SSH_AUTH_SOCK" "$ssh_auth_link" fi -else - [[ -L "${ssh_auth_link}" ]] && [[ -e "${ssh_auth_link}" ]] && export SSH_AUTH_SOCK="$ssh_auth_link" fi +[[ -L "${ssh_auth_link}" ]] && [[ -e "${ssh_auth_link}" ]] && export SSH_AUTH_SOCK="$ssh_auth_link" + +# Eternal bash history. +# --------------------- +# Undocumented feature which sets the size to "unlimited". +# http://stackoverflow.com/questions/9457233/unlimited-bash-history +export HISTFILESIZE= +export HISTSIZE= +export HISTCONTROL=ignoredups:erasedups +export HISTTIMEFORMAT="[%F %T] " +shopt -s histappend + +# export HISTTIMEFORMAT="[%F %T] $(/home/luke/bin/history_status) " +# Change the file location because certain bash sessions truncate .bash_history file upon close. +# http://superuser.com/questions/575479/bash-history-truncated-to-500-lines-on-each-login +export HISTFILE=~/.bash_eternal_history +# Force prompt to write history after every command. +# http://superuser.com/questions/20900/bash-history-loss +# PROMPT_COMMAND="history -a; $PROMPT_COMMAND" +# PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND" +export PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND$'\n'}history -a; history -c; history -r"