updated yazi conf. nvim completions and latex
This commit is contained in:
0
scripts/scripts/a.out
Normal file
0
scripts/scripts/a.out
Normal file
5
scripts/scripts/email2vcf.sh
Executable file
5
scripts/scripts/email2vcf.sh
Executable file
@@ -0,0 +1,5 @@
|
||||
# Convert your aerc/maildir to vCards
|
||||
em2vcf /mnt/flash1/mail-server/mail/maildir/ \
|
||||
--output-folder ~/.contacts_mail/ \
|
||||
--no-duplicates \
|
||||
--overwrite
|
||||
43
scripts/scripts/maildir2vcf.sh
Executable file
43
scripts/scripts/maildir2vcf.sh
Executable file
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env python3
|
||||
# ~/.local/bin/maildir2vcf
|
||||
import email, os, sys, pathlib, fileinput
|
||||
|
||||
MAILDIR = pathlib.Path.home()/ "Mail" # ← change if your mail sits elsewhere
|
||||
OUTDIR = pathlib.Path.home()/ ".contacts_mail"
|
||||
OUTDIR.mkdir(exist_ok=True)
|
||||
|
||||
seen = set() # de-duplicate on lower-case e-mail
|
||||
|
||||
def vcard(name, mail):
|
||||
safe_name = name.replace(";", " ").strip() or "No Name"
|
||||
safe_mail = mail.strip().lower()
|
||||
if safe_mail in seen: # already exported
|
||||
return
|
||||
seen.add(safe_mail)
|
||||
fn = OUTDIR/f"{safe_mail}.vcf"
|
||||
fn.write_text(f"""\
|
||||
BEGIN:VCARD
|
||||
VERSION:3.0
|
||||
FN:{safe_name}
|
||||
EMAIL:{safe_mail}
|
||||
END:VCARD
|
||||
""")
|
||||
|
||||
def addresses_from_msg(path):
|
||||
with open(path, "rb") as f:
|
||||
msg = email.message_from_binary_file(f)
|
||||
for hdr in ("From", "To", "Cc", "Bcc"):
|
||||
for addr in email.utils.getaddresses(msg.get_all(hdr, [])):
|
||||
name, mail = addr
|
||||
if "@" in mail:
|
||||
vcard(name, mail)
|
||||
|
||||
# walk cur/ + new/ (typical Maildir layout)
|
||||
for sub in ("cur", "new"):
|
||||
for root, _, files in os.walk(MAILDIR/sub):
|
||||
for file in files:
|
||||
if file.startswith("."):
|
||||
continue
|
||||
addresses_from_msg(pathlib.Path(root)/file)
|
||||
|
||||
print("Exported", len(seen), "unique addresses →", OUTDIR)
|
||||
0
scripts/scripts/newfile.vcf
Normal file
0
scripts/scripts/newfile.vcf
Normal file
Reference in New Issue
Block a user