Skip to content

Instantly share code, notes, and snippets.

@samuraisam
samuraisam / parse_accept.py
Created May 16, 2012 21:43
Parse an accept header in Python w/ support for vendor types
# The author disclaims copyright to this source code. In place of a legal
# notice, here is a blessing:
#
# May you do good and not evil.
# May you find forgiveness for yourself and forgive others.
# May you share freely, never taking more than you give.
#
# It is based on a snipped found in this project:
# https://github.com/martinblech/mimerender
@waylan
waylan / subprocess_pipe.md
Created April 10, 2012 19:12
Writing to a python subprocess pipe

Here's a few things I tried to write output to a python subprocess pipe.

from subprocess import Popen, PIPE

p = Popen('less', stdin=PIPE)
for x in xrange(100):
    p.communicate('Line number %d.\n' % x)