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
@jlank
jlank / about.md
Created January 5, 2012 03:15 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer
@jlank
jlank / gist:2592160
Created May 4, 2012 05:03
Trying to list S2 objects with awssum
var awssum = require('awssum');
var amazon = awssum.load('amazon/amazon');
var S3Service = awssum.load('amazon/s3');
var s3 = new S3Service(config.aws.accessKeyId,
config.aws.secretAccessKey, config.aws.awsAccountID, amazon.US_EAST_1);
var options1 = { BucketName: 'sdcdntest' };
s3.ListObjects(options1, function (err, data) {
console.dir(data);
@jlank
jlank / gist:2606760
Created May 6, 2012 01:11
Streaming to stdout
#!/usr/bin/env node
var Audio = require('./lib/audio'),
fs = require('fs'),
argv = require('optimist');
var a = new Audio();
var output = fs.createWriteStream('slow.wav');
var cb = function (err, res) {
@jlank
jlank / gist:2607109
Created May 6, 2012 02:19
stdin issues
#!/usr/bin/env node
var Audio = require('./lib/audio'),
argv = require('optimist')
.options('i', { alias: 'input', })
.options('o', { alias: 'output', })
.argv
;
var a = new Audio();
var spawn = require('child_process').spawn,
temp = require('temp');
Audio.prototype.slowDown = function rb(options, input, cb) {
var speed = options.speed,
s = (this.isNumeric(speed) ? Math.pow(speed, -1) :
this.error('speed needs a number')),
slow = null;
console.log('if this prints it will work');
@jlank
jlank / gist:2819672
Created May 28, 2012 15:15
ffmpeg.rb
require 'formula'
def ffplay?
ARGV.include? '--with-ffplay'
end
class Ffmpeg < Formula
homepage 'http://ffmpeg.org/'
url 'http://ffmpeg.org/releases/ffmpeg-0.11.tar.bz2'
sha1 '1aa3443c20b1c5d132d1fe06de7cc949a7219edd'
require 'formula'
def ffplay?
ARGV.include? '--with-ffplay'
end
class Ffmpeg < Formula
homepage 'http://ffmpeg.org/'
url 'http://ffmpeg.org/releases/ffmpeg-0.11.tar.bz2'
sha1 '1aa3443c20b1c5d132d1fe06de7cc949a7219edd'
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
Video.prototype.slowDown = function (options, input, cb) {
var self = this,
audio = fs.createWriteStream('/tmp/' + uuid() + '.wav'),
video = fs.createWriteStream('/tmp/' + uuid() + '.mov'),
streamed = {},
run_proc = null;
input.on('data', function (data) {
audio.write(data);
@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);