many small updates
authorMart Lubbers <mart@martlubbers.net>
Thu, 1 Jun 2023 11:31:05 +0000 (13:31 +0200)
committerMart Lubbers <mart@martlubbers.net>
Thu, 1 Jun 2023 11:31:05 +0000 (13:31 +0200)
12 files changed:
cal/.config/vdirsyncer/config
config.h/dwm/config.h
config.h/dwm/dwm
email/.config/mutt/muttrc
email/.local/bin/proofpoint_decoder [new file with mode: 0755]
vim/.vim/after/ftplugin/tex.vim
vim/.vim/pack/plugins/start/vim-LanguageTool [new submodule]
vim/.vim/pack/plugins/start/vimtex
vim/.vim/spell/en.utf-8.add
vim/.vimrc
x/.local/bin/dock.sh
x/.local/bin/undock.sh

index f8c624c..01919df 100644 (file)
@@ -13,6 +13,21 @@ status_path = "~/.local/share/vdirsyncer/status/"
 #default_command = "sync"
 
 # Webcal
+[pair sws]
+a = "sws_web"
+b = "sws_remote"
+collections = null
+
+[storage sws_web]
+type = "http"
+url = "https://calendar.google.com/calendar/ical/673803b665fea319a9af80e9f39d3d7c3310200ca9db88ed073fa872f86a80e5%40group.calendar.google.com/public/basic.ics"
+
+[storage sws_remote]
+type = "caldav"
+url = "https://cal.martlubbers.net/dav.php/calendars/mart/sws/"
+username = "mart"
+password.fetch = ["command", "pass", "show", "caldav_ygdrassil/mart"]
+
 [pair uni]
 a = "uni_web"
 b = "uni_remote"
