This file contains hidden or 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
$ diff file-before.txt file-after.txt | |
1a2,3 | |
> xcd | |
> x8f | |
77a80,89 | |
> xcd | |
> x87 | |
> xcd | |
> x88 | |
> xcd |
This file contains hidden or 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/env python | |
import sys, re, glob, urllib | |
r_header = re.compile('(?is)<header>(.*?)</header>') | |
r_section = re.compile('(?is)<section>(.*?)</section>') | |
r_src = re.compile(r'src="(.*?)"') | |
r_datetime = re.compile(r'datetime="(.*?)"') | |
print '<!DOCTYPE html>' |
This file contains hidden or 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/env python | |
import time, calendar, datetime | |
input = '2011-05-26T16:02:59.199400+00:00' | |
input = input.split('.', 1)[0] | |
input = input.split('+', 1)[0] | |
then = time.strptime(input, '%Y-%m-%dT%H:%M:%S') | |
then = datetime.datetime.utcfromtimestamp(calendar.timegm(then)) |
This file contains hidden or 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/env python | |
import time, calendar, datetime | |
input = '2011-05-26T16:02:59.199400+00:00' | |
def dttz(input): | |
if '+' in input: | |
return input.split('+', 1) | |
else: return input, None |
This file contains hidden or 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/env python | |
import sys, re | |
with open(sys.argv[1], 'rb') as f: | |
text = unicode(f.read(), 'utf-8') | |
r_paragraph = re.compile(ur'^|(?<=\n\n)(?=\S)') | |
r_link = re.compile(ur'(?s)(?<!\\)\*([^*]+)\*(\W?)\s+(\S*[./]\S+)') | |
r_em = re.compile(ur'(?<!\\)\*([^*]+)\*') |
This file contains hidden or 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/env python | |
'Atom Script, by Sean B. Palmer' | |
import os, re, cgi | |
r_title = re.compile('(?s)<title>(.*?), by (.*?)</title>') | |
r_entry = re.compile('(?s)<div([^>]+)>(.*?)</div>') | |
r_attrs = re.compile('(?s)([a-z-]+)="([^"]+)"') | |
with open('index.html') as f: bytes = f.read() | |
title, author = r_title.search(bytes).groups() |
This file contains hidden or 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
#!/bin/sh | |
export PYTHONPATH=$HOME/usr/opt/pyyaml/lib/python2.6/site-packages | |
python -c ' | |
import sys, json, yaml | |
with open(sys.argv[1]) as f: | |
print yaml.safe_dump(json.load(f), default_flow_style=False) | |
' $@ |
This file contains hidden or 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/env python | |
import sys | |
name = sys.argv[1] | |
print '<!DOCTYPE html>' | |
print '<title>%s</title>' % name | |
print '<meta charset="utf-8">' | |
print '<link rel="stylesheet" href="style.css">' |
This file contains hidden or 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
13,15c13,15 | |
< wikiuri = 'http://en.wikipedia.org/wiki/%s' | |
< wikisearch = 'http://en.wikipedia.org/wiki/Special:Search?' \ | |
< + 'search=%s&fulltext=Search' | |
--- | |
> wikiuri = 'http://%s.wikipedia.org/wiki/%s' | |
> # wikisearch = 'http://%s.wikipedia.org/wiki/Special:Search?' \ | |
> # + 'search=%s&fulltext=Search' | |
62c62 | |
< def wikipedia(term, last=False): |
This file contains hidden or 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
$ diff -Naur schemadoc-2006-12-21.py schemadoc.py | |
--- schemadoc-2006-12-21.py 2006-12-21 17:31:40.000000000 +0000 | |
+++ schemadoc.py 2011-05-10 18:08:38.000000000 +0100 | |
@@ -6,7 +6,7 @@ | |
""" | |
import sys | |
-from rdflib.Graph import ConjunctiveGraph as Graph | |
+from rdflib import ConjunctiveGraph as Graph | |
from rdflib import URIRef, Literal, BNode, Namespace |