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)
import shlex | |
import re | |
# Testing shlex with Unicode. | |
# | |
# The shlex module does not support Unicode input. Which workaround is faster? | |
# Sample string. Using an Attribute List from Maruku's syntax: | |
# http://maruku.rubyforge.org/proposal.html#attribute_lists | |
t = u'.foo #bar class=foo ref title="Foo \xc3 bar."' |
import re | |
# This is using html entities. Not sure if I want to use these. | |
# But this shouldn't effect the times. | |
escape_table = { | |
'\\': '\', # backslash | |
'`' : '`', # backtick | |
'*' : '*', # asterisk | |
'_' : '_', # underscore |
#!/usr/bin/env python | |
""" | |
Math extension for Python-Markdown | |
Copied from http://freewisdom.org/projects/python-markdown/mdx_math for preservation. | |
The following description was attached by the author: | |
> This is a quick and dirty implementation of allowing <math> LaTeX </math> to do |
from __future__ import print_function | |
import os | |
import sys | |
from tempfile import mkstemp | |
from subprocess import call | |
def run_editor(txt): | |
""" Edit the given text in the system default text editor. """ | |
import urlparse | |
formats = [ | |
'[email protected]:org-or-user/project.git', # ssh read/write | |
'git://github.com/org-or-user/project.git', # ssh read | |
'https://[email protected]/org-or-user/project.git', # http read/write | |
'https://github.com/org-or-user/project.git' # http read | |
] | |
for format in formats: |
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)
#Marking up Code
In reviewing syntax highlighters, I have observed that there are as many different ways to mark up a code fragment in HTML as there are highlighting tools. In other words, every tool seems to define a different syntax. Some use pre
tags, some use 'code' tags, some use both, and then there are those that use other elements like div
tags.
The most obvious problem with this is that if you want to switch to a different tool, you need to change all your old HTML documents to use the new syntax; which could be a real time suck. Sure the process could be automated, but writing a bug-free script could become just as painful as making the changes manually.
Another, perhaps less obvious issue is the semantics of the markup used. Does the markup accurately convey what the content actually is? For example, many people use pre
tags around code. Of course, the pre
element is specifically for "preformatted text" which code often is. However, some have argued that preformatted text is presentatio
# Byte-compiled / optimized / DLL files | |
__pycache__/ | |
*.py[cod] | |
*$py.class | |
# C extensions | |
*.so | |
# Distribution / packaging | |
.Python |
waylan@dev:~$ mkdir foo | |
waylan@dev:~$ cd foo | |
waylan@dev:~/foo$ git init | |
Initialized empty Git repository in /home/waylan/foo/.git/ | |
waylan@dev:~/foo$ echo "foo" > README | |
waylan@dev:~/foo$ git add README | |
waylan@dev:~/foo$ git commit -m 'Added README' | |
[master (root-commit) 1f31bb3] Added README | |
1 files changed, 1 insertions(+), 0 deletions(-) | |
create mode 100644 README |