This file contains hidden or 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 mongoose = require('mongoose'); | |
| mongoose.connect('mongodb://localhost/test'); | |
| var ThingSchema = new mongoose.Schema({ | |
| count: Number, | |
| version: Number, | |
| }); | |
| var Thing = mongoose.model('Thing', ThingSchema); | |
| var doAdd = function(id, retryTimes){ |
This file contains hidden or 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
| function partial(f) { | |
| var args = Array.prototype.slice.call(arguments, 1) | |
| return function() { | |
| var remainingArgs = Array.prototype.slice.call(arguments) | |
| return f.apply(null, args.concat(remainingArgs)) | |
| } | |
| } | |
| var options = { | |
| db: { |
This file contains hidden or 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 | |
| from datetime import datetime, timedelta | |
| def daterange(start, stop, step_minutes=1): | |
| current = start | |
| step = timedelta(minutes=step_minutes) | |
| if step_minutes > 0: | |
| while current < stop: |
This file contains hidden or 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
| # Compile nginx standalone without root access | |
| mkdir ~/installed | |
| mkdir ~/installed/nginx | |
| mkdir ~/src | |
| cd ~/src | |
| # PCRE dependency - we'll compile against this statically | |
| wget http://kent.dl.sourceforge.net/sourceforge/pcre/pcre-7.8.tar.gz | |
| tar -xzvf pcre-7.8.tar.gz |
This file contains hidden or 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 | |
| """Simple HTTP Server With Upload. | |
| This module builds on BaseHTTPServer by implementing the standard GET | |
| and HEAD requests in a fairly straightforward manner. | |
| """ |
NewerOlder