Skip to content

Commit

Permalink
updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
tdeebswihart committed Apr 1, 2019
1 parent d072fb8 commit 6e49c71
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 12 deletions.
10 changes: 7 additions & 3 deletions bin/watchman-process-files.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import os
import re
import sys
from subprocess import check_output, STDOUT
from subprocess import check_output, STDOUT, CalledProcessError
from tempfile import NamedTemporaryFile

add_tmpl = ' add files {{POSIX file "{name}"}} by moving to ({fldr}) with tags {{{tags}}}'
Expand All @@ -19,7 +19,7 @@
repeat until top level folder is not missing value
delay 1
end repeat
set inbox to get folder id "A13B9FE9-7094-475F-8E9B-2452B3DEDCF0"
set inbox to default import destination
{items}
end tell
"""
Expand Down Expand Up @@ -142,7 +142,11 @@ def process_file(rules, variables, path: str, state: dict):
scpt = script.format(items='\n'.join(items))
tempf.write(scpt)
tempf.flush()
out = check_output(['/usr/bin/osascript', tempf.name], stderr=STDOUT)
try:
out = check_output(['/usr/bin/osascript', tempf.name], stderr=STDOUT)
except CalledProcessError as e:
print(e)
raise
if out and out.strip() != b'true':
print(out.decode())

Expand Down
12 changes: 6 additions & 6 deletions etc/stubby/stubby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ upstream_recursive_servers:
tls_auth_name: "cloudflare-dns.com"

## Quad 9 'secure' service - Filters, does DNSSEC, doesn't send ECS
- address_data: 9.9.9.9
tls_auth_name: "dns.quad9.net"
- address_data: 149.112.112.112
tls_auth_name: "dns.quad9.net"
# - address_data: 9.9.9.9
# tls_auth_name: "dns.quad9.net"
# - address_data: 149.112.112.112
# tls_auth_name: "dns.quad9.net"

####### IPv6 addresses ######
## Cloudflare servers
Expand All @@ -31,5 +31,5 @@ upstream_recursive_servers:
tls_auth_name: "cloudflare-dns.com"

## Quad 9 'secure' service - Filters, does DNSSEC, doesn't send ECS
- address_data: 2620:fe::fe
tls_auth_name: "dns.quad9.net"
# - address_data: 2620:fe::fe
# tls_auth_name: "dns.quad9.net"
2 changes: 1 addition & 1 deletion hammerspoon/collection-scripts/com.apple.mail.scpt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
mail-archive
-- Import selected Mail messages & attachments to DEVONthink Pro.-- Created by Christian Grunenberg on Mon Mar 05 2012.-- Copyright (c) 2012-2015. All rights reserved.-- this string is used when the message subject is emptyproperty pNoSubjectString : "(no subject)"on date_to_iso(dt) set {year:y, month:m, day:d} to dt set y to text 2 through -1 of ((y + 10000) as text) set m to text 2 through -1 of ((m + 100) as text) set d to text 2 through -1 of ((d + 100) as text) return y & "-" & m & "-" & dend date_to_isoon year_from_date(dt) set {year:y, month:m, day:d} to dt return (text 2 through -1 of ((y + 10000) as text)) & ""end year_from_datetell application "Mail" try set theSelection to the selection set theFolder to (POSIX path of (path to temporary items)) if the length of theSelection is less than 1 then error "One or more messages must be selected." repeat with theMessage in theSelection my importMessage(theMessage, theFolder) end repeat on error error_message number error_number if error_number is not -128 then display alert "Mail" message error_message as warning end tryend tellon importMessage(theMessage, theFolder) tell application "Mail" try tell theMessage set {theDateReceived, theDateSent, theSender, theSubject, theSource, theReadFlag} to {the date received, the date sent, the sender, subject, the source, the read status} set theISODate to my date_to_iso(theDateReceived) set theName to theISODate & " " & theSubject & ".eml" set theYear to my year_from_date(theDateReceived) end tell if theSubject is equal to "" then set theSubject to pNoSubjectString set theAttachmentCount to count of mail attachments of theMessage tell application "Keep It" repeat until top level folder is not missing value delay 1 end repeat set theGroup to default import destination if theAttachmentCount is greater than 0 then set theGroup to (make new folder in theGroup with properties {name:theSubject}) add text theSource as plain text file in theGroup with name theName end tell on error error_message number error_number if error_number is not -128 then display alert "Mail" message error_message as warning end try end tellend importMessage
Expand Down
2 changes: 1 addition & 1 deletion hammerspoon/global.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ end
function collectFromFrontmostApp()
local app = helpers.currentApp()
if app == nil then return end
local bundleID = app:bundleID()
local bundleID = string.lower(app:bundleID())
local scpt = os.getenv("HOME") .. "/.hammerspoon/collection-scripts/" .. bundleID .. ".scpt"
local js = os.getenv("HOME") .. "/.hammerspoon/collection-scripts/" .. bundleID .. ".js"
if helpers.fexists(scpt) then
Expand Down
2 changes: 1 addition & 1 deletion hammerspoon/mail.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
local module = {}
module.keybinds = {
hs.hotkey.bind({"ctrl", "cmd"}, "a", function ()
hs.osascript.applescriptFromFile("~/.hammerspoon/collection-scripts/keepit-com.apple.Mail.scpt")
hs.osascript.applescriptFromFile("~/.hammerspoon/collection-scripts/com.apple.mail.scpt")
end)}

for k, binding in pairs(module.keybinds) do
Expand Down

0 comments on commit 6e49c71

Please sign in to comment.