index ad4a1a7..ec5d1ae 100644 (file)
@@ -38,6 +38,7 @@ static const Rule rules[] = {
 static const float mfact     = 0.55; /* factor of master area size [0.05..0.95] */
 static const int nmaster     = 1;    /* number of clients in master area */
 static const int resizehints = 1;    /* 1 means respect size hints in tiled resizals */
+static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
 
 static const Layout layouts[] = {
        /* symbol     arrange function */
@@ -84,8 +85,8 @@ static Key keys[] = {
        { MODKEY,           XK_b,      togglebar,      {0} },
        { MODKEY,           XK_j,      focusstack,     {.i = +1 } },
        { MODKEY,           XK_k,      focusstack,     {.i = -1 } },
-       { MODKEY,           XK_i,      incnmaster,     {.i = +1 } },
-       { MODKEY,           XK_d,      incnmaster,     {.i = -1 } },
+//     { MODKEY,           XK_i,      incnmaster,     {.i = +1 } },
+//     { MODKEY,           XK_d,      incnmaster,     {.i = -1 } },
        { MODKEY,           XK_h,      setmfact,       {.f = -0.05} },
        { MODKEY,           XK_l,      setmfact,       {.f = +0.05} },
        { MODKEY,           XK_Return, zoom,           {0} },
index 61bb8b2..712d663 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 61bb8b2241d4db08bea4261c82e27cd9797099e7
+Subproject commit 712d6639ff8e863560328131bbb92b248dc9cde7
index 1cf9637..f3b77de 100644 (file)
@@ -16,7 +16,11 @@ source ~/.local/share/offlineimap/mailboxes
 set sendmail="checkattach.sh msmtp -a net"
 set send_charset="us-ascii:utf-8"
 macro index,pager $ "<shell-escape>sync_mail.sh<enter><sync-mailbox>" "Force refresh"
+
+# viewing and printing
 macro attach B "<pipe-entry>firefox \"data:text/html;base64,$(base64 -w 0 <&0)\"<enter>"
+set print_command='set -e; f=`mktemp -p "$HOME"/.cache/mutt`; \
+        muttprint -P A4 -p TO_FILE:"$f"; evince "$f"; rm "$f"'
 
 # Set the correct msmtp account for the different addresses
 send2-hook '~f mart@martlubbers.net'\
@@ -55,12 +59,13 @@ unset markers
 set sort_browser=alpha
 set sort=threads
 set sort_aux=date
-set editor=vim
+set editor="vim -c '%!proofpoint_decoder'"
 set duplicate_threads=yes
 ignore headers *
 unignore headers from to subject date cc
 set mailcap_path=~/.config/mutt/mailcap
 set mailcap_sanitize=yes
+set display_filter="proofpoint_decoder"
 
 # w3m --dump
 auto_view text/html
diff --git a/email/.local/bin/proofpoint_decoder b/email/.local/bin/proofpoint_decoder
new file mode 100755 (executable)
index 0000000..2c1bf23
--- /dev/null
@@ -0,0 +1,114 @@
+#!/usr/bin/env python
+__author__ = 'Eric Van Cleve; Oleksandr Vlasiuk'
+__license__ = 'GPL v.3'
+__version__ = '4.0'
+__email__ = 'oleksandr.vlasiuk@gmail.com'
+__status__ = 'beta'
+
+
+import sys
+import re
+from base64 import urlsafe_b64decode
+# Uncomment for Python 2
+# import string
+# if sys.version_info[0] < 3:
+#     from urllib import unquote
+#     import HTMLParser
+#     htmlparser = HTMLParser.HTMLParser()
+#     unescape = htmlparser.unescape
+#     from string import maketrans
+# else:
+from urllib.parse import unquote
+from html import unescape
+maketrans = str.maketrans
+
+
+class URLDecoder:
+
+    def __init__(self):
+        URLDecoder.ud_pattern = re.compile(r'http.+?urldefense(?:\.proofpoint)?\.com/(v[0-9])/')
+        URLDecoder.v1_pattern = re.compile(r'u=(?P<url>.+?)&k=')
+        URLDecoder.v2_pattern = re.compile(r'http.+?urldefense\.proofpoint\.com/v2/url\?u=(?P<url>.+?)&[dc]=.*?&e=')
+        URLDecoder.v3_pattern = re.compile(r'http.+?urldefense\.com/v3/__(?P<url>.+?)__;(?P<enc_bytes>.*?)!.*?\$')
+        URLDecoder.v3_token_pattern = re.compile("\*(\*.)?")
+        URLDecoder.v3_run_mapping = {'A': 2, 'B': 3, 'C': 4, 'D': 5, 'E':
+                                            6, 'F': 7, 'G': 8, 'H': 9, 'I': 10,
+                                            'J': 11, 'K': 12, 'L': 13, 'M': 14,
+                                            'N': 15, 'O': 16, 'P': 17, 'Q': 18,
+                                            'R': 19, 'S': 20, 'T': 21, 'U': 22,
+                                            'V': 23, 'W': 24, 'X': 25, 'Y': 26,
+                                            'Z': 27, 'a': 28, 'b': 29, 'c': 30,
+                                            'd': 31, 'e': 32, 'f': 33, 'g': 34,
+                                            'h': 35, 'i': 36, 'j': 37, 'k': 38,
+                                            'l': 39, 'm': 40, 'n': 41, 'o': 42,
+                                            'p': 43, 'q': 44, 'r': 45, 's': 46,
+                                            't': 47, 'u': 48, 'v': 49, 'w': 50,
+                                            'x': 51, 'y': 52, 'z': 53, '0': 54,
+                                            '1': 55, '2': 56, '3': 57, '4': 58,
+                                            '5': 59, '6': 60, '7': 61, '8': 62,
+                                            '9': 63, '-': 64, '_': 65}
+        URLDecoder.safelinks = re.compile(r'http.+?\.safelinks\.protection\.outlook\.com/\?url=(?P<url>.+?)&(?:amp;)?data=.*?reserved=0')
+
+    def decode(self, line):
+        match = self.ud_pattern.search(line)
+        match_safelinks = self.safelinks.search(line)
+        if match:
+            if match.group(1) == 'v1':
+                line =  self.v1_pattern.sub(self.unescquote, line)
+            elif match.group(1) == 'v2':
+                line = self.v2_pattern.sub(self.decode_v2, line)
+            elif match.group(1) == 'v3':
+                line = self.v3_pattern.sub(self.decode_v3, line)
+        if match_safelinks:
+            line = self.safelinks.sub(self.unescquote, line)
+        return line
+
+    def unescquote(self, match):
+        return unescape(unquote(match.group('url')))
+
+    def decode_v2(self, match):
+        trans = maketrans('-_', '%/')
+        url_encoded_url = match.group('url').translate(trans)
+        return unescape(unquote(url_encoded_url))
+
+    def decode_v3(self, match):
+        def replace_token(token):
+            if token == '*':
+                character = self.dec_bytes[self.current_marker]
+                self.current_marker += 1
+                return character
+            if token.startswith('**'):
+                run_length = self.v3_run_mapping[token[-1]]//2
+                run = self.dec_bytes[self.current_marker:self.current_marker+run_length]
+                self.current_marker += run_length
+                return run
+
+        def substitute_tokens(text, start_pos=0):
+            match = self.v3_token_pattern.search(text, start_pos)
+            if match:
+                start = text[start_pos:match.start()]
+                built_string = start
+                token = text[match.start():match.end()]
+                built_string += replace_token(token)
+                built_string += substitute_tokens(text, match.end())
+                return built_string
+            else:
+                return text[start_pos:len(text)]
+
+        url = match.group('url')
+        encoded_url = unquote(url)
+        enc_bytes = match.group('enc_bytes')
+        enc_bytes += '=='
+        self.dec_bytes = (urlsafe_b64decode(enc_bytes)).decode('utf-8')
+        self.current_marker = 0
+        return substitute_tokens(encoded_url)
+
+
+
+def main():
+    urldec = URLDecoder()
+    for line in sys.stdin:
+#        sys.stdout.write(urldec.decode(line))
+        sys.stdout.write(line)
+if __name__ == '__main__':
+    main()
index 4743f66..c34baab 100644 (file)
@@ -6,7 +6,13 @@ setlocal colorcolumn=0
 let g:vimtex_toc_enabled = 1
 let g:vimtex_toc_help = 0
 let g:vimtex_toc_refresh_always = 1
+let g:vimtex_subfile_start_local = 1
 
 let g:vimtex_view_general_viewer = 'okular'
 let g:vimtex_view_general_options = '--unique file:@pdf\#src:@line@tex'
 let g:vimtex_view_general_options_latexmk = '--unique'
+
+"let g:vimtex_indent_ignored_envs = [
+"      \ 'document',
+"    \ 'lst.*',
+"    \]
diff --git a/vim/.vim/pack/plugins/start/vim-LanguageTool b/vim/.vim/pack/plugins/start/vim-LanguageTool
new file mode 160000 (submodule)
index 0000000..0372ffa
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit 0372ffae78aa3eac3bfa48ba3bf2f4015a86385a
index cf6ac50..c77ec4e 160000 (submodule)
@@ -1 +1 @@
-Subproject commit cf6ac500f45d7cce4a52d6bdb4ecbec811922fbc
+Subproject commit c77ec4e15768ffcb97a96d1bf2df1ef58e94acdd
index abadc9e..8457f37 100644 (file)
@@ -38,3 +38,4 @@ quasiquoters
 capturable
 reification
 reifies
+tierless
index 5cff236..42aaff4 100644 (file)
@@ -83,6 +83,8 @@ let g:syntastic_auto_loc_list = 1
 let g:syntastic_check_on_open = 0
 let g:syntastic_check_on_wq = 0
 
+let g:syntastic_clean_checkers = ['eastwood']
+
 " Vimwiki
 let g:vimwiki_list = [{'path': '~/projects/kaartenbak'}]
 
index b05de71..91d5037 100755 (executable)
@@ -5,4 +5,10 @@ setxkbmap dvorak,ru ,phonetic_dvorak compose:ralt,grp:shifts_toggle,grp_led:scro
 sudo ifdown enp0s31f6
 sudo ifdown wlp1s0
 sudo ifup enp0s31f6
+if ! ping -w 3 192.168.1.101
+then
+       echo "ygdrassil wasn't awake, waking up"
+       wakeonlan 78:F2:9E:90:8B:3A
+       sleep 5
+fi
 mount /mnt/data
index 6b3e0af..63bdc0a 100755 (executable)
@@ -7,5 +7,5 @@ setxkbmap -option
 setxkbmap dvorak,ru ,phonetic_dvorak ctrl:swapcaps,compose:ralt,grp:shifts_toggle,grp_led:scroll
 if mountpoint /mnt/data
 then
-       umount /mnt/data
+       umount -l /mnt/data
 fi