Skip to content

Instantly share code, notes, and snippets.

View phillipsm's full-sized avatar

Matthew Phillips phillipsm

View GitHub Profile
function check_status() {
// Check our status service to see if we have archivng jobs pending
var request = $.ajax({
url: status_url + newLinky.linky_id,
type: "GET",
dataType: "json",
cache: false
});
@phillipsm
phillipsm / gist:8601065
Created January 24, 2014 16:43
wget command
# Construct wget command
command = 'wget '
command = command + '--quiet ' # turn off wget's output
command = command + '--tries=' + str(settings.NUMBER_RETRIES) + ' ' # number of retries (assuming no 404 or the like)
command = command + '--wait=' + str(settings.WAIT_BETWEEN_TRIES) + ' ' # number of seconds between requests (lighten the load on a page that has a lot of assets)
command = command + '--quota=' + settings.ARCHIVE_QUOTA + ' ' # only store this amount
command = command + '--random-wait ' # random wait between .5 seconds and --wait=
command = command + '--limit-rate=' + settings.ARCHIVE_LIMIT_RATE + ' ' # we'll be performing multiple archives at once. let's not download too much in one stream
command = command + '--adjust-extension ' # if a page is served up at .asp, adjust to .html. (this is the new --html-extension flag)
command = command + '--span-hosts ' # sometimes things like images are hosted at a CDN. let's span-hosts to get those
...
/**
* A container object to house our incoming HTTP request
*
* @author Matt Phillips <mphillips@law.harvard.edu>
* @license http://www.gnu.org/licenses/lgpl.html GNU Lesser Public License
*/
class http_request {