Skip to content

Instantly share code, notes, and snippets.

Mark Nottingham mnot

Block or report user

Report or block mnot

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mnot
mnot / uri_validate.py
Last active Jul 22, 2019
uri_validate.py: Validation regex for URIs, URI references, and relative URIs
View uri_validate.py
#!/usr/bin/env python
"""
Regex for URIs
These regex are directly derived from the collected ABNF in RFC3986
(except for DIGIT, ALPHA and HEXDIG, defined by RFC2234).
Additional regex are defined to validate the following schemes according to
their respective specifications:
@mnot
mnot / link_header.py
Created Oct 15, 2009
link_header.py: HTTP Link header parsing
View link_header.py
@mnot
mnot / rename with date.applescript
Created Oct 29, 2009
Applescript to rename a selected file, appending the current date
View rename with date.applescript
(*
Rename with Date 0.1
Copyright 2004 Mark Nottingham <mnot@pobox.com>
THIS SOFTWARE IS SUPPLIED WITHOUT WARRANTY OF ANY KIND, AND MAY BE
COPIED, MODIFIED OR DISTRIBUTED IN ANY WAY, AS LONG AS THIS NOTICE
AND ACKNOWLEDGEMENT OF AUTHORSHIP REMAIN.
*)
@mnot
mnot / libxslt_web.py
Created Oct 29, 2009
libxslt_web.py: use XSLT on the "normal" Web
View libxslt_web.py
#!/usr/bin/env python2.4
"""
libxslt_web - XSLT Extension Functions for the HTML Web
This is a set of XSLT extension functions that give access to HTTP mechanisms and HTML
documents (even those that are invalid) on the Web.
In particular, it offers;
- GET and POST support, with control over the POST body and content-type
@mnot
mnot / RSS.py
Created Oct 29, 2009
RSS.py: work with RSS channels as data structures
View RSS.py
#!/usr/bin/env python
"""
RSS.py
Classes for working with RSS channels as arbitrary data structures.
Requires Python 2.2 or newer and PyXML 0.7.1 or newer.
ChannelBase - Base class for RSS Channels.
CollectionChannel - RSS Channel modeled as a URI-per-entry
@mnot
mnot / sparkogram.py
Created Oct 29, 2009
sparkogram.py: Sparkline histogram generator
View sparkogram.py
#!/usr/bin/env python
"""
sparkogram.py - Sparkline histogram generator
This is quick and dirty. Based on Joe Gregorio's sparkline thoughts;
<http://bitworking.org/news/Sparklines_in_data_URIs_in_Python>.
"""
__license__ = """
@mnot
mnot / c_zlib.py
Created Nov 25, 2009
c_zlib.py: zlib for Python using ctypes
View c_zlib.py
#!/usr/bin/env python
"""
c_zlib - zlib for Python using ctypes.
This is a quick and nasty implementation of zlib using Python ctypes, in order to expose the ability
to set a compression dictionary (which isn't available in the zlib module).
"""
__license__ = """
@mnot
mnot / isodate.py
Created Dec 1, 2009
isodate.py: W3C datetime functions
View isodate.py
#!/usr/bin/env python
"""
isodate.py
Functions for manipulating a subset of ISO8601 date, as specified by
<http://www.w3.org/TR/NOTE-datetime>
Exposes:
- parse(s)
@mnot
mnot / urlnorm.py
Created Dec 1, 2009
urlnorm.py: URL normalisation
View urlnorm.py
#!/usr/bin/env python
"""
urlnorm.py - URL normalisation routines
urlnorm normalises a URL by;
* lowercasing the scheme and hostname
* taking out default port if present (e.g., http://www.foo.com:80/)
* collapsing the path (./, ../, etc)
* removing the last character in the hostname if it is '.'
@mnot
mnot / http_conn_timer.py
Created Dec 20, 2009
http_conn_timer.py: find out how long a HTTP server keeps connections open
View http_conn_timer.py
#!/usr/bin/env python
"""
http_conn_timer.py
by Mark Nottingham <mnot@pobox.com>
How long does a given HTTP server hold persistent connections open?
Requires Twisted <http://twistedmatrix.com/>
"""
You can’t perform that action at this time.