From dfc25727838354c2185a8a9ae4e35dc5224d6887 Mon Sep 17 00:00:00 2001 From: Ian Adam Naval Date: Tue, 21 Apr 2015 09:36:00 -0400 Subject: [PATCH 1/3] Update prezto --- zprezto/.zprezto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zprezto/.zprezto b/zprezto/.zprezto index ef860f5..bf4d74d 160000 --- a/zprezto/.zprezto +++ b/zprezto/.zprezto @@ -1 +1 @@ -Subproject commit ef860f59e12210c45c7c5f3d83cf5fee0863cd86 +Subproject commit bf4d74d16c56e0c7ddbc6139523e4dc4755293f4 From 68c5567d561e31ad620053caa4f4dc50ecc23b9b Mon Sep 17 00:00:00 2001 From: Ian Adam Naval Date: Tue, 21 Apr 2015 09:37:11 -0400 Subject: [PATCH 2/3] Update i3 config Change floating windows to have titlebars Remove focused window title from status bar (too much CPU usage) --- i3/i3.dotfile/config | 2 +- i3/i3.dotfile/status.py | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/i3/i3.dotfile/config b/i3/i3.dotfile/config index ada213d..f15cbf6 100644 --- a/i3/i3.dotfile/config +++ b/i3/i3.dotfile/config @@ -199,7 +199,7 @@ bindsym $mod+Shift+e mode "$quit_msg" bindsym $mod+r mode "resize" new_window pixel 2 -new_float pixel 2 +new_float normal 2 smart_borders on # border background text indicator diff --git a/i3/i3.dotfile/status.py b/i3/i3.dotfile/status.py index c1ab69c..3f218b8 100644 --- a/i3/i3.dotfile/status.py +++ b/i3/i3.dotfile/status.py @@ -53,7 +53,7 @@ if os.path.exists("/sys/class/power_supply/BAT0"): status.register("battery", battery_ident="BAT0", format="{consumption:.1f}W {percentage_design:.1f}%{status} {remaining:%E%h:%M}", - alert=True, + alert=False, alert_percentage=20, charging_color=COLORS['Yellow'], full_color=COLORS['Green'], @@ -68,7 +68,7 @@ if os.path.exists("/sys/class/power_supply/BAT1"): status.register("battery", battery_ident="BAT1", format="{consumption:.1f}W {percentage_design:.1f}%{status} {remaining:%E%h:%M}", - alert=True, + alert=False, alert_percentage=20, charging_color=COLORS['Yellow'], full_color=COLORS['Green'], @@ -103,9 +103,5 @@ status.register("keyboard_locks", caps_on="[CapsLock]", caps_off="") -status.register("shell", - command="~/.i3/window.sh", - interval=0.1) - status.run() From 77076a536e7374d3e5b803dff914ff25aed1f793 Mon Sep 17 00:00:00 2001 From: Ian Adam Naval Date: Tue, 21 Apr 2015 09:49:36 -0400 Subject: [PATCH 3/3] Add email configuration --- bin/README | 4 ++ bin/exchangebook | 56 ++++++++++++++++ mutt/gookbookrc.dotfile | 17 +++++ mutt/mbsyncrc.dotfile | 85 ++++++++++++++++++++++++ mutt/mutt.dotfile/.gitignore | 1 + mutt/mutt.dotfile/alias | 0 mutt/mutt.dotfile/certificates | 0 mutt/mutt.dotfile/crypto | 14 ++++ mutt/mutt.dotfile/gmail | 21 ++++++ mutt/mutt.dotfile/ianonavy.com | 17 +++++ mutt/mutt.dotfile/mailcap | 3 + mutt/mutt.dotfile/school | 24 +++++++ mutt/mutt.dotfile/work | 24 +++++++ mutt/muttrc.dotfile | 116 +++++++++++++++++++++++++++++++++ 14 files changed, 382 insertions(+) create mode 100644 bin/README create mode 100755 bin/exchangebook create mode 100644 mutt/gookbookrc.dotfile create mode 100644 mutt/mbsyncrc.dotfile create mode 100644 mutt/mutt.dotfile/.gitignore create mode 100644 mutt/mutt.dotfile/alias create mode 100644 mutt/mutt.dotfile/certificates create mode 100644 mutt/mutt.dotfile/crypto create mode 100644 mutt/mutt.dotfile/gmail create mode 100644 mutt/mutt.dotfile/ianonavy.com create mode 100644 mutt/mutt.dotfile/mailcap create mode 100644 mutt/mutt.dotfile/school create mode 100644 mutt/mutt.dotfile/work create mode 100644 mutt/muttrc.dotfile diff --git a/bin/README b/bin/README new file mode 100644 index 0000000..d2c9a2d --- /dev/null +++ b/bin/README @@ -0,0 +1,4 @@ +Just a collection of useful programs. I usually just stick all of these in +/usr/local/bin because I am too lazy to have a ~/.bin directory or something +similar. + diff --git a/bin/exchangebook b/bin/exchangebook new file mode 100755 index 0000000..ad3af95 --- /dev/null +++ b/bin/exchangebook @@ -0,0 +1,56 @@ +#!/bin/sh +# Crappy shell script to parse WPI's address book. Designed for mutt. +# Uses LDAP over TLS to query information. +# +# To use in mutt, add this to your .muttrc +# set query_command="/path/to/this/script '%s'" +# +# To combine with goobook, you can just do this: +# set query_command="goobook query '%s'; /path/to/this/script '%s'" + +# pass all arguments to LDAP search +query=$@ + +# authentication +username=ianaval +password=$(pass WPI_UNIX) + +# sketchy, but we don't require verification of TLS certs +# at least we're not transmitting plaintext passwords +export LDAPTLS_REQCERT=never + +# Use WPI's PAM binddn to get the user's binddn +binddn=$(ldapsearch -ZZ -LLL -x -b dc=wpi,dc=edu -H ldap://ldapv2back.wpi.edu/ -D cn=pam,ou=access,dc=wpi,dc=edu -w $(pass ldapv2back) "(|(uid=$username))" dn | awk '{print $2}' 2>/dev/null) + +# Makes names look like "Naval, Ian A." +parse_name() { + case $# in + 2) echo "$2, $1" ;; + 3) echo "$3, $1 ${2:0:1}." ;; + *) echo "$@" ;; + esac +} + +# loop line by line +OIFS="${IFS}" +NIFS=$'\n' +IFS="${NIFS}" +for line in $(ldapsearch -ZZ -LLL -x -H ldap://ldapv2back.wpi.edu/ -D $binddn -w $password -b "dc=wpi,dc=edu" "(|(uid=$query)(cn=*$query*)(displayName=*$query*))" displayName mail 2>/dev/null); do + IFS="${OIFS}" + # parse displayName (might not be in the right order) + if [[ $line =~ displayName* ]]; then + displayName=$(parse_name $(echo "$line" | sed -e 's/displayName: //')) + fi + # parse email + if [[ $line =~ mail* ]]; then + mail=$(echo "$line" | sed -e 's/mail: //') + fi + # print address book record with the group being 'none' + if [[ -n $displayName ]] && [[ -n $mail ]]; then + printf "$mail\t$displayName\tnone\n" + displayName="" + mail="" + fi + IFS="${NIFS}" +done +IFS="${OIFS}" diff --git a/mutt/gookbookrc.dotfile b/mutt/gookbookrc.dotfile new file mode 100644 index 0000000..deb0d37 --- /dev/null +++ b/mutt/gookbookrc.dotfile @@ -0,0 +1,17 @@ +# "#" or ";" at the start of a line makes it a comment. +[DEFAULT] +# If not given here, email and password is taken from .netrc using +# machine google.com +email: ianonavy@gmail.com +passwordeval: pass mbsync +# The following are optional, defaults are shown +cache_filename: ~/.goobook_cache +cache_expiry_hours: 24 +;filter_groupless_contacts: yes +# New contacts will be added to this group in addition to "My Contacts" +# Note that the group has to already exist on google or an error will occur. +# One use for this is to add new contacts to an "Unsorted" group, which can +# be sorted easier than all of "My Contacts". +# searching for groupless users is a bit painful. +default_group:Unsorted + diff --git a/mutt/mbsyncrc.dotfile b/mutt/mbsyncrc.dotfile new file mode 100644 index 0000000..e39eea3 --- /dev/null +++ b/mutt/mbsyncrc.dotfile @@ -0,0 +1,85 @@ +# ------------------------------------------------------------------------------ +# gmail - ianonavy@gmail.com +# ------------------------------------------------------------------------------ +IMAPAccount gmail +Host imap.gmail.com +User ianonavy@gmail.com +PassCmd "pass mbsync" +SSLType IMAPS +SSLVersions TLSv1.2 +CertificateFile /etc/ssl/certs/ca-certificates.crt + +IMAPStore gmail-remote +Account gmail + +MaildirStore gmail-local +# The trailing "/" is important +Path ~/.mail/gmail/ +Inbox ~/.mail/gmail/Inbox + +Channel sync-gmail-default +Master :gmail-remote: +Slave :gmail-local: +# Select some mailboxes to sync +Patterns "INBOX" "Banking" +Create Both +SyncState * + +Channel sync-gmail-archived +Master :gmail-remote:"[Gmail]/All Mail" +Slave :gmail-local:Archived +Create Slave +SyncState * + +Channel sync-gmail-sent +Master :gmail-remote:"[Gmail]/Sent Mail" +Slave :gmail-local:Sent +Create Slave +SyncState * + +Channel sync-gmail-spam +Master :gmail-remote:"[Gmail]/Spam" +Slave :gmail-local:Spam +Create Slave +SyncState * + +Channel sync-gmail-trash +Master :gmail-remote:"[Gmail]/Trash" +Slave :gmail-local:Trash +Create Slave +SyncState * + +# Get all the channels together into a group. +Group gmail +Channel sync-gmail-default +Channel sync-gmail-archived +Channel sync-gmail-sent +Channel sync-gmail-spam +Channel sync-gmail-trash + +# ------------------------------------------------------------------------------ +# school - ianaval@wpi.edu +# ------------------------------------------------------------------------------ +IMAPAccount school +Host exchange.wpi.edu +User ianaval@wpi.edu +PassCmd "pass WPI_Email" +SSLType IMAPS +SSLVersions TLSv1 TLSv1.1 TLSv1.2 +CertificateFile /etc/ssl/certs/ca-certificates.crt + +IMAPStore school-remote +Account school + +MaildirStore school-local +# The trailing "/" is important +Path ~/.mail/school/ +Inbox ~/.mail/school/Inbox + +Channel school +Master :school-remote: +Slave :school-local: +# Select some mailboxes to sync +Patterns * +Create Both +SyncState * diff --git a/mutt/mutt.dotfile/.gitignore b/mutt/mutt.dotfile/.gitignore new file mode 100644 index 0000000..c8eea81 --- /dev/null +++ b/mutt/mutt.dotfile/.gitignore @@ -0,0 +1 @@ +shadow.gpg diff --git a/mutt/mutt.dotfile/alias b/mutt/mutt.dotfile/alias new file mode 100644 index 0000000..e69de29 diff --git a/mutt/mutt.dotfile/certificates b/mutt/mutt.dotfile/certificates new file mode 100644 index 0000000..e69de29 diff --git a/mutt/mutt.dotfile/crypto b/mutt/mutt.dotfile/crypto new file mode 100644 index 0000000..140a0fa --- /dev/null +++ b/mutt/mutt.dotfile/crypto @@ -0,0 +1,14 @@ +# -*-muttrc-*- +set pgp_decode_command="gpg %?p?--passphrase-fd 0? --no-verbose --batch --output - %f" +set pgp_verify_command="gpg --no-verbose --batch --output - --verify %s %f" +set pgp_decrypt_command="gpg --passphrase-fd 0 --no-verbose --batch --output - %f" +set pgp_sign_command="gpg --no-verbose --batch --output - --passphrase-fd 0 --armor --detach-sign --textmode %?a?-u %a? %f" +set pgp_clearsign_command="gpg --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 0x8C8474B3 -- -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 0x8C8474B3 -- -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" +set pgp_list_pubring_command="gpg --no-verbose --batch --with-colons --list-keys %r" +set pgp_list_secring_command="gpg --no-verbose --batch --with-colons --list-secret-keys %r" + diff --git a/mutt/mutt.dotfile/gmail b/mutt/mutt.dotfile/gmail new file mode 100644 index 0000000..71e0a39 --- /dev/null +++ b/mutt/mutt.dotfile/gmail @@ -0,0 +1,21 @@ +# -*-muttrc-*- +set imap_user=ianonavy@gmail.com +set imap_pass=$my_pw_gmail +set folder=/home/ian/.mail/gmail/ +#set mbox=+Archived +set spoolfile=+Inbox +unmailboxes * +mailboxes \ + +Inbox \ + +Archived \ + +Banking \ + +Sent \ + +Trash + +set realname = 'Ian Adam Naval' +set from = ianonavy@gmail.com +set use_from = yes + +set smtp_url=smtps://ianonavy@gmail.com:$my_pw_gmail@smtp.gmail.com +set ssl_force_tls = yes + diff --git a/mutt/mutt.dotfile/ianonavy.com b/mutt/mutt.dotfile/ianonavy.com new file mode 100644 index 0000000..74ebfa9 --- /dev/null +++ b/mutt/mutt.dotfile/ianonavy.com @@ -0,0 +1,17 @@ +# -*-muttrc-*- +set imap_user=ian@ianonavy.com +set imap_pass="$my_pw_ianonavy" +set folder=imaps://ian@ianonavy.com@imap.gmail.com/ +set mbox="imaps://imap.gmail.com/[Gmail]/All Mail" +set spoolfile=+INBOX +mailboxes =INBOX +mailboxes imaps://ian@ianonavy.com@imap.gmail.com/INBOX + +set realname = 'Ian Adam Naval' +set from = ian@ianonavy.com +set use_from = yes + +set smtp_url=smtps://ian@ianonavy.com:$my_pw_ianonavy@smtp.gmail.com +set ssl_force_tls = yes + +account-hook $folder "set imap_user=ian@ianonavy.com imap_pass=$my_pw_ianonavy" diff --git a/mutt/mutt.dotfile/mailcap b/mutt/mutt.dotfile/mailcap new file mode 100644 index 0000000..5061fd5 --- /dev/null +++ b/mutt/mutt.dotfile/mailcap @@ -0,0 +1,3 @@ +text/html; elinks %s; nametemplate=%s.html +text/html; elinks -dump -default-mime-type text/html %s; needsterminal; copiousoutput; +image/*; feh %s; diff --git a/mutt/mutt.dotfile/school b/mutt/mutt.dotfile/school new file mode 100644 index 0000000..619024e --- /dev/null +++ b/mutt/mutt.dotfile/school @@ -0,0 +1,24 @@ +#-*-muttrc-*- +set imap_user=ianaval@wpi.edu +set imap_pass=$my_pw_school +set folder=/home/ian/.mail/school/ +set postponed=+Drafts +set record="+Sent Items" +set mbox=+Archived +set spoolfile=+Inbox +unmailboxes * +mailboxes \ + +Inbox \ + +Archived \ + +Drafts \ + +"Sent Items" \ + +"Junk E-mail" \ + +Trash + +set realname = 'Naval, Ian A' +set from = ianaval@wpi.edu +set use_from = yes + +set smtp_url=smtps://ianaval:$my_pw_school@submission.wpi.edu +set ssl_force_tls = yes + diff --git a/mutt/mutt.dotfile/work b/mutt/mutt.dotfile/work new file mode 100644 index 0000000..952bd81 --- /dev/null +++ b/mutt/mutt.dotfile/work @@ -0,0 +1,24 @@ +# -*-muttrc-*- +set imap_user=ian@adhamonics.com +set imap_pass=$my_pw_work +set folder=imaps://ian@adharmonics.com@imap.gmail.com/ +set mbox="imaps://imap.gmail.com/[Gmail]/All Mail" +set spoolfile=+INBOX + +unmailboxes * +mailboxes \ + +INBOX \ + +"[Gmail]/All Mail" \ + +"[Gmail]/Drafts" \ + +"[Gmail]/Sent Mail" \ + +"[Gmail]/Spam" \ + +"[Gmail]/Trash" + +set realname = 'Ian Adam Naval' +set from = ian@adharmonics.com +set use_from = yes + +set smtp_url=smtps://ian@adharmonics.com:$my_pw_work@smtp.gmail.com +set ssl_force_tls = yes + +account-hook $folder "set imap_user=ian@adharmonics.com imap_pass=$my_pw_work" diff --git a/mutt/muttrc.dotfile b/mutt/muttrc.dotfile new file mode 100644 index 0000000..6cde4bc --- /dev/null +++ b/mutt/muttrc.dotfile @@ -0,0 +1,116 @@ +# -*-muttrc-*- +source "gpg2 -dq $HOME/.mutt/shadow.gpg |"" +source ~/.mutt/crypto + +# PGP ------------------------------------------------ +set pgp_use_gpg_agent = yes +set pgp_autosign = yes +set pgp_auto_decode = yes + +# Index Key Bindings --------------------------------- +bind index gg first-entry +bind index G last-entry +bind index R group-reply +bind index sync-mailbox +bind index collapse-thread + +# Ctrl-R to mark all as read +macro index \Cr "T~UN." "mark all messages as read" +# Ctrl-A to archive all +macro index \Ca "T.*=Archived" "archive all message" + +# Sync email +macro index ss "mbsync -a" + +# Saner copy/move dialogs +macro index C "?" "copy a message to a mailbox" +macro index M "?" "move a message to a mailbox" +macro index,pager A "=Archived" "Archive Message" + +# Goobook +macro index,pager a "goobook add" "add sender to google contacts" +bind editor complete-query + +# Sidebar Navigation --------------------------------- +bind index,pager sidebar-next +bind index,pager sidebar-prev +bind index,pager sidebar-open +macro index b 'toggle sidebar_visible' +macro pager b 'toggle sidebar_visible' +bind index B bounce-message + +# Basic Options -------------------------------------- +set sort = threads # prettier inbox +set wait_key = no # shut up, mutt +set mbox_type = Maildir # mailbox type +set timeout = 3 # idle time before scanning +set mail_check = 0 # minimum time between scans +unset move # gmail does that +set delete # don't ask, just do +unset confirmappend # don't ask, just do! +set quit # don't ask, just do!! +unset mark_old # read/new is good enough for me +set beep_new # bell on new mails +set pipe_decode # strip headers and eval mimes when piping +set thorough_search # strip headers and eval mimes before searching +unset record # gmail saves a copy of the sent message +set query_command = "goobook query '%s'; exchangebook '%s'" +alternative_order text/html text/enriched text/plain +auto_view text/html + +# Paths ---------------------------------------------- +set folder = ~/.mail # mailbox location +set alias_file = ~/.mutt/alias # where to store aliases +set header_cache = ~/.mutt/cache/headers # where to store headers +set message_cachedir = ~/.mutt/cache/bodies # where to store bodies +set certificate_file = ~/.mutt/certificates # where to store certs +set mailcap_path = ~/.mutt/mailcap # entries for filetypes +set tmpdir = ~/.mutt/temp # where to keep temp files + +# Sidebar Patch -------------------------------------- +set sidebar_delim = ' │' +set sidebar_visible = yes +set sidebar_width = 32 +color sidebar_new color221 color233 + +# Status Bar ----------------------------------------- +set status_chars = " *%A" +set status_format = "───[ Folder: %f ]───[%r%m messages%?n? (%n new)?%?d? (%d to delete)?%?t? (%t tagged)? ]───%>─%?p?( %p postponed )?───" + +# Accounts ------------------------------------------- +source "~/.mutt/ianonavy.com" +folder-hook $folder 'source ~/.mutt/ianonavy.com' +macro index,pager oi 'source ~/.mutt/ianonavy.com!' + +source "~/.mutt/work" +folder-hook $folder 'source ~/.mutt/work' +macro index,pager ow 'source ~/.mutt/work!' + +source "~/.mutt/gmail" +folder-hook $folder 'source ~/.mutt/gmail' +macro index,pager og 'source ~/.mutt/gmail!' + +source "~/.mutt/school" +folder-hook $folder 'source ~/.mutt/school' +macro index,pager os 'source ~/.mutt/school!' + +# Palette for use with the Linux console. Black background. +color hdrdefault blue black +color quoted blue black +color signature blue black +color attachment red black +color message brightred black +color error brightred black +color indicator black green +color status brightgreen black +color tree white black +color normal white black +color markers red black +color search white black +color tilde brightmagenta black +color index blue black ~F +color index red black "~N|~O" + +color body brightwhite black '\*+[^*]+\*+' +color body brightwhite black '_+[^_]+_+' +