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
## An example of using lxml as a namespace-aware, event-based push | |
## parser. | |
import urllib2 | |
from contextlib import closing | |
from lxml import etree | |
class Target(object): | |
def start(self, tag, attr): |
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
"""starttls -- an example of wrapping a non-blocking socket with TLS. | |
Example: | |
> openssl req -new -x509 -days 365 -nodes -out /tmp/cert.crt -keyout /tmp/cert.key | |
> python /path/to/this-file.py | |
starting client: 7 | |
starting server: 8 | |
client said: 'hello'. | |
server said: "YOU SAID: 'hello'". |
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 | |
"""ply-path -- analysis of an path expression using PLY | |
Example: ply-path.py 'child::para[position()>1]' | |
""" | |
import sys | |
from ply import lex |
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 | |
"""demo-client.py -- query the demo server | |
Example: | |
## In one terminal: | |
> python demo-server.py | |
## In another terminal: | |
> python demo-client.py '*' |
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
// This is rudimentary view-level middleware for Express. When | |
// ServerResponse.render() is called, any middleware methods are | |
// invoked in the order they were registered. They are passed the | |
// request, response, and local template bindings. | |
// | |
// For example: | |
// | |
// var connect = require('connect'), | |
// app = require('express').createServer(); | |
// |
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
// amap -- asynchronous map | |
// | |
// Maps fn over list and passes the result to callback. For example, | |
// | |
// function loadEntries(folder, callback) { | |
// fs.readdir(folder, function(err, files) { | |
// if (err) throw err; | |
// amap(files, callback, function(name, index, next) { | |
// load(path.join(folder, name), next); | |
// }); |
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
var assert = require('assert'), | |
sys = require('sys'), | |
pwd = require('password'), | |
vows = require('vows'); | |
vows.describe('Password').addBatch({ | |
'The default method': method(pwd), | |
'The bcrypt method': method(pwd.bcrypt), | |
'The sha512 method': method(pwd.sha512) | |
}).export(module); |
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
// Create an absolute jQuery selector for a DOM element. | |
// | |
// + el - Element to select. | |
// | |
// Returns String selector. | |
function makeSelector(el) { | |
var tag, index, stack = []; | |
for (; el.parentNode; el = el.parentNode) { | |
tag = el.tagName; |
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 | |
## Download some grab.by images into the current directory. | |
## Requires curl command-line utility. | |
## | |
## The bounds should be given in base62 (e.g. in the range 0 - ZZZZ). | |
## | |
## Example: | |
## | |
## mkdir /tmp/grab |
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
gambit-server/web-server | |
snap-hello-server/bin | |
snap-hello-server/dist/ |
OlderNewer