This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Prototype to create an eml file using python | |
import os | |
import uuid | |
from email import generator | |
from email.mime.multipart import MIMEMultipart | |
from email.mime.text import MIMEText | |
# where to write the output file | |
directory = "C:\\Users\\Jeremy\Documents\\python\\email-prototype\\temp" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A rare scenario: Communicate to a child process that's running an event loop | |
import asyncio | |
from asyncio import StreamReader, StreamReaderProtocol | |
from multiprocessing import Process | |
import os | |
class Worker: | |
def __init__(self): | |
self.read_fd, self.write_fd = os.pipe() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM python:3.6 | |
WORKDIR /app | |
ADD . /app | |
RUN pip install -r requirements.txt | |
RUN python setup.py build_ext --inplace | |
ENTRYPOINT ["python"] | |
CMD ["app.py"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/python | |
import asyncio | |
import os | |
@asyncio.coroutine | |
def do_writing(writer): | |
for i in range(1, 4): | |
writer.write(("stuff " + str(i)).encode()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# put this in ~/.bashrc | |
export SSH_AUTH_SOCK=/tmp/.ssh-socket | |
ssh-add -l > /dev/null | |
if [ $? = 2 ]; then | |
rm -f $SSH_AUTH_SOCK | |
echo Starting new ssh-agent... | |
eval $(ssh-agent -a $SSH_AUTH_SOCK) > /dev/null | |
ssh-add && echo "ssh-agent set up successfully with the following keys:" && ssh-add -l | |
fi |