Skip to content

Instantly share code, notes, and snippets.

View pohlt's full-sized avatar

Tom Pohl pohlt

View GitHub Profile
@JanTvrdik
JanTvrdik / .bashrc
Last active May 31, 2024 08:15 — forked from gsomoza/.bashrc
ssh-agent support for Git Bash / MinGW / msys / Windows
# 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
@oconnor663
oconnor663 / rw.py
Created September 2, 2015 00:17
reading and writing from an os.pipe() in asyncio
#! /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())
@dariodip
dariodip / Dockerfile
Created September 21, 2017 09:45
Cython in a Docker container
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"]
@mightymercado
mightymercado / worker.py
Last active June 16, 2024 05:25
Send data to a multiprocessing.Process running an asyncio event loop
# 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()
@jeremykdev
jeremykdev / create-eml-file.py
Created May 1, 2021 21:04
Python script to create an eml file
# 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"