Skip to content

Instantly share code, notes, and snippets.

View jlank's full-sized avatar

John Lancaster jlank

  • SADA Systems | OrgFunder
  • Washington DC
View GitHub Profile
require 'formula'
class Ffmpeg2theora < Formula
homepage 'http://v2v.cc/~j/ffmpeg2theora/'
url 'http://v2v.cc/~j/ffmpeg2theora/downloads/ffmpeg2theora-0.28.tar.bz2'
md5 '31e389bfa0719f489af38b6fb2bd0a1f'
head 'http://svn.xiph.org/trunk/ffmpeg2theora'
depends_on 'pkg-config' => :build
@jlank
jlank / COPY.js
Created July 4, 2012 04:46
CouchDB HTTP COPY for dscape/nano
function copy_doc(doc_src, doc_dest, opts, callback) {
if(typeof opts === "function") {
callback = opts;
opts = {};
}
var params = { db: db_name, doc: doc_src, method: "COPY"
, headers: {"Destination": doc_dest} };
head_doc(doc_dest, function (e,b,h) {
if (!e && opts.overwrite) {
params.headers["Destination"] += "?rev=" + h.etag.substring(1, h.etag.length - 1);
@jlank
jlank / gist:3484641
Created August 27, 2012 00:26
forever.tail
forever.tail = function (target, options, callback) {
if (!callback && typeof options === 'function') {
callback = options;
options.length = 0;
options.stream = false;
}
@jlank
jlank / forever logs
Created August 27, 2012 00:35
sample log output
info: Showing logs for out.js
data: Mon, 27 Aug 2012 00:32:51 GMT one
data: Mon, 27 Aug 2012 00:32:53 GMT one
data: Mon, 27 Aug 2012 00:32:54 GMT one
... 97 more lines
info: Showing logs for out.js
data: Mon, 27 Aug 2012 00:32:57 GMT two
data: Mon, 27 Aug 2012 00:32:59 GMT two
data: Mon, 27 Aug 2012 00:33:00 GMT two
...97 more lines
@jlank
jlank / foreverlogs
Created August 27, 2012 00:45
new log output
$ forever logs out.js -f -n 5
data: out.js:9161 - Mon, 27 Aug 2012 00:44:29 GMT one
data: out.js:9161 - Mon, 27 Aug 2012 00:44:31 GMT one
data: out.js:9161 - Mon, 27 Aug 2012 00:44:32 GMT one
data: out.js:9161 - Mon, 27 Aug 2012 00:44:34 GMT one
data: out.js:9161 - Mon, 27 Aug 2012 00:44:35 GMT one
data: out.js:9164 - Mon, 27 Aug 2012 00:44:29 GMT two
data: out.js:9164 - Mon, 27 Aug 2012 00:44:30 GMT two
data: out.js:9164 - Mon, 27 Aug 2012 00:44:32 GMT two
data: out.js:9164 - Mon, 27 Aug 2012 00:44:33 GMT two
@jlank
jlank / gist:3555523
Created August 31, 2012 16:35
Building a CentOS 6 Box for Vagrant
exports.api = function (req, res) {
var nano = require('nano')('http://mw.iriscouh');
/* POST /api
{
food: [array, of, items],
user: 'user email'
}
*/
var obj = {};
@jlank
jlank / gist:5021363
Created February 23, 2013 21:15
starting httpd with puppet
file { '/etc/passwd':
owner => 'root',
group => 'root',
mode => '0644',
}
package { httpd: ensure => installed; }
service { "httpd":
enable => "true",
var a = {
valueOf: function () {
return 100;
},
toString: function () {
return '__test';
}
};
// in this operation
@jlank
jlank / gist:5767973
Created June 12, 2013 18:44
Automatic HTTP OPTIONS for Expressjs routes... place after all other routes. Doesn't fully conform to the protocol spec per: http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html w/r/t the `Max-Forwards` header. Would also like to add helper to automagically render a response body per: http://zacstewart.com/2012/04/14/http-options-method.html ..…
app.options('*', function (req, res) {
var path = req.originalUrl;
var allow = [];
for (var opt in app.routes) app.routes[opt].forEach(findRoutes);
function findRoutes (route) {
if (path.match(route.regexp)) allow.push(opt.toUpperCase());
}