Skip to content

Instantly share code, notes, and snippets.

View mnot's full-sized avatar

Mark Nottingham mnot

View GitHub Profile
@mnot
mnot / feed_history.py
Created December 27, 2009 10:32
feed_history - demonstration implementation of incremental feed
#!/usr/bin/env python
"""
feed_history - demonstration implementation of incremental feeds.
See:
http://www.mnot.net/drafts/draft-nottingham-atompub-feed-history-07.txt
This is a SAMPLE ONLY. In particular, error handling is not robust, entry
combination is basic, and using pickle for persistence may cause problems
(e.g., unnecessary fetches when the class is changed).
@mnot
mnot / redir_frag_test.py
Created March 13, 2010 00:11
Test for browser redirection handling WRT URI fragments, quick and dirty.
#!/usr/bin/env python
"""
Test for browser redirection handling WRT URI fragments, quick and dirty.
Usage:
./redir_frag_test.py hostname port_number
"""
import nbhttp # http://github.com/mnot/nbhttp
@mnot
mnot / invalidate_cache.js
Created May 30, 2010 05:16
invalidate_cache.js
/*
invalidate_cache.js -- HTML Includes (version 0.8)
Copyright (c) 2005-2006 Mark Nottingham <mnot@pobox.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@mnot
mnot / http_autocomplete.js
Created May 30, 2010 05:19
http_autocomplete.js
/*
http_autocomplete.js
Copyright (c) 2006 Mark Nottingham <mnot@pobox.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@mnot
mnot / chatterbox.py
Created September 6, 2010 09:56
Chatterbox - System monitoring through social networking
#!/usr/bin/env python
"""
Chatterbox - System monitoring through Social Networking.
Chatterbox uses Twitter, IM and eventually other "social" channels to
send you information about your systems, so that you can keep in touch
with how they're performing without lots of messages in your e-mail inbox
or on your pager.
@mnot
mnot / mod_loadshed.c
Created September 8, 2010 03:47
mod_loadshed.c
/**
* \file mod_loadshed.c
* \author Mark Nottingham, <mnot@mnot.net>
*
* mod_loadshed, when enabled, will refuse the request with a 503 if
* no additional Apache children are currently available. This should
* prevent requests from going to the listen queue.
*/
@mnot
mnot / test_http_conns.py
Created September 8, 2010 05:17
test_http_conns.py - Tests for how clients handle HTTP pconns and pipelining
#!/usr/bin/env python
"""
test_http_conns.py - Tests for how HTTP persistent connections are handled,
including pipelining.
This script will set up a server which summarises how a browser connecting
to it behaves. For example, FireFox with pipelining turned on will give:
--->8---
@mnot
mnot / double-cl.js
Created September 15, 2010 01:07
double-cl.js - test how clients deal with two Content-Length headers
// 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") +
@mnot
mnot / rip.sh
Created September 20, 2010 06:57
rip.sh
#!/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() {
@mnot
mnot / gexport.py
Created October 1, 2010 12:48
gexport.py - Export Google Docs to a local directory
#!/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/
"""