Timely commit

This commit is contained in:
Geoffrey Frogeye 2020-06-28 11:23:02 +02:00
parent 8d85bd63da
commit 6cdd924613
4 changed files with 98 additions and 2 deletions

77
config/scripts/smtpdummy Executable file
View file

@ -0,0 +1,77 @@
#!/usr/bin/env python3
import argparse
import datetime
import time
import email.utils
import subprocess
import pprint
def command(command: str) -> None:
cmd = command.encode() + b"\n"
subprocess.run(["xdotool", "type", "--file", "-"], input=cmd)
time.sleep(2)
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="Generate SMTP messages to send a mail"
)
now = datetime.datetime.now()
now_email = email.utils.formatdate(now.timestamp(), True)
parser.add_argument("-s", "--sender", default="geoffrey@frogeye.fr")
parser.add_argument("-r", "--receiver", default="geoffrey@frogeye.fr")
parser.add_argument("-l", "--helo", default="frogeye.fr")
parser.add_argument(
"-o", "--subject", default=f"Test message {now.strftime('%H:%M:%S')}"
)
parser.add_argument("-m", "--me", default="Geoffrey")
parser.add_argument("-d", "--debug", action="store_true")
args = parser.parse_args()
if args.debug:
command = print
text = f"""Date: {now_email}
From: {args.sender}
Subject: {args.subject}
To: {args.receiver}
Hello there,
This is a test message, generated from a template.
If you didn't expect to see this message, please contact {args.me}.
Greetings,
Input arguments:
{pprint.pformat(args, indent=4)}
--
{args.me}
."""
if not args.debug:
for i in range(5, 0, -1):
print(f"Typing mail in {i}…")
time.sleep(1)
command(f"HELO {args.helo}")
command(f"MAIL FROM: <{args.sender}>")
command(f"RCPT TO: <{args.receiver}>")
command("DATA")
command(text)
command("QUIT")
print("Done")
# For reference:
# command("RSET")
# command("VRFY")
# command("NOOP")
# command("QUIT")

View file

@ -147,10 +147,11 @@ i p7zip # Unarchive 7z files
if $INSTALL_PASSWORD
then
i pwgen # Password generator
i gopass || i pass # Password manager
i pass # Password manager
if $INSTALL_GUI
then
i rofi-pass # Password selector
# i autopass.cr # Password selector
fi
fi

18
config/scripts/spongebob Executable file
View file

@ -0,0 +1,18 @@
#!/usr/bin/env python
import sys
import random
# maj = True
for line in sys.stdin:
new_line = ""
for c in line:
maj = random.random() > 0.5
if maj:
nc = c.upper()
else:
nc = c.lower()
new_line += nc
# maj = not maj
print(new_line, end="")

View file

@ -75,5 +75,5 @@ elif [[ $USER == 'geoffrey' ]]; then
else
col=33;
fi
export PS1="\[\e]2;\u@\h \w\a\]\[\e[0;37m\][\[\e[0;${col}m\]\u\[\e[0;37m\]@\[\e[0;34m\]\h \[\e[0;36m\]\W\[\e[0;37m\]]\$\[\e[0m\] "
export PS1="\[\e]2;\u@\H \w\a\]\[\e[0;37m\][\[\e[0;${col}m\]\u\[\e[0;37m\]@\[\e[0;34m\]\h \[\e[0;36m\]\W\[\e[0;37m\]]\$\[\e[0m\] "