diff --git a/git/.gitconfig b/git/.gitconfig index e86368a..8d4e4f6 100644 --- a/git/.gitconfig +++ b/git/.gitconfig @@ -34,3 +34,5 @@ default = simple [commit] gpgsign = true +[gpg] + program = /usr/bin/gpg2 diff --git a/gnupg/.gnupg/gpg-agent.conf b/gnupg/.gnupg/gpg-agent.conf new file mode 100644 index 0000000..2384746 --- /dev/null +++ b/gnupg/.gnupg/gpg-agent.conf @@ -0,0 +1,3 @@ +pinentry-program /usr/bin/pinentry +default-cache-ttl 600 +max-cache-ttl 7200 diff --git a/gnupg/bin/pinentry-smart b/gnupg/bin/pinentry-smart new file mode 100755 index 0000000..7dd48f2 --- /dev/null +++ b/gnupg/bin/pinentry-smart @@ -0,0 +1,12 @@ +#!/bin/sh + +set -eu + +PINENTRY_TUI='/usr/bin/pinentry-curses' +PINENTRY_GUI='/usr/bin/pinentry-gnome3' + +if [ -n "${DISPLAY-}" -a -z "${TERM-}" ]; then + exec "$PINENTRY_GUI" "$@" +else + exec "$PINENTRY_TUI" "$@" +fi diff --git a/mutt/.muttrc b/mutt/.muttrc index 6399148..bef1c85 100644 --- a/mutt/.muttrc +++ b/mutt/.muttrc @@ -142,8 +142,8 @@ set pgp_verify_command="gpg --pinentry-mode loopback --no-verbose --batch --outp set pgp_decrypt_command="gpg --pinentry-mode loopback --passphrase-fd 0 --no-verbose --batch --output - %f" set pgp_sign_command="gpg --pinentry-mode loopback --no-verbose --batch --output - --passphrase-fd 0 --armor --detach-sign --textmode %?a?-u %a? %f" set pgp_clearsign_command="gpg --pinentry-mode loopback --no-verbose --batch --output - --passphrase-fd 0 --armor --textmode --clearsign %?a?-u %a? %f" -set pgp_encrypt_only_command="pgpewrap gpg --batch --quiet --no-verbose --output - --encrypt --textmode --armor --always-trust --encrypt-to 0x49CF25C6 -- -r %r -- %f" -set pgp_encrypt_sign_command="pgpewrap gpg --passphrase-fd 0 --batch --quiet --no-verbose --textmode --output - --encrypt --sign %?a?-u %a? --armor --always-trust --encrypt-to 0x49CF25C6 -- -r %r -- %f" +set pgp_encrypt_only_command="/usr/lib/neomutt/pgpewrap gpg --batch --quiet --no-verbose --output - --encrypt --textmode --armor --always-trust --encrypt-to 0x49CF25C6 -- -r %r -- %f" +set pgp_encrypt_sign_command="/usr/lib/neomutt/pgpewrap gpg --passphrase-fd 0 --batch --quiet --no-verbose --textmode --output - --encrypt --sign %?a?-u %a? --armor --always-trust --encrypt-to 0x49CF25C6 -- -r %r -- %f" set pgp_import_command="gpg --no-verbose --import -v %f" set pgp_export_command="gpg --no-verbose --export --armor %r" set pgp_verify_key_command="gpg --no-verbose --batch --fingerprint --check-sigs %r" diff --git a/zsh/.zsh/aliases.zsh b/zsh/.zsh/aliases.zsh index afaa82e..d911e0a 100644 --- a/zsh/.zsh/aliases.zsh +++ b/zsh/.zsh/aliases.zsh @@ -1,10 +1,10 @@ # Lazy alias ..='cd ..' -alias lh='ls -d .*' # show hidden files/directories only -alias lsd='ls -aFhlG' -alias l='ls -al' -alias ls='ls -GFh' # Colorize output, add file type indicator, and put sizes in human readable format -alias ll='ls -GFhl' # Same as above, but in long listing format +alias lh='ls --color -d .*' # show hidden files/directories only +alias lsd='ls -aFhlG --color' +alias l='ls -al --color' +alias ls='ls -GFh --color' # Colorize output, add file type indicator, and put sizes in human readable format +alias ll='ls -GFhl --color' # Same as above, but in long listing format # List directories sorted by size alias dus='du -sckx * | sort -nr' @@ -21,6 +21,12 @@ alias mroyal='mosh royal -- tmux new-session -A -s main' alias mari='mosh ari -- tmux new-session -A -s main' alias muzi='mosh uzi -- tmux new-session -A -s main' +# fix sudo autocorrections +alias sudo="nocorrect sudo" + +# A crude speedtest with curl +alias speedtest="curl -o /dev/null http://speedtest-nyc1.digitalocean.com/100mb.test" + # blank-chrome function blank-chrome { if [ "$@" ]; then diff --git a/zsh/.zsh/colors.zsh b/zsh/.zsh/colors.zsh index 824b167..5d61de7 100644 --- a/zsh/.zsh/colors.zsh +++ b/zsh/.zsh/colors.zsh @@ -12,11 +12,11 @@ export PR_RED PR_GREEN PR_YELLOW PR_BLUE PR_WHITE PR_BLACK export PR_BOLD_RED PR_BOLD_GREEN PR_BOLD_YELLOW PR_BOLD_BLUE export PR_BOLD_WHITE PR_BOLD_BLACK -# Clear LSCOLORS -unset LSCOLORS - -# Main change, you can see directories on a dark background -#expor tLSCOLORS=gxfxcxdxbxegedabagacad - -export CLICOLOR=1 -export LS_COLORS=exfxcxdxbxegedabagacad +## Clear LSCOLORS +#unset LSCOLORS +# +## Main change, you can see directories on a dark background +#export LSCOLORS=gxfxcxdxbxegedabagacad +# +#export CLICOLOR=1 +#export LS_COLORS=exfxcxdxbxegedabagacad diff --git a/zsh/.zsh/exports.zsh b/zsh/.zsh/exports.zsh index 4c7e46e..0127a2d 100644 --- a/zsh/.zsh/exports.zsh +++ b/zsh/.zsh/exports.zsh @@ -15,3 +15,7 @@ export EDITOR='nvim' # Fix gnupg export GPG_TTY=$(tty) + +# Fix GOPATH +export GOPATH="$HOME/dev/go" +export PATH="$HOME/dev/go/bin:$PATH" diff --git a/zsh/.zsh/functions.zsh b/zsh/.zsh/functions.zsh index 9383946..7e93d1d 100644 --- a/zsh/.zsh/functions.zsh +++ b/zsh/.zsh/functions.zsh @@ -1,30 +1,12 @@ -# Truncate working directory -function truncated_pwd() { - n=$1 - path=`collapse_pwd` - dirs=("${(s:/:)path}") - dirs_length=$#dirs - - if [[ $dirs_length -ge $n ]]; then - ((max=dirs_length - n)) - for (( i = 1; i <= $max; i++ )); do - step="$dirs[$i]" - if [[ -z $step ]]; then - continue - fi - if [[ $stem =~ "^\." ]]; then - dirs[$i]=$step[0,2] - else - dirs[$i]=$step[0,1] - fi - done +# Show what requires a reboot if one is required +reboot_for() { + if test -f /var/run/reboot-required; then + echo "Reboot required for:" + cat /var/run/reboot-required.pkgs + else + echo "Nothing requires a reboot." fi - echo ${(j:/:)dirs} -} - -function collapse_pwd { - echo $(pwd | sed -e "s,^$HOME,~,") } # Extract anything diff --git a/zsh/.zsh/prompt.zsh b/zsh/.zsh/prompt.zsh index 8731a5a..9aab62b 100644 --- a/zsh/.zsh/prompt.zsh +++ b/zsh/.zsh/prompt.zsh @@ -5,32 +5,62 @@ autoload -U colors && colors # Enable colors in prompt function git_branch { local FULL_BRANCH="$(git symbolic-ref -q HEAD 2>/dev/null || git name-rev --name-only --no-undefined --always HEAD 2>/dev/null)" local SHORT_BRANCH="$(echo $FULL_BRANCH | sed 's/refs\/heads\///')" - echo " %F{blue}$SHORT_BRANCH%f" + echo "$SHORT_BRANCH" } function git_is_ahead { local NUM_AHEAD="$(git log --oneline @{u}.. 2>/dev/null | wc -l | tr -d ' ')" if [ "$NUM_AHEAD" -gt 0 ]; then - echo " %F{red}↑%f" + echo "↑" fi } function git_is_behind { local NUM_BEHIND="$(git log --oneline ..@{u} 2>/dev/null | wc -l | tr -d ' ' )" if [ "$NUM_BEHIND" -gt 0 ]; then - echo " %F{blue}↓%f" + echo "↓" fi } function git_unstaged { local CHANGED=$(git status --porcelain --ignore-submodule -unormal 2>/dev/null | wc -l) if [ $CHANGED -gt 0 ]; then - echo -e "%F{yellow}~%f\c" + echo -e "◊\c" fi } -function current_pwd { - echo $(pwd | sed -e "s,^$HOME,~,") +# Truncate working directory +function truncated_pwd() { + n=$1 + path=`current_pwd` + + dirs=("${(s:/:)path}") + dirs_length=$#dirs + + if [[ $dirs_length -ge $n ]]; then + ((max=dirs_length - n)) + for (( i = 1; i <= $max; i++ )); do + step="$dirs[$i]" + if [[ -z $step ]]; then + continue + fi + if [[ $stem =~ "^\." ]]; then + dirs[$i]=$step[0,2] + else + dirs[$i]=$step[0,1] + fi + done + fi + echo ${(j:/:)dirs} } -PROMPT='%m ${PR_BOLD_YELLOW}$(truncated_pwd 3)$(git_branch)%{$reset_color%}$(git_unstaged)$(git_is_ahead)$(git_is_behind) %(?.%F{magenta}.%F{red})❯%f ' +function current_pwd { + echo $(pwd | sed -e "s,^$HOME,~,") +} + +function check_reboot { + test -f /var/run/reboot-required && echo "R " +} + +#PROMPT='${PR_BOLD_RED}$(check_reboot)${reset_color}%m ${PR_BOLD_YELLOW}$(truncated_pwd 3)$(git_branch)%{$reset_color%}$(git_unstaged)$(git_is_ahead)$(git_is_behind) %(?.%F{magenta}.%F{red})❯%f ' +PROMPT='$(check_reboot)%m $(truncated_pwd 3) $(git_branch) $(git_unstaged)$(git_is_ahead)$(git_is_behind)> '