This file contains 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
// simple & dirty node.js server to test how a client deals with two Content-Length headers. | |
function handle(req, res) { | |
res.writeHead(200, { | |
'Content-Length': '15', | |
}); | |
m = res._header.split("\r\n"); | |
console.log(m); | |
res._header = [m[0], "Content-Length: 10", ""].join("\r\n") + |
This file contains 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 | |
DVD_DIR=/misc/dvd | |
NAS_DIR=/misc/media | |
DO_LO=1 | |
DO_HI=1 | |
DO_LIST=0 | |
TRACK_NO=0 | |
REGION=0 | |
usage() { |
This file contains 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 | |
"""\ | |
gexport.py | |
Export Google Docs to a local directory. | |
Requires the GData Python client library: | |
http://code.google.com/p/gdata-python-client/ | |
""" |
This file contains 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 | |
# -*- coding: UTF-8 -*- | |
# Pull links out of a Wikipedia XML dump on STDIN and spit them out on | |
# STDOUT. | |
from mwlib.uparser import parseString as parseWikiMarkup | |
from xml.dom import pulldom | |
import sys |
This file contains 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 | |
# Kindle My RFC (or Internet-Draft) | |
# | |
# Sends an Internet Draft to your kindle | |
# Invocation: | |
# > kindle_my_rfc [path/to/rfc2629-xml-file] | |
# > kindle_my_rfc [draft-name-with-number-00] | |
# | |
# Requires: |
This file contains 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
HTTP/1.1 200 OK | |
Server: Sun-Java-System-Web-Server/7.0 | |
Date: Mon, 07 Dec 2009 07:25:34 GMT | |
P3p: policyref="http://www.sun.com/p3p/Sun_P3P_Policy.xml", CP="CAO DSP COR CUR ADMa DEVa TAIa PSAa PSDa CONi TELi OUR SAMi PUBi IND PHY ONL PUR COM NAV INT DEM CNT STA POL PRE GOV" | |
Cache-control: public | |
Set-cookie: JROUTE=W2VMz2yu926eYGvP; Path=/ | |
X-powered-by: JSP/2.1 | |
Set-cookie: JSESSIONID=80765ae114eab08df95a11208c62; Path=/ | |
Content-type: text/html;charset=UTF-8 | |
Via: 1.1 https-www |
This file contains 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
HTTP/1.1 206 Partial Content | |
Cache-Control: max-age=86400 | |
Content-Type: text/css | |
Last-Modified: Mon, 15 Mar 2010 17:41:22 GMT | |
Accept-Ranges: bytes | |
ETag: "0cd3ba66c4ca1:0" | |
Server: Microsoft-IIS/7.5 | |
X-Powered-By: ASP.NET | |
Connection: Keep-Alive | |
Date: Wed, 18 Apr 2012 16:20 |
This file contains 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
import urllib | |
import urlparse | |
def iri_to_uri(iri, encoding='Latin-1'): | |
"Takes a Unicode string that can contain an IRI and emits a URI." | |
scheme, authority, path, query, frag = urlparse.urlsplit(iri) | |
scheme = scheme.encode(encoding) | |
if ":" in authority: | |
host, port = authority.split(":", 1) | |
authority = host.encode('idna') + ":%s" % port |
This file contains 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/bash | |
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
for PROJECT in $DIR/* | |
do | |
if [ -d $PROJECT ] ; then | |
cd $PROJECT | |
# Git |
This file contains 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
""" | |
htlook.py | |
Summarise how a list of HTTP servers handles a particular request to a | |
set of URLs. | |
You can modify the request by either: | |
* Adding headers with the -a flag; e.g., |