--- a/mutt/offlineimap.py Wed Aug 03 11:31:26 2011 -0400
+++ b/mutt/offlineimap.py Wed Aug 03 16:45:59 2011 -0400
@@ -1,12 +1,16 @@
#!/usr/bin/python
-import re, commands
+import re, subprocess
def get_keychain_pass(account=None, server=None):
params = {
'security': '/usr/bin/security',
'command': 'find-internet-password',
'account': account,
- 'server': server
+ 'server': server,
+ 'keychain': '/Users/sjl/Library/Keychains/login.keychain',
}
- command = "%(security)s %(command)s -g -a %(account)s -s %(server)s" % params
- outtext = commands.getoutput(command)
- return re.match(r'password: "(.*)"', outtext).group(1)
\ No newline at end of file
+ command = "sudo -u sjl %(security)s -v %(command)s -g -a %(account)s -s %(server)s %(keychain)s" % params
+ output = subprocess.check_output(command, shell=True, stderr=subprocess.STDOUT)
+ outtext = [l for l in output.splitlines()
+ if l.startswith('password: ')][0]
+
+ return re.match(r'password: "(.*)"', outtext).group(1)
--- a/mutt/offlineimapsync.sh Wed Aug 03 11:31:26 2011 -0400
+++ b/mutt/offlineimapsync.sh Wed Aug 03 16:45:59 2011 -0400
@@ -3,6 +3,16 @@
PID=`cat ~/.offlineimap/pid`
ps aux | grep "[ ]$PID" && kill $PID
-/usr/local/bin/offlineimap -o -u Noninteractive.Quiet &>/dev/null &
+function sync_normal {
+ echo "NORMAL Sync"
+ /usr/local/bin/offlineimap -o -u quiet
+}
+function sync_quick {
+ echo "QUICK Sync"
+ /usr/local/bin/offlineimap -o -q -u quiet
+}
+
+# This is silly.
+python -c'import sys, random; sys.exit(random.randint(0, 5))' && sync_normal || sync_quick
exit 0
--- a/mutt/offlineimapsyncquick.sh Wed Aug 03 11:31:26 2011 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-#!/bin/sh
-
-PID=`cat ~/.offlineimap/pid`
-ps aux | grep "[ ]$PID" && kill $PID
-
-/usr/local/bin/offlineimap -q -o -u Noninteractive.Quiet &>/dev/null &
-
-exit 0
--- a/vim/.vimrc Wed Aug 03 11:31:26 2011 -0400
+++ b/vim/.vimrc Wed Aug 03 16:45:59 2011 -0400
@@ -48,6 +48,9 @@
set fillchars=diff:\
set ttimeout
+" Make Vim able to edit crontab files again.
+set backupskip=/tmp/*,/private/tmp/*"
+
" Save when losing focus
au FocusLost * :wa